; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/polygon/layerApex.ll (ZN9LayerApex13initLayerApexEdddddbb)

; 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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair" }
%"struct.std::pair" = type { i32, double }
%class.LayerApex = type { %class.Apex, i32, ptr, double, ptr, double }

@_ZN4Apex2PIE = external constant double, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = 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: nounwind
declare double @sin(double noundef) #1

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

; Function Attrs: nounwind
declare double @cos(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10CornerApex14pinnedApexDistEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144), double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext) #4 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9LayerApex13initLayerApexEdddddbb(ptr noundef nonnull align 8 dereferenceable(144) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, i1 noundef zeroext %6, i1 noundef zeroext %7) #4 align 2 {
  %9 = alloca i1, align 1
  %10 = alloca ptr, 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 i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  %19 = alloca double, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store double %1, ptr %11, align 8, !tbaa !9
  store double %2, ptr %12, align 8, !tbaa !9
  store double %3, ptr %13, align 8, !tbaa !9
  store double %4, ptr %14, align 8, !tbaa !9
  store double %5, ptr %15, align 8, !tbaa !9
  %20 = zext i1 %6 to i8
  store i8 %20, ptr %16, align 1, !tbaa !11
  %21 = zext i1 %7 to i8
  store i8 %21, ptr %17, align 1, !tbaa !11
  %22 = load ptr, ptr %10, align 8
  %23 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %24 = trunc i8 %23 to i1
  br i1 %24, label %27, label %25

25:                                               ; preds = %8
  %26 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %22)
  br i1 %26, label %27, label %40

27:                                               ; preds = %25, %8
  %28 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 14
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !15
  %31 = icmp sgt i32 %30, -1
  br i1 %31, label %40, label %32

32:                                               ; preds = %27
  %33 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  %35 = call noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152) %34)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408) %35)
  %37 = getelementptr inbounds %"struct.std::pair", ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !21
  %39 = icmp sgt i32 %38, -1
  br i1 %39, label %40, label %41

40:                                               ; preds = %32, %27, %25
  store i1 true, ptr %9, align 1
  br label %166

41:                                               ; preds = %32
  %42 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %102

44:                                               ; preds = %41
  %45 = call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %22)
  br i1 %45, label %102, label %46

46:                                               ; preds = %44
  %47 = load double, ptr %12, align 8, !tbaa !9
  %48 = load double, ptr @_ZN4Apex2PIE, align 8, !tbaa !9
  %49 = fdiv double %48, 2.000000e+00
  %50 = load double, ptr %14, align 8, !tbaa !9
  %51 = fadd double %49, %50
  %52 = fcmp ole double %47, %51
  br i1 %52, label %57, label %53

53:                                               ; preds = %46
  %54 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %55 = load double, ptr %54, align 8, !tbaa !22
  %56 = fcmp ole double %55, 0.000000e+00
  br i1 %56, label %57, label %58

57:                                               ; preds = %53, %46
  store i1 true, ptr %9, align 1
  br label %166

58:                                               ; preds = %53
  %59 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 13
  store i8 1, ptr %59, align 1, !tbaa !23
  %60 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = call noundef double @_ZNK9ElemModel3RRREv(ptr noundef nonnull align 8 dereferenceable(152) %61)
  %63 = load double, ptr %14, align 8, !tbaa !9
  %64 = call double @tan(double noundef %63) #6
  %65 = fdiv double %62, %64
  %66 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  store double %65, ptr %66, align 8, !tbaa !22
  %67 = load double, ptr %15, align 8, !tbaa !9
  %68 = load double, ptr %13, align 8, !tbaa !9
  %69 = load double, ptr %14, align 8, !tbaa !9
  %70 = fsub double %68, %69
  %71 = call double @cos(double noundef %70) #6
  %72 = fmul double %67, %71
  %73 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %74 = load double, ptr %73, align 8, !tbaa !22
  %75 = load double, ptr %14, align 8, !tbaa !9
  %76 = call double @sin(double noundef %75) #6
  %77 = fmul double %74, %76
  %78 = fdiv double %72, %77
  %79 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 6
  store double %78, ptr %79, align 8, !tbaa !24
  %80 = load double, ptr %15, align 8, !tbaa !9
  %81 = load double, ptr %12, align 8, !tbaa !9
  %82 = load double, ptr %14, align 8, !tbaa !9
  %83 = fsub double %81, %82
  %84 = call double @cos(double noundef %83) #6
  %85 = fmul double %80, %84
  %86 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %87 = load double, ptr %86, align 8, !tbaa !22
  %88 = load double, ptr %14, align 8, !tbaa !9
  %89 = call double @sin(double noundef %88) #6
  %90 = fmul double %87, %89
  %91 = fdiv double %85, %90
  %92 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 7
  store double %91, ptr %92, align 8, !tbaa !25
  %93 = load double, ptr %11, align 8, !tbaa !9
  %94 = load double, ptr %12, align 8, !tbaa !9
  %95 = load double, ptr %14, align 8, !tbaa !9
  %96 = load double, ptr %15, align 8, !tbaa !9
  %97 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %98 = trunc i8 %97 to i1
  %99 = call noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144) %22, double noundef %93, double noundef %94, double noundef %95, double noundef %96, i1 noundef zeroext %98)
  %100 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 8
  store double %99, ptr %100, align 8, !tbaa !26
  %101 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 13
  store i8 0, ptr %101, align 1, !tbaa !23
  store i1 true, ptr %9, align 1
  br label %166

