; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/polygon (polygonImb)

; 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.Polygon = type { %class.VoidElem, i32, %"class.std::vector.16", ptr, ptr, i16, i8, double }
%class.VoidElem = type { %class.ElemModel, double, double, double, double }
%class.ElemModel = type { ptr, double, double, ptr, ptr, double, ptr, i8, i8, i8, i8, i32, double, double, double, double, double, double, double, %"struct.std::pair", %"struct.std::pair" }
%"struct.std::pair" = type { double, double }
%"class.std::vector.16" = type { %"struct.std::_Vector_base.17" }
%"struct.std::_Vector_base.17" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.CornerApex = type { %class.Apex, ptr, double, double, double, ptr }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, double }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.39 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7GNMData7sigmaOWEv(ptr noundef nonnull align 8 dereferenceable(984)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984)) #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

declare void @_ZN10CornerApex14initCornerApexEdddddb(ptr noundef nonnull align 8 dereferenceable(144), double noundef, double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext) #4

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

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

declare noundef double @_ZNK7Polygon22calcSnapOffPressureImbEv(ptr noundef nonnull align 8 dereferenceable(248)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Polygon36waterLayer_UntrappedCorner_PcLsnapPcEd(ptr noundef nonnull align 8 dereferenceable(248) %0, double noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  %9 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds %class.CornerApex, ptr %10, i64 0
  %12 = call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %11)
  br i1 %12, label %14, label %13

13:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %126

14:                                               ; preds = %2
  %15 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %class.CornerApex, ptr %16, i64 0
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %17)
  %19 = getelementptr inbounds %"struct.std::pair.0", ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !23
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %22, label %32

22:                                               ; preds = %14
  %23 = getelementptr inbounds %class.ElemModel, ptr %8, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !25
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatFilmEv(ptr noundef nonnull align 8 dereferenceable(408) %24)
  %26 = getelementptr inbounds %"struct.std::pair.0", ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !23
  %28 = icmp slt i32 %27, 0
  br i1 %28, label %29, label %32

29:                                               ; preds = %22
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.39)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %32

32:                                               ; preds = %29, %22, %14
  %33 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %class.CornerApex, ptr %34, i64 0
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %35)
  %37 = getelementptr inbounds %"struct.std::pair.0", ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !23
  %39 = icmp sgt i32 %38, -1
  br i1 %39, label %50, label %40

40:                                               ; preds = %32
  %41 = call noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152) %8)
  %42 = call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %41)
  br i1 %42, label %50, label %43

43:                                               ; preds = %40
  %44 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 4
  %45 = load ptr, ptr %44, align 8, !tbaa !26
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Apex10trappingCLEv(ptr noundef nonnull align 8 dereferenceable(104) %45)
  %47 = getelementptr inbounds %"struct.std::pair.0", ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !23
  %49 = icmp sgt i32 %48, -1
  br i1 %49, label %50, label %51

50:                                               ; preds = %43, %40, %32
  store i1 false, ptr %3, align 1
  br label %126

51:                                               ; preds = %43
  %52 = getelementptr inbounds %class.ElemModel, ptr %8, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  %54 = call noundef ptr @_ZNK10CommonData9injectantEv(ptr noundef nonnull align 8 dereferenceable(1972) %53)
  %55 = getelementptr inbounds %class.ElemModel, ptr %8, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !27
  %57 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984) %56)
  %58 = icmp eq ptr %54, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %51
  store i1 false, ptr %3, align 1
  br label %126

60:                                               ; preds = %51
  %61 = load ptr, ptr %8, align 8, !tbaa !28
  %62 = getelementptr inbounds ptr, ptr %61, i64 21
  %63 = load ptr, ptr %62, align 8
  %64 = call noundef zeroext i1 %63(ptr noundef nonnull align 8 dereferenceable(152) %8)
  br i1 %64, label %65, label %125

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !30
  br label %66

66:                                               ; preds = %117, %65
  %67 = load i32, ptr %6, align 4, !tbaa !30
  %68 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !31
  %70 = icmp slt i32 %67, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %120

