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

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

@__module___lcompilers_created__nested_context__sub1__x = global i32 0
@__module_recursion_01_n = global i32 0
@__module_recursion_01_x = global i32 0
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [3 x i8] c"I4\00", align 1
@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.1 = private unnamed_addr constant [12 x i8] c"S-DESC-4,I4\00", align 1
@string_const_data = private constant [4 x i8] c"x = "
@string_const = private global %string_descriptor <{ i8* getelementptr inbounds ([4 x i8], [4 x i8]* @string_const_data, i32 0, i32 0), i64 4 }>
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define void @__module_recursion_01_sub1(i32* %x) {
.entry:
  %stringFormat_desc = alloca %string_descriptor, align 8
  %0 = call i8* @_lfortran_get_default_allocator()
  %1 = load i32, i32* %x, align 4
  %2 = load i32, i32* @__module_recursion_01_n, align 4
  %3 = icmp slt i32 %1, %2
  br i1 %3, label %then, label %else

then:                                             ; preds = %.entry
  %4 = load i32, i32* %x, align 4
  %5 = add i32 %4, 1
  store i32 %5, i32* %x, align 4
  %6 = alloca i64, align 8
  %7 = 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.1, i32 0, i32 0), i64* %6, i32 0, i32 0, i32 0, i32 0, i32 0, %string_descriptor* @string_const, i32* %x)
  %8 = load i64, i64* %6, align 8
  %9 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %7, i8** %9, align 8
  %10 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %8, i64* %10, align 8
  %11 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %12 = load i8*, i8** %11, align 8
  %13 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %14 = load i64, i64* %13, align 8
  %15 = trunc i64 %14 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %12, i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  %16 = icmp eq i8* %7, null
  br i1 %16, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %then
  call void @_lfortran_free_alloc(i8* %0, i8* %7)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %then
  %17 = load i32, i32* %x, align 4
  store i32 %17, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  call void @sub1.__module_recursion_01_sub2()
  %18 = load i32, i32* @__module___lcompilers_created__nested_context__sub1__x, align 4
  store i32 %18, i32* %x, align 4
  call void @__module_recursion_01_sub1(i32* %x)
  br label %ifcont

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

ifcont:                                           ; preds = %else, %free_done
  br label %return

return:                                           ; preds = %ifcont
  br label %FINALIZE_SYMTABLE_sub1

FINALIZE_SYMTABLE_sub1:                           ; preds = %return
  ret void
}

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

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

free_done:                                        ; preds = %free_nonnull, %.entry
  call void @__module_recursion_01_sub1(i32* @__module___lcompilers_created__nested_context__sub1__x)
  br label %return

return:                                           ; preds = %free_done
  br label %FINALIZE_SYMTABLE_sub2

FINALIZE_SYMTABLE_sub2:                           ; preds = %return
  ret void
}

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:
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  store i32 10, i32* @__module_recursion_01_n, align 4
  call void @__module_recursion_01_sub1(i32* @__module_recursion_01_x)
  br label %return

return:                                           ; preds = %.entry
  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()
