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

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

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [9 x i8] c"R4,R4,R4\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"R4\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 float @_lcompilers_cos_f32(float* %x) {
.entry:
  %_lcompilers_cos_f32 = alloca float, align 4
  %0 = load float, float* %x, align 4
  %1 = call float @_lfortran_scos(float %0)
  store float %1, float* %_lcompilers_cos_f32, align 4
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE__lcompilers_cos_f32

FINALIZE_SYMTABLE__lcompilers_cos_f32:            ; preds = %return
  %2 = load float, float* %_lcompilers_cos_f32, align 4
  ret float %2
}

declare float @_lfortran_scos(float)

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)
  %a = alloca float, align 4
  %myreal = alloca float, align 4
  %theta = alloca float, align 4
  %x = alloca float, align 4
  %y = alloca float, align 4
  store float 0x3FDAE147A0000000, float* %x, align 4
  store float 0x3FD6666660000000, float* %y, align 4
  store float 0x4022333340000000, float* %myreal, align 4
  store float 1.500000e+00, float* %theta, align 4
  store float 0x3FD99999A0000000, float* %a, align 4
  br label %associate_block_start

associate_block_start:                            ; preds = %.entry
  %3 = call i8* @llvm.stacksave()
  %v = alloca float*, align 8
  store float* null, float** %v, align 8
  %z = alloca float, align 4
  %4 = load float, float* %x, align 4
  %5 = fmul float %4, 2.000000e+00
  %6 = load float, float* %y, align 4
  %7 = fmul float %6, 2.000000e+00
  %8 = fadd float %5, %7
  %9 = fneg float %8
  %10 = call float @_lcompilers_cos_f32(float* %theta)
  %11 = fmul float %9, %10
  store float %11, float* %z, align 4
  store float* %myreal, float** %v, align 8
  %12 = alloca i64, align 8
  %13 = load float, float* %a, align 4
  %14 = load float, float* %z, align 4
  %15 = fadd float %13, %14
  %16 = alloca float, align 4
  store float %15, float* %16, align 4
  %17 = load float, float* %a, align 4
  %18 = load float, float* %z, align 4
  %19 = fsub float %17, %18
  %20 = alloca float, align 4
  store float %19, float* %20, align 4
  %21 = load float*, float** %v, align 8
  %22 = 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 ([9 x i8], [9 x i8]* @serialization_info, i32 0, i32 0), i64* %12, i32 0, i32 0, i32 0, i32 0, i32 0, float* %16, float* %20, float* %21)
  %23 = load i64, i64* %12, align 8
  %24 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %22, i8** %24, align 8
  %25 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %23, i64* %25, align 8
  %26 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %27 = load i8*, i8** %26, align 8
  %28 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %29 = load i64, i64* %28, align 8
  %30 = trunc i64 %29 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %27, i32 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 1)
  %31 = icmp eq i8* %22, null
  br i1 %31, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %associate_block_start
  call void @_lfortran_free_alloc(i8* %2, i8* %22)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %associate_block_start
  %32 = load float*, float** %v, align 8
  %33 = load float*, float** %v, align 8
  %34 = load float, float* %33, align 4
  %35 = fmul float %34, 0x4012666660000000
  store float %35, float* %32, align 4
  br label %associate_block_end

associate_block_end:                              ; preds = %free_done
  br label %FINALIZE_SYMTABLE_associate_block

FINALIZE_SYMTABLE_associate_block:                ; preds = %associate_block_end
  call void @llvm.stackrestore(i8* %3)
  %36 = alloca i64, align 8
  %37 = 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* %36, i32 0, i32 0, i32 0, i32 0, i32 0, float* %myreal)
  %38 = load i64, i64* %36, align 8
  %39 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  store i8* %37, i8** %39, align 8
  %40 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  store i64 %38, i64* %40, align 8
  %41 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  %42 = load i8*, i8** %41, align 8
  %43 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  %44 = load i64, i64* %43, align 8
  %45 = trunc i64 %44 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %42, i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  %46 = icmp eq i8* %37, null
  br i1 %46, label %free_done3, label %free_nonnull2

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

free_done3:                                       ; preds = %free_nonnull2, %FINALIZE_SYMTABLE_associate_block
  %47 = load float, float* %myreal, align 4
  %48 = fsub float %47, 0x4044EE1480000000
  %49 = fcmp ogt float %48, 0x3EE4F8B580000000
  %50 = load float, float* %myreal, align 4
  %51 = fsub float %50, 0x4044EE1480000000
  %52 = fcmp olt float %51, 0xBEE4F8B580000000
  %53 = or i1 %49, %52
  br i1 %53, label %then, label %else

then:                                             ; 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 %ifcont

else:                                             ; preds = %free_done3
  br label %ifcont

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

return:                                           ; preds = %ifcont
  br label %FINALIZE_SYMTABLE_associate_04

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

declare void @_lpython_call_initial_functions(i32, i8**)

; Function Attrs: nounwind
declare i8* @llvm.stacksave() #0

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

; Function Attrs: nounwind
declare void @llvm.stackrestore(i8*) #0

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

declare void @_lfortran_internal_alloc_finalize()

declare void @exit(i32)

attributes #0 = { nounwind }
