; ModuleID = 'LFortran'
source_filename = "LFortran"

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@1 = private unnamed_addr constant [4 x i8] c"abs\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 [4 x i8] c"sum\00", align 1
@5 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@6 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@8 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define i32 @main(i32 %0, i8** %1) {
.entry:
  %call_arg_value2 = alloca float, align 4
  %call_arg_value1 = alloca i32, align 4
  %call_arg_value = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %a = alloca [3 x float], align 4
  %b = alloca float, align 4
  %2 = getelementptr [3 x float], [3 x float]* %a, i32 0, i32 0
  store float 3.000000e+00, float* %2, align 4
  %3 = getelementptr [3 x float], [3 x float]* %a, i32 0, i32 1
  store float 2.000000e+00, float* %3, align 4
  %4 = getelementptr [3 x float], [3 x float]* %a, i32 0, i32 2
  store float 1.000000e+00, float* %4, align 4
  %5 = getelementptr [3 x float], [3 x float]* %a, i32 0, i32 0
  store i32 1, i32* %call_arg_value, align 4
  store i32 3, i32* %call_arg_value1, align 4
  %6 = call float @sum_real____0(float* %5, i32* %call_arg_value, i32* %call_arg_value1)
  store float %6, float* %b, align 4
  %7 = load float, float* %b, align 4
  %8 = fsub float %7, 6.000000e+00
  store float %8, float* %call_arg_value2, align 4
  %9 = call float @abs(float* %call_arg_value2)
  %10 = fcmp ogt float %9, 0x3EE4F8B580000000
  br i1 %10, label %then, label %else

then:                                             ; preds = %.entry
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @8, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont

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

ifcont:                                           ; preds = %else, %then
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont
  ret i32 0
}

define float @abs(float* %a) {
.entry:
  %r = alloca float, align 4
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  %0 = load float, float* %a, align 4
  %1 = fcmp ogt float %0, 0.000000e+00
  br i1 %1, label %then, label %else

then:                                             ; preds = %.entry
  %2 = load float, float* %a, align 4
  store float %2, float* %r, align 4
  br label %ifcont

else:                                             ; preds = %.entry
  %3 = load float, float* %a, align 4
  %4 = fneg float %3
  store float %4, float* %r, align 4
  br label %ifcont

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

return:                                           ; preds = %ifcont
  %5 = load float, float* %r, align 4
  ret float %5
}

define float @sum_real____0(float* %a, i32* %__1a, i32* %__2a) {
.entry:
  %i = alloca i32, align 4
  %r = alloca float, align 4
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @3, i32 0, i32 0))
  store float 0.000000e+00, float* %r, align 4
  store i32 0, i32* %i, align 4
  br label %loop.head

loop.head:                                        ; preds = %loop.body, %.entry
  %0 = load i32, i32* %i, align 4
  %1 = add i32 %0, 1
  %2 = load i32, i32* %__2a, align 4
  %3 = mul i32 1, %2
  %4 = icmp sle i32 %1, %3
  br i1 %4, label %loop.body, label %loop.end

loop.body:                                        ; preds = %loop.head
  %5 = load i32, i32* %i, align 4
  %6 = add i32 %5, 1
  store i32 %6, i32* %i, align 4
  %7 = load float, float* %r, align 4
  %8 = load i32, i32* %i, align 4
  %9 = load i32, i32* %__1a, align 4
  %10 = load i32, i32* %__2a, align 4
  %11 = sub i32 %8, %9
  %12 = mul i32 1, %11
  %13 = add i32 0, %12
  %14 = mul i32 1, %10
  %15 = getelementptr inbounds float, float* %a, i32 %13
  %16 = load float, float* %15, align 4
  %17 = fadd float %7, %16
  store float %17, float* %r, align 4
  br label %loop.head

loop.end:                                         ; preds = %loop.head
  br label %return

return:                                           ; preds = %loop.end
  %18 = load float, float* %r, align 4
  ret float %18
}

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

declare void @_lpython_call_initial_functions(i32, i8**)

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

declare void @exit(i32)

declare void @_lpython_free_argv()
