; ModuleID = 'LFortran'
source_filename = "LFortran"

@intrinsics_03.i = internal global i32 -12
@0 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@2 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@3 = 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
@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
@9 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@10 = private unnamed_addr constant [2 x i8] c"\0A\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 [5 x i8] c"%s%s\00", align 1
@14 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@15 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@16 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define float @_lcompilers_abs_f32(float* %x) {
.entry:
  %_lcompilers_abs_f32 = alloca float, align 4
  %0 = load float, float* %x, align 4
  %1 = fcmp oge float %0, 0.000000e+00
  br i1 %1, label %then, label %else

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

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

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

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

define double @_lcompilers_abs_f64(double* %x) {
.entry:
  %_lcompilers_abs_f64 = alloca double, align 8
  %0 = load double, double* %x, align 8
  %1 = fcmp oge double %0, 0.000000e+00
  br i1 %1, label %then, label %else

then:                                             ; preds = %.entry
  %2 = load double, double* %x, align 8
  store double %2, double* %_lcompilers_abs_f64, align 8
  br label %ifcont

else:                                             ; preds = %.entry
  %3 = load double, double* %x, align 8
  %4 = fneg double %3
  store double %4, double* %_lcompilers_abs_f64, align 8
  br label %ifcont

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

return:                                           ; preds = %ifcont
  %5 = load double, double* %_lcompilers_abs_f64, align 8
  ret double %5
}

define i32 @_lcompilers_abs_i32(i32* %x) {
.entry:
  %_lcompilers_abs_i32 = alloca i32, align 4
  %0 = load i32, i32* %x, align 4
  %1 = icmp sge i32 %0, 0
  br i1 %1, label %then, label %else

then:                                             ; preds = %.entry
  %2 = load i32, i32* %x, align 4
  store i32 %2, i32* %_lcompilers_abs_i32, align 4
  br label %ifcont

else:                                             ; preds = %.entry
  %3 = load i32, i32* %x, align 4
  %4 = sub i32 0, %3
  store i32 %4, i32* %_lcompilers_abs_i32, align 4
  br label %ifcont

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

return:                                           ; preds = %ifcont
  %5 = load i32, i32* %_lcompilers_abs_i32, align 4
  ret i32 %5
}

define double @_lcompilers_cos_f64(double* %x) {
.entry:
  %_lcompilers_cos_f64 = alloca double, align 8
  %0 = load double, double* %x, align 8
  %1 = call double @_lfortran_dcos(double %0)
  store double %1, double* %_lcompilers_cos_f64, align 8
  br label %return

return:                                           ; preds = %.entry
  %2 = load double, double* %_lcompilers_cos_f64, align 8
  ret double %2
}

declare double @_lfortran_dcos(double)

define i32 @main(i32 %0, i8** %1) {
.entry:
  %call_arg_value11 = alloca double, align 8
  %call_arg_value7 = alloca double, align 8
  %call_arg_value6 = alloca double, align 8
  %call_arg_value5 = alloca double, align 8
  %call_arg_value1 = alloca double, align 8
  %call_arg_value = alloca float, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %a = alloca double, align 8
  %r1 = alloca double, align 8
  %r2 = alloca double, align 8
  %x = alloca float, align 4
  store double 4.200000e+00, double* %a, align 8
  store float 0xBFEFE8D5A0000000, float* %x, align 4
  %2 = load float, float* %x, align 4
  %3 = fadd float %2, 0x3FEFE8D5A0000000
  store float %3, float* %call_arg_value, align 4
  %4 = call float @_lcompilers_abs_f32(float* %call_arg_value)
  %5 = fcmp ogt float %4, 0x3E7AD7F2A0000000
  br i1 %5, label %then, label %else

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

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

ifcont:                                           ; preds = %else, %then
  %6 = call double @_lcompilers_cos_f64(double* %a)
  %7 = fadd double %6, 0x3FDF606EEB1A3FC7
  store double %7, double* %call_arg_value1, align 8
  %8 = call double @_lcompilers_abs_f64(double* %call_arg_value1)
  %9 = fcmp ogt double %8, 0x3E7AD7F29ABCAF48
  br i1 %9, label %then2, label %else3

then2:                                            ; preds = %ifcont
  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]* @3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont4

else3:                                            ; preds = %ifcont
  br label %ifcont4

ifcont4:                                          ; preds = %else3, %then2
  %10 = load double, double* %a, align 8
  %11 = call double @_lcompilers_cos_f64(double* %a)
  %12 = fadd double %10, %11
  store double %12, double* %call_arg_value5, align 8
  %13 = call double @_lcompilers_cos_f64(double* %call_arg_value5)
  %14 = fadd double 0x3FB21BD54FC5F9A7, %13
  store double %14, double* %call_arg_value6, align 8
  %15 = call double @_lcompilers_cos_f64(double* %call_arg_value6)
  %16 = fsub double %15, 0x3FE6ECC71DE13C70
  store double %16, double* %call_arg_value7, align 8
  %17 = call double @_lcompilers_abs_f64(double* %call_arg_value7)
  %18 = fcmp ogt double %17, 0x3E7AD7F29ABCAF48
  br i1 %18, label %then8, label %else9

then8:                                            ; preds = %ifcont4
  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 %ifcont10

else9:                                            ; preds = %ifcont4
  br label %ifcont10

ifcont10:                                         ; preds = %else9, %then8
  %19 = call double @_lcompilers_cos_f64(double* %a)
  store double %19, double* %r1, align 8
  store double 0xBFDF606EEC8AC71E, double* %r2, align 8
  %20 = load double, double* %r1, align 8
  %21 = load double, double* %r2, align 8
  %22 = fsub double %20, %21
  store double %22, double* %call_arg_value11, align 8
  %23 = call double @_lcompilers_abs_f64(double* %call_arg_value11)
  %24 = fcmp ogt double %23, 1.000000e-15
  br i1 %24, label %then12, label %else13

then12:                                           ; preds = %ifcont10
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @10, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont14

else13:                                           ; preds = %ifcont10
  br label %ifcont14

ifcont14:                                         ; preds = %else13, %then12
  %25 = call i32 @_lcompilers_abs_i32(i32* @intrinsics_03.i)
  %26 = sext i32 %25 to i64
  %27 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %26)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @13, i32 0, i32 0), i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0))
  %28 = call i32 @_lcompilers_abs_i32(i32* @intrinsics_03.i)
  %29 = icmp ne i32 %28, 12
  br i1 %29, label %then15, label %else16

then15:                                           ; preds = %ifcont14
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @16, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @15, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont17

else16:                                           ; preds = %ifcont14
  br label %ifcont17

ifcont17:                                         ; preds = %else16, %then15
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont17
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

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

declare void @exit(i32)

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

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

declare void @_lpython_free_argv()
