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

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

@associate_03.t1 = internal global i32 2
@associate_03.t2 = internal global i32 1
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [6 x i8] c"I4,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 [3 x i8] c"I4\00", align 1
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@"ERROR STOP" = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@5 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define i32 @main(i32 %0, i8** %1) {
.entry:
  %stringFormat_desc1 = alloca %string_descriptor, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %2 = call i8* @_lfortran_get_default_allocator()
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %i = alloca i32, align 4
  %p1 = alloca i32*, align 8
  store i32* null, i32** %p1, align 8
  %3 = alloca i64, align 8
  %4 = 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 ([6 x i8], [6 x i8]* @serialization_info, i32 0, i32 0), i64* %3, i32 0, i32 0, i32 0, i32 0, i32 0, i32* @associate_03.t1, i32* @associate_03.t2)
  %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* %2, i8* %4)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %.entry
  %14 = load i32, i32* @associate_03.t1, align 4
  %15 = load i32, i32* @associate_03.t2, align 4
  %16 = icmp sgt i32 %14, %15
  br i1 %16, label %then, label %else

then:                                             ; preds = %free_done
  store i32* @associate_03.t1, i32** %p1, align 8
  br label %ifcont

else:                                             ; preds = %free_done
  store i32* @associate_03.t2, i32** %p1, align 8
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  %17 = alloca i64, align 8
  %18 = load i32*, i32** %p1, align 8
  %19 = 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 ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i64* %17, i32 0, i32 0, i32 0, i32 0, i32 0, i32* %18)
  %20 = load i64, i64* %17, align 8
  %21 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  store i8* %19, i8** %21, align 8
  %22 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  store i64 %20, i64* %22, align 8
  %23 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  %24 = load i8*, i8** %23, align 8
  %25 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  %26 = load i64, i64* %25, align 8
  %27 = trunc i64 %26 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %24, i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  %28 = icmp eq i8* %19, null
  br i1 %28, label %free_done3, label %free_nonnull2

free_nonnull2:                                    ; preds = %ifcont
  call void @_lfortran_free_alloc(i8* %2, i8* %19)
  br label %free_done3

free_done3:                                       ; preds = %free_nonnull2, %ifcont
  %29 = load i32*, i32** %p1, align 8
  %30 = load i32, i32* %29, align 4
  store i32 %30, i32* %i, align 4
  %31 = load i32, i32* %i, align 4
  %32 = load i32, i32* @associate_03.t2, align 4
  %33 = icmp eq i32 %31, %32
  br i1 %33, label %then4, label %else5

then4:                                            ; preds = %free_done3
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @"ERROR STOP", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0))
  call void @_lfortran_internal_alloc_finalize()
  call void @exit(i32 1)
  br label %ifcont6

else5:                                            ; preds = %free_done3
  br label %ifcont6

ifcont6:                                          ; preds = %else5, %then4
  br label %return

return:                                           ; preds = %ifcont6
  br label %FINALIZE_SYMTABLE_associate_03

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

declare void @_lpython_call_initial_functions(i32, i8**)

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*)

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

declare void @_lfortran_internal_alloc_finalize()

declare void @exit(i32)