102:                                              ; preds = %44, %41
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #6
  store i8 1, ptr %18, align 1, !tbaa !11
  %103 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %104 = load double, ptr %103, align 8, !tbaa !22
  %105 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 4
  %106 = load ptr, ptr %105, align 8, !tbaa !27
  %107 = call noundef double @_ZNK10CornerApex14pinnedApexDistEv(ptr noundef nonnull align 8 dereferenceable(144) %106)
  %108 = fcmp olt double %104, %107
  br i1 %108, label %109, label %112

109:                                              ; preds = %102
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.17)
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  store i8 0, ptr %18, align 1, !tbaa !11
  br label %112

112:                                              ; preds = %109, %102
  %113 = load double, ptr %15, align 8, !tbaa !9
  %114 = load double, ptr %13, align 8, !tbaa !9
  %115 = load double, ptr %14, align 8, !tbaa !9
  %116 = fsub double %114, %115
  %117 = call double @cos(double noundef %116) #6
  %118 = fmul double %113, %117
  %119 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %120 = load double, ptr %119, align 8, !tbaa !22
  %121 = load double, ptr %14, align 8, !tbaa !9
  %122 = call double @sin(double noundef %121) #6
  %123 = fmul double %120, %122
  %124 = fdiv double %118, %123
  %125 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 6
  store double %124, ptr %125, align 8, !tbaa !24
  %126 = load double, ptr %15, align 8, !tbaa !9
  %127 = load double, ptr %12, align 8, !tbaa !9
  %128 = load double, ptr %14, align 8, !tbaa !9
  %129 = fsub double %127, %128
  %130 = call double @cos(double noundef %129) #6
  %131 = fmul double %126, %130
  %132 = getelementptr inbounds %class.LayerApex, ptr %22, i32 0, i32 3
  %133 = load double, ptr %132, align 8, !tbaa !22
  %134 = load double, ptr %14, align 8, !tbaa !9
  %135 = call double @sin(double noundef %134) #6
  %136 = fmul double %133, %135
  %137 = fdiv double %131, %136
  %138 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 7
  store double %137, ptr %138, align 8, !tbaa !25
  %139 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 13
  store i8 1, ptr %139, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %140 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %141 = trunc i8 %140 to i1
  br i1 %141, label %142, label %144

142:                                              ; preds = %112
  %143 = load double, ptr %12, align 8, !tbaa !9
  br label %146

144:                                              ; preds = %112
  %145 = load double, ptr %13, align 8, !tbaa !9
  br label %146

146:                                              ; preds = %144, %142
  %147 = phi double [ %143, %142 ], [ %145, %144 ]
  store double %147, ptr %19, align 8, !tbaa !9
  %148 = load double, ptr %11, align 8, !tbaa !9
  %149 = load double, ptr %19, align 8, !tbaa !9
  %150 = load double, ptr %14, align 8, !tbaa !9
  %151 = load double, ptr %15, align 8, !tbaa !9
  %152 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %153 = trunc i8 %152 to i1
  %154 = call noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144) %22, double noundef %148, double noundef %149, double noundef %150, double noundef %151, i1 noundef zeroext %153)
  %155 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 8
  store double %154, ptr %155, align 8, !tbaa !26
  %156 = load double, ptr %11, align 8, !tbaa !9
  %157 = getelementptr inbounds %class.Apex, ptr %22, i32 0, i32 8
  %158 = load double, ptr %157, align 8, !tbaa !26
  %159 = fcmp olt double %156, %158
  br i1 %159, label %160, label %163

160:                                              ; preds = %146
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.18)
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  store i8 0, ptr %18, align 1, !tbaa !11
  br label %163

163:                                              ; preds = %160, %146
  %164 = load i8, ptr %18, align 1, !tbaa !11, !range !13, !noundef !14
  %165 = trunc i8 %164 to i1
  store i1 %165, ptr %9, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  br label %166

166:                                              ; preds = %163, %58, %57, %40
  %167 = load i1, ptr %9, align 1
  ret i1 %167
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK9ElemModel3RRREv(ptr noundef nonnull align 8 dereferenceable(152)) #2 align 2

; Function Attrs: nounwind
declare double @tan(double noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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 #5 = { "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 #6 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !17, i64 88}
!16 = !{!"_ZTS4Apex", !12, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !17, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !12, i64 80, !12, i64 81, !12, i64 82, !12, i64 83, !18, i64 88}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSSt4pairIidE", !17, i64 0, !10, i64 8}
!19 = !{!20, !6, i64 112}
!20 = !{!"_ZTS9LayerApex", !16, i64 0, !17, i64 104, !6, i64 112, !10, i64 120, !6, i64 128, !10, i64 136}
!21 = !{!18, !17, i64 0}
!22 = !{!20, !10, i64 120}
!23 = !{!16, !12, i64 83}
!24 = !{!16, !10, i64 48}
!25 = !{!16, !10, i64 56}
!26 = !{!16, !10, i64 64}
!27 = !{!20, !6, i64 128}


; 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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZN4Apex2PIE = external local_unnamed_addr constant double, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10CornerApex14pinnedApexDistEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144), double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext) local_unnamed_addr #3 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9LayerApex13initLayerApexEdddddbb(ptr noundef nonnull align 8 dereferenceable(144) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, i1 noundef zeroext %6, i1 noundef zeroext %7) local_unnamed_addr #3 align 2 {
  br i1 %6, label %14, label %9

9:                                                ; preds = %8
  %10 = tail call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = load i32, ptr %11, align 8
  %13 = icmp slt i32 %12, 0
  %or.cond.not = select i1 %10, i1 %13, i1 false
  br i1 %or.cond.not, label %15, label %93

14:                                               ; preds = %8
  %.old = getelementptr inbounds i8, ptr %0, i64 88
  %.old40 = load i32, ptr %.old, align 8, !tbaa !5
  %.old41 = icmp sgt i32 %.old40, -1
  br i1 %.old41, label %93, label %15

15:                                               ; preds = %9, %14
  %16 = getelementptr inbounds i8, ptr %0, i64 112
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = tail call noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152) %17)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatBulkEv(ptr noundef nonnull align 8 dereferenceable(408) %18)
  %20 = load i32, ptr %19, align 8, !tbaa !16
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %93, label %22

22:                                               ; preds = %15
  br i1 %6, label %23, label %58

23:                                               ; preds = %22
  %24 = tail call noundef zeroext i1 @_ZNK4Apex6existsEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  br i1 %24, label %58, label %25

25:                                               ; preds = %23
  %26 = load double, ptr @_ZN4Apex2PIE, align 8, !tbaa !17
  %27 = fmul double %26, 5.000000e-01
  %28 = fadd double %27, %4
  %29 = fcmp ult double %28, %2
  br i1 %29, label %30, label %93

30:                                               ; preds = %25
  %31 = getelementptr inbounds i8, ptr %0, i64 120
  %32 = load double, ptr %31, align 8, !tbaa !18
  %33 = fcmp ugt double %32, 0.000000e+00
  br i1 %33, label %34, label %93

34:                                               ; preds = %30
  %35 = getelementptr inbounds i8, ptr %0, i64 83
  store i8 1, ptr %35, align 1, !tbaa !19
  %36 = load ptr, ptr %16, align 8, !tbaa !14
  %37 = tail call noundef double @_ZNK9ElemModel3RRREv(ptr noundef nonnull align 8 dereferenceable(152) %36)
  %38 = tail call double @tan(double noundef %4) #5
  %39 = fdiv double %37, %38
  store double %39, ptr %31, align 8, !tbaa !18
  %40 = fsub double %3, %4
  %41 = tail call double @cos(double noundef %40) #5
  %42 = fmul double %41, %5
  %43 = load double, ptr %31, align 8, !tbaa !18
  %44 = tail call double @sin(double noundef %4) #5
  %45 = fmul double %43, %44
  %46 = fdiv double %42, %45
  %47 = getelementptr inbounds i8, ptr %0, i64 48
  store double %46, ptr %47, align 8, !tbaa !20
  %48 = fsub double %2, %4
  %49 = tail call double @cos(double noundef %48) #5
  %50 = fmul double %49, %5
  %51 = load double, ptr %31, align 8, !tbaa !18
  %52 = tail call double @sin(double noundef %4) #5
  %53 = fmul double %51, %52
  %54 = fdiv double %50, %53
  %55 = getelementptr inbounds i8, ptr %0, i64 56
  store double %54, ptr %55, align 8, !tbaa !21
  %56 = tail call noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144) %0, double noundef %1, double noundef %2, double noundef %4, double noundef %5, i1 noundef zeroext true)
  %57 = getelementptr inbounds i8, ptr %0, i64 64
  store double %56, ptr %57, align 8, !tbaa !22
  store i8 0, ptr %35, align 1, !tbaa !19
  br label %93