72:                                               ; preds = %66
  %73 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = load i32, ptr %6, align 4, !tbaa !30
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds %class.CornerApex, ptr %74, i64 %76
  %78 = call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %77)
  br i1 %78, label %79, label %116

79:                                               ; preds = %72
  %80 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %81 = load ptr, ptr %80, align 8, !tbaa !11
  %82 = load i32, ptr %6, align 4, !tbaa !30
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds %class.CornerApex, ptr %81, i64 %83
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %84)
  %86 = getelementptr inbounds %"struct.std::pair.0", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 8, !tbaa !23
  %88 = icmp slt i32 %87, 0
  br i1 %88, label %89, label %116

89:                                               ; preds = %79
  %90 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %91 = load ptr, ptr %90, align 8, !tbaa !11
  %92 = load i32, ptr %6, align 4, !tbaa !30
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %class.CornerApex, ptr %91, i64 %93
  %95 = call noundef zeroext i1 @_ZNK4Apex6pinnedEv(ptr noundef nonnull align 8 dereferenceable(104) %94)
  br i1 %95, label %116, label %96

96:                                               ; preds = %89
  %97 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 3
  %98 = load ptr, ptr %97, align 8, !tbaa !11
  %99 = load i32, ptr %6, align 4, !tbaa !30
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %class.CornerApex, ptr %98, i64 %100
  %102 = load double, ptr %5, align 8, !tbaa !9
  %103 = getelementptr inbounds %class.VoidElem, ptr %8, i32 0, i32 4
  %104 = load double, ptr %103, align 8, !tbaa !32
  %105 = getelementptr inbounds %class.VoidElem, ptr %8, i32 0, i32 3
  %106 = load double, ptr %105, align 8, !tbaa !33
  %107 = getelementptr inbounds %class.Polygon, ptr %8, i32 0, i32 2
  %108 = load i32, ptr %6, align 4, !tbaa !30
  %109 = sext i32 %108 to i64
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %107, i64 noundef %109) #5
  %111 = load double, ptr %110, align 8, !tbaa !9
  %112 = getelementptr inbounds %class.ElemModel, ptr %8, i32 0, i32 4
  %113 = load ptr, ptr %112, align 8, !tbaa !27
  %114 = call noundef double @_ZNK7GNMData7sigmaOWEv(ptr noundef nonnull align 8 dereferenceable(984) %113)
  call void @_ZN10CornerApex14initCornerApexEdddddb(ptr noundef nonnull align 8 dereferenceable(144) %101, double noundef %102, double noundef %104, double noundef %106, double noundef %111, double noundef %114, i1 noundef zeroext false)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.40)
  br label %116

116:                                              ; preds = %96, %89, %79, %72
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %6, align 4, !tbaa !30
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %6, align 4, !tbaa !30
  br label %66, !llvm.loop !34

120:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %121 = call noundef double @_ZNK7Polygon22calcSnapOffPressureImbEv(ptr noundef nonnull align 8 dereferenceable(248) %8)
  store double %121, ptr %7, align 8, !tbaa !9
  %122 = load double, ptr %5, align 8, !tbaa !9
  %123 = load double, ptr %7, align 8, !tbaa !9
  %124 = fcmp olt double %122, %123
  store i1 %124, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %126

125:                                              ; preds = %60
  store i1 false, ptr %3, align 1
  br label %126

126:                                              ; preds = %125, %120, %59, %50, %13
  %127 = load i1, ptr %3, align 1
  ret i1 %127
}

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

