; ModuleID = 'LFortran'
source_filename = "LFortran"
target datalayout = "..."

%string_descriptor = type <{ i8*, i64 }>

@__module___lcompilers_created__nested_context__sub1__x = global i32 0
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [12 x i8] c"S-DESC-7,I4\00", align 1
@string_const_data = private constant [7 x i8] c"before:"
@string_const = private global %string_descriptor <{ i8* getelementptr inbounds ([7 x i8], [7 x i8]* @string_const_data, i32 0, i32 0), i64 7 }>
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.2 = private unnamed_addr constant [12 x i8] c"S-DESC-6,I4\00", align 1
@string_const_data.3 = private constant [6 x i8] c"after:"
@string_const.4 = private global %string_descriptor <{ i8* getelementptr inbounds ([6 x i8], [6 x i8]* @string_const_data.3, i32 0, i32 0), i64 6 }>
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.5 = private unnamed_addr constant [12 x i8] c"S-DESC-9,I4\00", align 1
@string_const_data.6 = private constant [9 x i8] c"x in getx"
@string_const.7 = private global %string_descriptor <{ i8* getelementptr inbounds ([9 x i8], [9 x i8]* @string_const_data.6, i32 0, i32 0), i64 9 }>
@5 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@6 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@string_const_data.8 = private constant [7 x i8] c"in sub1"
@string_const.9 = private global %string_descriptor <{ i8* getelementptr inbounds ([7 x i8], [7 x i8]* @string_const_data.8, i32 0, i32 0), i64 7 }>
@7 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.10 = private unnamed_addr constant [12 x i8] c"S-DESC-3,I4\00", align 1
@string_const_data.11 = private constant [3 x i8] c"r ="
@string_const.12 = private global %string_descriptor <{ i8* getelementptr inbounds ([3 x i8], [3 x i8]* @string_const_data.11, i32 0, i32 0), i64 3 }>
@9 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define i32 @__module_recursion_03_solver(i32 ()* %f, i32* %iter) {
.entry:
  %call_arg_value1 = alloca i32, align 4
  %call_arg_value = alloca i32, align 4
  %0 = call i8* @_lfortran_get_default_allocator()
  %f_val = alloca i32, align 4
  %solver = alloca i32, align 4
  %1 = call i32 %f()
  store i32 %1, i32* %f_val, align 4
  %2 = alloca i64, align 8
  %3 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %0, i8* null, i64 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @serialization_info, i32 0, i32 0), i64* %2, i32 0, i32 0, i32 0, i32 0, i32 0, %string_descriptor* @string_const, i32* %f_val)
  %4 = load i64, i64* %2, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %5 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %3, i8** %5, align 8
  %6 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %4, i64* %6, align 8
  %7 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %8 = load i8*, i8** %7, align 8
  %9 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %10 = load i64, i64* %9, align 8
  %11 = trunc i64 %10 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %8, i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 1)
  %12 = icmp eq i8* %3, null
  br i1 %12, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %.entry
  call void @_lfortran_free_alloc(i8* %0, i8* %3)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %.entry
  store i32 2, i32* %call_arg_value, align 4
  %13 = load i32, i32* %iter, align 4
  %14 = sub i32 %13, 1
  store i32 %14, i32* %call_arg_value1, align 4
  %15 = call i32 @__module_recursion_03_sub1(i32* %call_arg_value, i32* %call_arg_value1)
  store i32 %15, i32* %solver, align 4
  %16 = call i32 %f()
  store i32 %16, i32* %f_val, align 4
  %17 = alloca i64, align 8
  %18 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %0, i8* null, i64 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @serialization_info.2, i32 0, i32 0), i64* %17, i32 0, i32 0, i32 0, i32 0, i32 0, %string_descriptor* @string_const.4, i32* %f_val)
  %19 = load i64, i64* %17, align 8
  %stringFormat_desc2 = alloca %string_descriptor, align 8
  %20 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc2, i32 0, i32 0
  store i8* %18, i8** %20, align 8
  %21 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc2, i32 0, i32 1
  store i64 %19, i64* %21, align 8
  %22 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc2, i32 0, i32 0
  %23 = load i8*, i8** %22, align 8
  %24 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc2, i32 0, i32 1
  %25 = load i64, i64* %24, align 8
  %26 = trunc i64 %25 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %23, i32 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  %27 = icmp eq i8* %18, null
  br i1 %27, label %free_done4, label %free_nonnull3

free_nonnull3:                                    ; preds = %free_done
  call void @_lfortran_free_alloc(i8* %0, i8* %18)
  br label %free_done4

free_done4:                                       ; preds = %free_nonnull3, %free_done
  br label %return

return:                                           ; preds = %free_done4
  br label %FINALIZE_SYMTABLE_solver

FINALIZE_SYMTABLE_solver:                         ; preds = %return
  %28 = load i32, i32* %solver, align 4
  ret i32 %28
}

declare i32 @f()

define i32 @__module_recursion_03_solver_caller(i32 ()* %f, i32* %iter) {
.entry:
  %solver_caller = alloca i32, align 4
  %0 = call i32 @__module_recursion_03_solver(i32 ()* %f, i32* %iter)
  store i32 %0, i32* %solver_caller, align 4
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE_solver_caller

FINALIZE_SYMTABLE_solver_caller:                  ; preds = %return
  %1 = load i32, i32* %solver_caller, align 4
  ret i32 %1
}

declare i32 @f.1()

define i32 @__module_recursion_03_sub1(i32* %y, i32* %iter) {
.entry:
  %sub1 = alloca i32, align 4
  %tmp = alloca i32, align 4
  %x = alloca i32, align 4
  %0 = load i32, i32* %y, align 4
  store i32 %0, i32* %x, align 4
  %1 = load i8*, i8** getelementptr inbounds (%string_descriptor, %string_descriptor* @string_const.9, i32 0, i32 0), align 8
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* %1, i32 7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0), i32 1)
  %2 = load i32, i32* %iter, align 4
  %3 = icmp eq i32 %2, 1
  br i1 %3, label %then, label %else

then:                                             ; preds = %.entry
  store i32 1, i32* %sub1, align 4
  br label %return

unreachable_after_return:                         ; No predecessors!
  br label %ifcont

else:                                             ; preds = %.entry
  br label %ifcont

ifcont:                                           ; preds = %else, %unreachable_after_return
  %4 = load i32, i32* %x, align 4
  store i32 %4, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  %5 = call i32 @sub1.__module_recursion_03_getx()
  store i32 %5, i32* %tmp, align 4
  %6 = load i32, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  store i32 %6, i32* %x, align 4
  %7 = load i32, i32* %x, align 4
  store i32 %7, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  %8 = call i32 @__module_recursion_03_solver_caller(i32 ()* @sub1.__module_recursion_03_getx, i32* %iter)
  store i32 %8, i32* %sub1, align 4
  %9 = load i32, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  store i32 %9, i32* %x, align 4
  br label %return

return:                                           ; preds = %ifcont, %then
  br label %FINALIZE_SYMTABLE_sub1

FINALIZE_SYMTABLE_sub1:                           ; preds = %return
  %10 = load i32, i32* %sub1, align 4
  ret i32 %10
}

define i32 @sub1.__module_recursion_03_getx() {
.entry:
  %0 = call i8* @_lfortran_get_default_allocator()
  %getx = alloca i32, align 4
  %1 = alloca i64, align 8
  %2 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %0, i8* null, i64 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @serialization_info.5, i32 0, i32 0), i64* %1, i32 0, i32 0, i32 0, i32 0, i32 0, %string_descriptor* @string_const.7, i32* @__module___lcompilers_created__nested_context__sub1__x)
  %3 = load i64, i64* %1, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %4 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %2, i8** %4, align 8
  %5 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %3, i64* %5, align 8
  %6 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %7 = load i8*, i8** %6, align 8
  %8 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %9 = load i64, i64* %8, align 8
  %10 = trunc i64 %9 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %7, i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0), i32 1)
  %11 = icmp eq i8* %2, null
  br i1 %11, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %.entry
  call void @_lfortran_free_alloc(i8* %0, i8* %2)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %.entry
  %12 = load i32, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  store i32 %12, i32* %getx, align 4
  br label %return

return:                                           ; preds = %free_done
  br label %FINALIZE_SYMTABLE_getx

FINALIZE_SYMTABLE_getx:                           ; preds = %return
  %13 = load i32, i32* %getx, align 4
  ret i32 %13
}

declare i8* @_lcompilers_string_format_fortran(i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...)

declare i8* @_lfortran_get_default_allocator()

declare void @_lfortran_printf(i8*, i8*, i32, i8*, i32)

declare void @_lfortran_free_alloc(i8*, i8*)

define i32 @main(i32 %0, i8** %1) {
.entry:
  %2 = call i8* @_lfortran_get_default_allocator()
  %call_arg_value1 = alloca i32, align 4
  %call_arg_value = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %r = alloca i32, align 4
  store i32 3, i32* %call_arg_value, align 4
  store i32 3, i32* %call_arg_value1, align 4
  %3 = call i32 @__module_recursion_03_sub1(i32* %call_arg_value, i32* %call_arg_value1)
  store i32 %3, i32* %r, align 4
  %4 = alloca i64, align 8
  %5 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %2, i8* null, i64 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @serialization_info.10, i32 0, i32 0), i64* %4, i32 0, i32 0, i32 0, i32 0, i32 0, %string_descriptor* @string_const.12, i32* %r)
  %6 = load i64, i64* %4, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %7 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %5, i8** %7, align 8
  %8 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %6, i64* %8, align 8
  %9 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %10 = load i8*, i8** %9, align 8
  %11 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %12 = load i64, i64* %11, align 8
  %13 = trunc i64 %12 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @9, i32 0, i32 0), i8* %10, i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0), i32 1)
  %14 = icmp eq i8* %5, null
  br i1 %14, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %.entry
  call void @_lfortran_free_alloc(i8* %2, i8* %5)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %.entry
  br label %return

return:                                           ; preds = %free_done
  br label %FINALIZE_SYMTABLE_main

FINALIZE_SYMTABLE_main:                           ; preds = %return
  call void @_lfortran_internal_alloc_finalize()
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

declare void @_lfortran_internal_alloc_finalize()