58:                                               ; preds = %23, %22
  %59 = getelementptr inbounds i8, ptr %0, i64 120
  %60 = load double, ptr %59, align 8, !tbaa !18
  %61 = getelementptr inbounds i8, ptr %0, i64 128
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = tail call noundef double @_ZNK10CornerApex14pinnedApexDistEv(ptr noundef nonnull align 8 dereferenceable(144) %62)
  %64 = fcmp uge double %60, %63
  br i1 %64, label %68, label %65

65:                                               ; preds = %58
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.17)
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  br label %68

68:                                               ; preds = %65, %58
  %69 = fsub double %3, %4
  %70 = tail call double @cos(double noundef %69) #5
  %71 = fmul double %70, %5
  %72 = load double, ptr %59, align 8, !tbaa !18
  %73 = tail call double @sin(double noundef %4) #5
  %74 = fmul double %72, %73
  %75 = fdiv double %71, %74
  %76 = getelementptr inbounds i8, ptr %0, i64 48
  store double %75, ptr %76, align 8, !tbaa !20
  %77 = fsub double %2, %4
  %78 = tail call double @cos(double noundef %77) #5
  %79 = fmul double %78, %5
  %80 = load double, ptr %59, align 8, !tbaa !18
  %81 = tail call double @sin(double noundef %4) #5
  %82 = fmul double %80, %81
  %83 = fdiv double %79, %82
  %84 = getelementptr inbounds i8, ptr %0, i64 56
  store double %83, ptr %84, align 8, !tbaa !21
  %85 = getelementptr inbounds i8, ptr %0, i64 83
  store i8 1, ptr %85, align 1, !tbaa !19
  %86 = select i1 %6, double %2, double %3
  %87 = tail call noundef double @_ZNK9LayerApex15layerCollapsePcEddddb(ptr noundef nonnull align 8 dereferenceable(144) %0, double noundef %1, double noundef %86, double noundef %4, double noundef %5, i1 noundef zeroext %6)
  %88 = getelementptr inbounds i8, ptr %0, i64 64
  store double %87, ptr %88, align 8, !tbaa !22
  %89 = fcmp ogt double %87, %1
  br i1 %89, label %90, label %93

90:                                               ; preds = %68
  %91 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.18)
  %92 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  br label %93

93:                                               ; preds = %68, %90, %25, %30, %9, %14, %15, %34
  %.0 = phi i1 [ true, %34 ], [ true, %15 ], [ true, %14 ], [ true, %9 ], [ true, %30 ], [ true, %25 ], [ false, %90 ], [ %64, %68 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK9ElemModel3RRREv(ptr noundef nonnull align 8 dereferenceable(152)) local_unnamed_addr #1 align 2

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

attributes #0 = { 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 #1 = { mustprogress 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 #2 = { inlinehint mustprogress 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 = { mustprogress 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 = { "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 #5 = { 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, !12, i64 88}
!6 = !{!"_ZTS4Apex", !7, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !12, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !7, i64 80, !7, i64 81, !7, i64 82, !7, i64 83, !13, i64 88}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSSt4pairIidE", !12, i64 0, !10, i64 8}
!14 = !{!15, !11, i64 112}
!15 = !{!"_ZTS9LayerApex", !6, i64 0, !12, i64 104, !11, i64 112, !10, i64 120, !11, i64 128, !10, i64 136}
!16 = !{!13, !12, i64 0}
!17 = !{!10, !10, i64 0}
!18 = !{!15, !10, i64 120}
!19 = !{!6, !7, i64 83}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !10, i64 56}
!22 = !{!6, !10, i64 64}
!23 = !{!15, !11, i64 128}


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