; 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 zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408)) #2 align 2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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, !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, !6, i64 216}
!12 = !{!"_ZTS7Polygon", !13, i64 0, !16, i64 184, !18, i64 192, !6, i64 216, !6, i64 224, !22, i64 232, !7, i64 234, !10, i64 240}
!13 = !{!"_ZTS8VoidElem", !14, i64 0, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!14 = !{!"_ZTS9ElemModel", !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !15, i64 56, !15, i64 57, !15, i64 58, !15, i64 59, !16, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !17, i64 120, !17, i64 136}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSSt4pairIddE", !10, i64 0, !10, i64 8}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"short", !7, i64 0}
!23 = !{!24, !16, i64 0}
!24 = !{!"_ZTSSt4pairIidE", !16, i64 0, !10, i64 8}
!25 = !{!14, !6, i64 24}
!26 = !{!12, !6, i64 224}
!27 = !{!14, !6, i64 32}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, i64 0}
!30 = !{!16, !16, i64 0}
!31 = !{!12, !16, i64 184}
!32 = !{!13, !10, i64 176}
!33 = !{!13, !10, i64 168}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; 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 }
%class.CornerApex = type { %class.Apex, ptr, double, double, double, ptr }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, double }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.39 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7GNMData7sigmaOWEv(ptr noundef nonnull align 8 dereferenceable(984)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984)) 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

declare void @_ZN10CornerApex14initCornerApexEdddddb(ptr noundef nonnull align 8 dereferenceable(144), double noundef, double noundef, double noundef, double noundef, double noundef, i1 noundef zeroext) local_unnamed_addr #3

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

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

declare noundef double @_ZNK7Polygon22calcSnapOffPressureImbEv(ptr noundef nonnull align 8 dereferenceable(248)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Polygon36waterLayer_UntrappedCorner_PcLsnapPcEd(ptr noundef nonnull align 8 dereferenceable(248) %0, double noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 216
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %4)
  br i1 %5, label %6, label %82

6:                                                ; preds = %2
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %7)
  %9 = load i32, ptr %8, align 8, !tbaa !21
  %10 = icmp sgt i32 %9, -1
  br i1 %10, label %11, label %20

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !23
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Elem15trappingWatFilmEv(ptr noundef nonnull align 8 dereferenceable(408) %13)
  %15 = load i32, ptr %14, align 8, !tbaa !21
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %11
  %18 = 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.39)
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %20

20:                                               ; preds = %17, %11, %6
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %21)
  %23 = load i32, ptr %22, align 8, !tbaa !21
  %24 = icmp sgt i32 %23, -1
  br i1 %24, label %82, label %25

25:                                               ; preds = %20
  %26 = tail call noundef ptr @_ZNK9ElemModel6elemanEv(ptr noundef nonnull align 8 dereferenceable(152) %0)
  %27 = tail call noundef zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408) %26)
  br i1 %27, label %82, label %28

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %0, i64 224
  %30 = load ptr, ptr %29, align 8, !tbaa !24
  %31 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK4Apex10trappingCLEv(ptr noundef nonnull align 8 dereferenceable(104) %30)
  %32 = load i32, ptr %31, align 8, !tbaa !21
  %33 = icmp sgt i32 %32, -1
  br i1 %33, label %82, label %34

34:                                               ; preds = %28
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  %36 = load ptr, ptr %35, align 8, !tbaa !25
  %37 = tail call noundef ptr @_ZNK10CommonData9injectantEv(ptr noundef nonnull align 8 dereferenceable(1972) %36)
  %38 = load ptr, ptr %35, align 8, !tbaa !25
  %39 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK7GNMData3oilEv(ptr noundef nonnull align 8 dereferenceable(984) %38)
  %40 = icmp eq ptr %37, %39
  br i1 %40, label %82, label %41

41:                                               ; preds = %34
  %42 = load ptr, ptr %0, align 8, !tbaa !26
  %43 = getelementptr inbounds i8, ptr %42, i64 168
  %44 = load ptr, ptr %43, align 8
  %45 = tail call noundef zeroext i1 %44(ptr noundef nonnull align 8 dereferenceable(152) %0)
  br i1 %45, label %.preheader, label %82

.preheader:                                       ; preds = %41
  %46 = getelementptr inbounds i8, ptr %0, i64 184
  %47 = load i32, ptr %46, align 8, !tbaa !28
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %49 = getelementptr inbounds i8, ptr %0, i64 176
  %50 = getelementptr inbounds i8, ptr %0, i64 168
  %51 = getelementptr inbounds i8, ptr %0, i64 192
  br label %54

._crit_edge:                                      ; preds = %78, %.preheader
  %52 = tail call noundef double @_ZNK7Polygon22calcSnapOffPressureImbEv(ptr noundef nonnull align 8 dereferenceable(248) %0)
  %53 = fcmp ogt double %52, %1
  br label %82

