; LLVM IR from OpenFAST/openfast :: modules/map/src (lineroutines)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Line_t = type { ptr, %struct.LineOptions, %struct.VarTypePtr_t, %struct.VarTypePtr_t, %struct.VarType_t, ptr, ptr, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, %struct.list_t, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.LineOptions = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%struct.VarTypePtr_t = type { ptr, ptr, ptr, i8, i32, i32 }
%struct.VarType_t = type { ptr, ptr, double, i8, i8, i32, i32 }
%struct.list_t = type { ptr, ptr, ptr, i32, ptr, i32, i32, i32, ptr, %struct.list_attributes_s }
%struct.list_attributes_s = type { ptr, ptr, ptr, i32, ptr, ptr, ptr }
%struct.CableLibrary_t = type { double, double, double, double, double, double, double, double, double, double, ptr }

@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @set_universal_error_with_message(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @check_maximum_line_length(ptr noundef %0, i1 noundef zeroext %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  %17 = zext i1 %1 to i8
  store i8 %17, ptr %7, align 1, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store double 0.000000e+00, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Line_t, ptr %18, i32 0, i32 10
  %20 = load double, ptr %19, align 8, !tbaa !13
  store double %20, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Line_t, ptr %21, i32 0, i32 12
  %23 = load double, ptr %22, align 8, !tbaa !21
  store double %23, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Line_t, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !22
  %27 = getelementptr inbounds %struct.CableLibrary_t, ptr %26, i32 0, i32 2
  %28 = load double, ptr %27, align 8, !tbaa !23
  store double %28, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.Line_t, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !22
  %32 = getelementptr inbounds %struct.CableLibrary_t, ptr %31, i32 0, i32 3
  %33 = load double, ptr %32, align 8, !tbaa !25
  store double %33, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.Line_t, ptr %34, i32 0, i32 4
  %36 = getelementptr inbounds %struct.VarType_t, ptr %35, i32 0, i32 2
  %37 = load double, ptr %36, align 8, !tbaa !26
  store double %37, ptr %15, align 8, !tbaa !11
  %38 = load double, ptr %11, align 8, !tbaa !11
  %39 = load double, ptr %13, align 8, !tbaa !11
  %40 = load double, ptr %14, align 8, !tbaa !11
  %41 = fdiv double %39, %40
  %42 = fsub double %38, %41
  %43 = load double, ptr %13, align 8, !tbaa !11
  %44 = load double, ptr %14, align 8, !tbaa !11
  %45 = fdiv double %43, %44
  %46 = call double @pow(double noundef %45, double noundef 2.000000e+00) #4
  %47 = load double, ptr %12, align 8, !tbaa !11
  %48 = fmul double 2.000000e+00, %47
  %49 = load double, ptr %13, align 8, !tbaa !11
  %50 = fmul double %48, %49
  %51 = load double, ptr %14, align 8, !tbaa !11
  %52 = fdiv double %50, %51
  %53 = fadd double %46, %52
  %54 = call double @sqrt(double noundef %53) #4
  %55 = fadd double %42, %54
  store double %55, ptr %10, align 8, !tbaa !11
  %56 = load double, ptr %15, align 8, !tbaa !11
  %57 = load double, ptr %10, align 8, !tbaa !11
  %58 = fcmp oge double %56, %57
  br i1 %58, label %59, label %68

59:                                               ; preds = %4
  %60 = load i8, ptr %7, align 1, !tbaa !9, !range !27, !noundef !28
  %61 = trunc i8 %60 to i1
  %62 = zext i1 %61 to i32
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %68

64:                                               ; preds = %59
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load double, ptr %10, align 8, !tbaa !11
  call void (ptr, ptr, i32, ptr, ...) @set_universal_error_with_message(ptr noundef %65, ptr noundef %66, i32 noundef 59, ptr noundef @.str.4, double noundef %67)
  store i32 3, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %69

68:                                               ; preds = %59, %4
  store i32 0, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %69

69:                                               ; preds = %68, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %70 = load i32, ptr %5, align 4
  ret i32 %70
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 200}
!14 = !{!"Line_t", !6, i64 0, !15, i64 8, !16, i64 40, !16, i64 80, !18, i64 120, !6, i64 160, !6, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !12, i64 272, !12, i64 280, !12, i64 288, !12, i64 296, !12, i64 304, !12, i64 312, !19, i64 320, !6, i64 440, !6, i64 448, !17, i64 456, !17, i64 460, !17, i64 464, !17, i64 468, !17, i64 472}
!15 = !{!"", !10, i64 0, !10, i64 1, !10, i64 2, !10, i64 3, !10, i64 4, !10, i64 5, !10, i64 6, !10, i64 7, !10, i64 8, !10, i64 9, !10, i64 10, !10, i64 11, !10, i64 12, !10, i64 13, !10, i64 14, !10, i64 15, !10, i64 16, !10, i64 17, !10, i64 18, !10, i64 19, !10, i64 20, !10, i64 21, !10, i64 22, !10, i64 23, !10, i64 24, !10, i64 25}
!16 = !{!"VarTypePtr_t", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !17, i64 28, !17, i64 32}
!17 = !{!"int", !7, i64 0}
!18 = !{!"VarType_t", !6, i64 0, !6, i64 8, !12, i64 16, !10, i64 24, !10, i64 25, !17, i64 28, !17, i64 32}
!19 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !17, i64 24, !6, i64 32, !17, i64 40, !17, i64 44, !17, i64 48, !6, i64 56, !20, i64 64}
!20 = !{!"list_attributes_s", !6, i64 0, !6, i64 8, !6, i64 16, !17, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!21 = !{!14, !12, i64 216}
!22 = !{!14, !6, i64 0}
!23 = !{!24, !12, i64 16}
!24 = !{!"CableLibrary_t", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !6, i64 80}
!25 = !{!24, !12, i64 24}
!26 = !{!14, !12, i64 136}
!27 = !{i8 0, i8 2}
!28 = !{}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1

declare void @set_universal_error_with_message(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @check_maximum_line_length(ptr nocapture noundef readonly %0, i1 noundef zeroext %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 200
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 216
  %8 = load double, ptr %7, align 8, !tbaa !18
  %9 = load ptr, ptr %0, align 8, !tbaa !19
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load double, ptr %10, align 8, !tbaa !20
  %12 = getelementptr inbounds i8, ptr %9, i64 24
  %13 = load double, ptr %12, align 8, !tbaa !22
  %14 = getelementptr inbounds i8, ptr %0, i64 136
  %15 = load double, ptr %14, align 8, !tbaa !23
  %16 = fmul double %8, 2.000000e+00
  %17 = fmul double %16, %11
  %18 = insertelement <2 x double> poison, double %17, i64 0
  %19 = insertelement <2 x double> %18, double %11, i64 1
  %20 = insertelement <2 x double> poison, double %13, i64 0
  %21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
  %22 = fdiv <2 x double> %19, %21
  %23 = extractelement <2 x double> %22, i64 1
  %24 = fsub double %6, %23
  %square = fmul double %23, %23
  %25 = extractelement <2 x double> %22, i64 0
  %26 = fadd double %25, %square
  %27 = tail call double @sqrt(double noundef %26) #3
  %28 = fadd double %24, %27
  %29 = fcmp ult double %15, %28
  %brmerge = or i1 %29, %1
  br i1 %brmerge, label %31, label %30

30:                                               ; preds = %4
  tail call void (ptr, ptr, i32, ptr, ...) @set_universal_error_with_message(ptr noundef %2, ptr noundef %3, i32 noundef 59, ptr noundef nonnull @.str.4, double noundef %28) #3
  br label %31

31:                                               ; preds = %4, %30
  %.0 = phi i32 [ 3, %30 ], [ 0, %4 ]
  ret i32 %.0
}

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !15, i64 200}
!6 = !{!"Line_t", !7, i64 0, !10, i64 8, !12, i64 40, !12, i64 80, !14, i64 120, !7, i64 160, !7, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224, !15, i64 232, !15, i64 240, !15, i64 248, !15, i64 256, !15, i64 264, !15, i64 272, !15, i64 280, !15, i64 288, !15, i64 296, !15, i64 304, !15, i64 312, !16, i64 320, !7, i64 440, !7, i64 448, !13, i64 456, !13, i64 460, !13, i64 464, !13, i64 468, !13, i64 472}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !11, i64 5, !11, i64 6, !11, i64 7, !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !11, i64 12, !11, i64 13, !11, i64 14, !11, i64 15, !11, i64 16, !11, i64 17, !11, i64 18, !11, i64 19, !11, i64 20, !11, i64 21, !11, i64 22, !11, i64 23, !11, i64 24, !11, i64 25}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"VarTypePtr_t", !7, i64 0, !7, i64 8, !7, i64 16, !11, i64 24, !13, i64 28, !13, i64 32}
!13 = !{!"int", !8, i64 0}
!14 = !{!"VarType_t", !7, i64 0, !7, i64 8, !15, i64 16, !11, i64 24, !11, i64 25, !13, i64 28, !13, i64 32}
!15 = !{!"double", !8, i64 0}
!16 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !7, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !7, i64 56, !17, i64 64}
!17 = !{!"list_attributes_s", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!18 = !{!6, !15, i64 216}
!19 = !{!6, !7, i64 0}
!20 = !{!21, !15, i64 16}
!21 = !{!"CableLibrary_t", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !7, i64 80}
!22 = !{!21, !15, i64 24}
!23 = !{!6, !15, i64 136}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass