; ModuleID = 'LFortran'
source_filename = "LFortran"

@__lcompilers_created__nested_context__sub1_x = global i32 0
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@1 = private unnamed_addr constant [8 x i8] c"before:\00", align 1
@2 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@4 = private unnamed_addr constant [7 x i8] c"after:\00", align 1
@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
@7 = private unnamed_addr constant [10 x i8] c"x in getx\00", align 1
@8 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@9 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@10 = private unnamed_addr constant [8 x i8] c"in sub1\00", align 1
@11 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@12 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@13 = private unnamed_addr constant [4 x i8] c"r =\00", align 1
@14 = 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
  %f_val = alloca i32, align 4
  %solver = alloca i32, align 4
  %0 = call i32 %f()
  store i32 %0, i32* %f_val, align 4
  %1 = load i32, i32* %f_val, align 4
  %2 = sext i32 %1 to i64
  %3 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i32 0, i32 0), i32 2, i64 %2)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  store i32 2, i32* %call_arg_value, align 4
  %4 = load i32, i32* %iter, align 4
  %5 = sub i32 %4, 1
  store i32 %5, i32* %call_arg_value1, align 4
  %6 = call i32 @__module_recursion_03_sub1(i32* %call_arg_value, i32* %call_arg_value1)
  store i32 %6, i32* %solver, align 4
  %7 = call i32 %f()
  store i32 %7, i32* %f_val, align 4
  %8 = load i32, i32* %f_val, align 4
  %9 = sext i32 %8 to i64
  %10 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @4, i32 0, i32 0), i32 2, i64 %9)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @3, i32 0, i32 0))
  br label %return

return:                                           ; preds = %.entry
  %11 = load i32, i32* %solver, align 4
  ret i32 %11
}

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
  %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
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @9, i32 0, i32 0))
  %1 = load i32, i32* %iter, align 4
  %2 = icmp eq i32 %1, 1
  br i1 %2, 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
  %3 = load i32, i32* %x, align 4
  store i32 %3, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  %4 = call i32 @__module_recursion_03_getx()
  store i32 %4, i32* %tmp, align 4
  %5 = load i32, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  store i32 %5, i32* %x, align 4
  %6 = load i32, i32* %x, align 4
  store i32 %6, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  %7 = call i32 @__module_recursion_03_solver_caller(i32 ()* @__module_recursion_03_getx, i32* %iter)
  store i32 %7, i32* %sub1, align 4
  %8 = load i32, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  store i32 %8, i32* %x, align 4
  br label %return

return:                                           ; preds = %ifcont, %then
  %9 = load i32, i32* %sub1, align 4
  ret i32 %9
}

define i32 @__module_recursion_03_getx() {
.entry:
  %getx = alloca i32, align 4
  %0 = load i32, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  %1 = sext i32 %0 to i64
  %2 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @7, i32 0, i32 0), i32 2, i64 %1)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @8, i32 0, i32 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0))
  %3 = load i32, i32* @__lcompilers_created__nested_context__sub1_x, align 4
  store i32 %3, i32* %getx, align 4
  br label %return

return:                                           ; preds = %.entry
  %4 = load i32, i32* %getx, align 4
  ret i32 %4
}

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

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  %call_arg_value2 = alloca i32, align 4
  %call_arg_value = alloca i32, align 4
  %r = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %r1 = alloca i32, align 4
  store i32 3, i32* %call_arg_value, align 4
  store i32 3, i32* %call_arg_value2, align 4
  %2 = call i32 @__module_recursion_03_sub1(i32* %call_arg_value, i32* %call_arg_value2)
  store i32 %2, i32* %r1, align 4
  %3 = load i32, i32* %r1, align 4
  %4 = sext i32 %3 to i64
  %5 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @13, i32 0, i32 0), i32 2, i64 %4)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @14, i32 0, i32 0), i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0))
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %.entry
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

declare void @_lpython_free_argv()