54:                                               ; preds = %.lr.ph, %78
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %78 ]
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.CornerApex, ptr %55, i64 %indvars.iv
  %57 = tail call noundef zeroext i1 @_ZNK10CornerApex12cornerExistsEv(ptr noundef nonnull align 8 dereferenceable(144) %56)
  br i1 %57, label %58, label %78

58:                                               ; preds = %54
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.CornerApex, ptr %59, i64 %indvars.iv
  %61 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK10CornerApex13trappedCornerEv(ptr noundef nonnull align 8 dereferenceable(144) %60)
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = icmp slt i32 %62, 0
  br i1 %63, label %64, label %78

64:                                               ; preds = %58
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.CornerApex, ptr %65, i64 %indvars.iv
  %67 = tail call noundef zeroext i1 @_ZNK4Apex6pinnedEv(ptr noundef nonnull align 8 dereferenceable(104) %66)
  br i1 %67, label %78, label %68

68:                                               ; preds = %64
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %class.CornerApex, ptr %69, i64 %indvars.iv
  %71 = load double, ptr %49, align 8, !tbaa !29
  %72 = load double, ptr %50, align 8, !tbaa !30
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %indvars.iv) #4
  %74 = load double, ptr %73, align 8, !tbaa !31
  %75 = load ptr, ptr %35, align 8, !tbaa !25
  %76 = tail call noundef double @_ZNK7GNMData7sigmaOWEv(ptr noundef nonnull align 8 dereferenceable(984) %75)
  tail call void @_ZN10CornerApex14initCornerApexEdddddb(ptr noundef nonnull align 8 dereferenceable(144) %70, double noundef %1, double noundef %71, double noundef %72, double noundef %74, double noundef %76, i1 noundef zeroext false)
  %77 = 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.40)
  br label %78

78:                                               ; preds = %54, %58, %64, %68
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %79 = load i32, ptr %46, align 8, !tbaa !28
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next, %80
  br i1 %81, label %54, label %._crit_edge, !llvm.loop !32

82:                                               ; preds = %41, %34, %20, %25, %28, %2, %._crit_edge
  %.0 = phi i1 [ %53, %._crit_edge ], [ false, %2 ], [ false, %28 ], [ false, %25 ], [ false, %20 ], [ false, %34 ], [ false, %41 ]
  ret i1 %.0
}

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

; 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 zeroext i1 @_ZNK4Elem12isTrappedOilEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #1 align 2

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

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

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

attributes #0 = { 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 #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 = { "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, !12, i64 216}
!6 = !{!"_ZTS7Polygon", !7, i64 0, !14, i64 184, !16, i64 192, !12, i64 216, !12, i64 224, !20, i64 232, !10, i64 234, !9, i64 240}
!7 = !{!"_ZTS8VoidElem", !8, i64 0, !9, i64 152, !9, i64 160, !9, i64 168, !9, i64 176}
!8 = !{!"_ZTS9ElemModel", !9, i64 8, !9, i64 16, !12, i64 24, !12, i64 32, !9, i64 40, !12, i64 48, !13, i64 56, !13, i64 57, !13, i64 58, !13, i64 59, !14, i64 60, !9, i64 64, !9, i64 72, !9, i64 80, !9, i64 88, !9, i64 96, !9, i64 104, !9, i64 112, !15, i64 120, !15, i64 136}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"bool", !10, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = !{!"_ZTSSt4pairIddE", !9, i64 0, !9, i64 8}
!16 = !{!"_ZTSSt6vectorIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!20 = !{!"short", !10, i64 0}
!21 = !{!22, !14, i64 0}
!22 = !{!"_ZTSSt4pairIidE", !14, i64 0, !9, i64 8}
!23 = !{!8, !12, i64 24}
!24 = !{!6, !12, i64 224}
!25 = !{!8, !12, i64 32}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !11, i64 0}
!28 = !{!6, !14, i64 184}
!29 = !{!7, !9, i64 176}
!30 = !{!7, !9, i64 168}
!31 = !{!9, !9, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass