; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/polygonizer3d.ll (ZN13Polygonizer3d17_findSurfaceCellsER15GridIndexVector)

; 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.GridIndex = type { i32, i32, i32 }
%class.Polygonizer3d = type <{ i32, i32, i32, [4 x i8], double, double, ptr, i8, [7 x i8], ptr, i8, [7 x i8] }>

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN13Polygonizer3d16_isCellOnSurfaceE9GridIndex(ptr noundef nonnull align 8 dereferenceable(57), i64, i32) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Polygonizer3d17_findSurfaceCellsER15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(57) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.GridIndex, align 4
  %14 = alloca %struct.GridIndex, align 4
  %15 = alloca { i64, i32 }, align 4
  %16 = alloca %struct.GridIndex, align 4
  %17 = alloca { i64, i32 }, align 4
  %18 = alloca %struct.GridIndex, align 4
  %19 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  store i8 1, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %68, %2
  %22 = load i32, ptr %6, align 4, !tbaa !11
  %23 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 2
  %24 = load i32, ptr %23, align 8, !tbaa !13
  %25 = add nsw i32 %24, 1
  %26 = icmp slt i32 %22, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %21
  store i32 2, ptr %7, align 4
  br label %71

28:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %62, %28
  %30 = load i32, ptr %8, align 4, !tbaa !11
  %31 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !16
  %33 = add nsw i32 %32, 1
  %34 = icmp slt i32 %30, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %29
  store i32 5, ptr %7, align 4
  br label %65

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %37

37:                                               ; preds = %56, %36
  %38 = load i32, ptr %9, align 4, !tbaa !11
  %39 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 0
  %40 = load i32, ptr %39, align 8, !tbaa !17
  %41 = add nsw i32 %40, 1
  %42 = icmp slt i32 %38, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %37
  store i32 8, ptr %7, align 4
  br label %59

44:                                               ; preds = %37
  %45 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = load i32, ptr %9, align 4, !tbaa !11
  %48 = load i32, ptr %8, align 4, !tbaa !11
  %49 = load i32, ptr %6, align 4, !tbaa !11
  %50 = call noundef double @_ZN11ScalarField19getScalarFieldValueEiii(ptr noundef nonnull align 8 dereferenceable(248) %46, i32 noundef %47, i32 noundef %48, i32 noundef %49)
  %51 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 5
  %52 = load double, ptr %51, align 8, !tbaa !19
  %53 = fcmp ogt double %50, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %44
  store i8 0, ptr %5, align 1, !tbaa !9
  store i32 11, ptr %7, align 4
  br label %59

55:                                               ; preds = %44
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %9, align 4, !tbaa !11
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %9, align 4, !tbaa !11
  br label %37, !llvm.loop !20

59:                                               ; preds = %54, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %60 = load i32, ptr %7, align 4
  switch i32 %60, label %65 [
    i32 8, label %61
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %8, align 4, !tbaa !11
  br label %29, !llvm.loop !22

65:                                               ; preds = %59, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %66 = load i32, ptr %7, align 4
  switch i32 %66, label %71 [
    i32 5, label %67
  ]

67:                                               ; preds = %65
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %6, align 4, !tbaa !11
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %6, align 4, !tbaa !11
  br label %21, !llvm.loop !23

71:                                               ; preds = %65, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %72 = load i32, ptr %7, align 4
  switch i32 %72, label %143 [
    i32 2, label %73
    i32 11, label %74
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73, %71
  %75 = load i8, ptr %5, align 1, !tbaa !9, !range !24, !noundef !25
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store i32 1, ptr %7, align 4
  br label %143

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %79

79:                                               ; preds = %139, %78
  %80 = load i32, ptr %10, align 4, !tbaa !11
  %81 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 2
  %82 = load i32, ptr %81, align 8, !tbaa !13
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %79
  store i32 12, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %142

85:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %86

86:                                               ; preds = %135, %85
  %87 = load i32, ptr %11, align 4, !tbaa !11
  %88 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !16
  %90 = icmp slt i32 %87, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %86
  store i32 15, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %138

92:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %93

93:                                               ; preds = %131, %92
  %94 = load i32, ptr %12, align 4, !tbaa !11
  %95 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 0
  %96 = load i32, ptr %95, align 8, !tbaa !17
  %97 = icmp slt i32 %94, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %93
  store i32 18, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %134

99:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #6
  %100 = load i32, ptr %12, align 4, !tbaa !11
  %101 = load i32, ptr %11, align 4, !tbaa !11
  %102 = load i32, ptr %10, align 4, !tbaa !11
  call void @_ZN9GridIndexC2Eiii(ptr noundef nonnull align 4 dereferenceable(12) %13, i32 noundef %100, i32 noundef %101, i32 noundef %102)
  %103 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 10
  %104 = load i8, ptr %103, align 8, !tbaa !26, !range !24, !noundef !25
  %105 = trunc i8 %104 to i1
  br i1 %105, label %106, label %115

106:                                              ; preds = %99
  %107 = getelementptr inbounds %class.Polygonizer3d, ptr %20, i32 0, i32 9
  %108 = load ptr, ptr %107, align 8, !tbaa !27
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !28
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %14, i64 12, i1 false)
  %109 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 0
  %110 = load i64, ptr %109, align 4
  %111 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 1
  %112 = load i32, ptr %111, align 4
  %113 = call noundef zeroext i1 @_ZN7Array3dIbE3getE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 %110, i32 %112)
  br i1 %113, label %115, label %114

114:                                              ; preds = %106
  store i32 20, ptr %7, align 4
  br label %128

115:                                              ; preds = %106, %99
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !28
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %16, i64 12, i1 false)
  %116 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 0
  %117 = load i64, ptr %116, align 4
  %118 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 1
  %119 = load i32, ptr %118, align 4
  %120 = call noundef zeroext i1 @_ZN13Polygonizer3d16_isCellOnSurfaceE9GridIndex(ptr noundef nonnull align 8 dereferenceable(57) %20, i64 %117, i32 %119)
  br i1 %120, label %121, label %127

121:                                              ; preds = %115
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !28
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %18, i64 12, i1 false)
  %123 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 0
  %124 = load i64, ptr %123, align 4
  %125 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 1
  %126 = load i32, ptr %125, align 4
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %122, i64 %124, i32 %126)
  br label %127

127:                                              ; preds = %121, %115
  store i32 0, ptr %7, align 4
  br label %128

128:                                              ; preds = %127, %114
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #6
  %129 = load i32, ptr %7, align 4
  switch i32 %129, label %146 [
    i32 0, label %130
    i32 20, label %131
  ]

130:                                              ; preds = %128
  br label %131

131:                                              ; preds = %130, %128
  %132 = load i32, ptr %12, align 4, !tbaa !11
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %12, align 4, !tbaa !11
  br label %93, !llvm.loop !29

134:                                              ; preds = %98
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %11, align 4, !tbaa !11
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !11
  br label %86, !llvm.loop !30

138:                                              ; preds = %91
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %10, align 4, !tbaa !11
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %10, align 4, !tbaa !11
  br label %79, !llvm.loop !31

142:                                              ; preds = %84
  store i32 0, ptr %7, align 4
  br label %143

143:                                              ; preds = %142, %77, %71
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  %144 = load i32, ptr %7, align 4
  switch i32 %144, label %146 [
    i32 0, label %145
    i32 1, label %145
  ]

145:                                              ; preds = %143, %143
  ret void

146:                                              ; preds = %143, %128
  unreachable
}

declare noundef double @_ZN11ScalarField19getScalarFieldValueEiii(ptr noundef nonnull align 8 dereferenceable(248), i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Eiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIbE3getE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32), i64, i32) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40), i64, i32) #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #5 = { 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 #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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTS13Polygonizer3d", !12, i64 0, !12, i64 4, !12, i64 8, !15, i64 16, !15, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !10, i64 56}
!15 = !{!"double", !7, i64 0}
!16 = !{!14, !12, i64 4}
!17 = !{!14, !12, i64 0}
!18 = !{!14, !6, i64 32}
!19 = !{!14, !15, i64 24}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!14, !10, i64 56}
!27 = !{!14, !6, i64 48}
!28 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11}
!29 = distinct !{!29, !21}
!30 = distinct !{!30, !21}
!31 = distinct !{!31, !21}


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

%struct.GridIndex = type { i32, i32, i32 }

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

; Function Attrs: mustprogress 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 zeroext i1 @_ZN13Polygonizer3d16_isCellOnSurfaceE9GridIndex(ptr noundef nonnull align 8 dereferenceable(57), i64, i32) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Polygonizer3d17_findSurfaceCellsER15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(57) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %struct.GridIndex, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %.not64 = icmp slt i32 %5, 0
  br i1 %.not64, label %.critedge, label %.preheader56.lr.ph

.preheader56.lr.ph:                               ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load i32, ptr %6, align 4, !tbaa !13
  %10 = icmp slt i32 %9, 0
  br i1 %10, label %.critedge, label %.preheader56

.preheader56:                                     ; preds = %.preheader56.lr.ph, %._crit_edge63
  %11 = phi i32 [ %28, %._crit_edge63 ], [ %5, %.preheader56.lr.ph ]
  %12 = phi i32 [ %29, %._crit_edge63 ], [ %9, %.preheader56.lr.ph ]
  %13 = phi i32 [ %30, %._crit_edge63 ], [ %9, %.preheader56.lr.ph ]
  %.03465 = phi i32 [ %31, %._crit_edge63 ], [ 0, %.preheader56.lr.ph ]
  %.not4361 = icmp slt i32 %13, 0
  %14 = load i32, ptr %0, align 8
  %15 = icmp slt i32 %14, 0
  %or.cond = select i1 %.not4361, i1 true, i1 %15
  br i1 %or.cond, label %._crit_edge63, label %.preheader55

.preheader55:                                     ; preds = %.preheader56, %._crit_edge
  %16 = phi i32 [ %25, %._crit_edge ], [ %12, %.preheader56 ]
  %17 = phi i32 [ %26, %._crit_edge ], [ %14, %.preheader56 ]
  %.03862 = phi i32 [ %27, %._crit_edge ], [ 0, %.preheader56 ]
  %.not4459 = icmp slt i32 %17, 0
  br i1 %.not4459, label %._crit_edge, label %.lr.ph

18:                                               ; preds = %.lr.ph
  %19 = add nuw nsw i32 %.03960, 1
  %20 = load i32, ptr %0, align 8, !tbaa !14
  %.not44.not = icmp slt i32 %.03960, %20
  br i1 %.not44.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !15

.lr.ph:                                           ; preds = %.preheader55, %18
  %.03960 = phi i32 [ %19, %18 ], [ 0, %.preheader55 ]
  %21 = load ptr, ptr %7, align 8, !tbaa !17
  %22 = tail call noundef double @_ZN11ScalarField19getScalarFieldValueEiii(ptr noundef nonnull align 8 dereferenceable(248) %21, i32 noundef %.03960, i32 noundef %.03862, i32 noundef %.03465)
  %23 = load double, ptr %8, align 8, !tbaa !18
  %24 = fcmp ogt double %22, %23
  br i1 %24, label %.preheader54, label %18

._crit_edge.loopexit:                             ; preds = %18
  %.pre80 = load i32, ptr %6, align 4, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader55
  %25 = phi i32 [ %.pre80, %._crit_edge.loopexit ], [ %16, %.preheader55 ]
  %26 = phi i32 [ %20, %._crit_edge.loopexit ], [ %17, %.preheader55 ]
  %27 = add nuw nsw i32 %.03862, 1
  %.not43.not = icmp slt i32 %.03862, %25
  br i1 %.not43.not, label %.preheader55, label %._crit_edge63.loopexit77, !llvm.loop !19

._crit_edge63.loopexit77:                         ; preds = %._crit_edge
  %.pre81 = load i32, ptr %4, align 8, !tbaa !5
  br label %._crit_edge63

._crit_edge63:                                    ; preds = %._crit_edge63.loopexit77, %.preheader56
  %28 = phi i32 [ %.pre81, %._crit_edge63.loopexit77 ], [ %11, %.preheader56 ]
  %29 = phi i32 [ %25, %._crit_edge63.loopexit77 ], [ %12, %.preheader56 ]
  %30 = phi i32 [ %25, %._crit_edge63.loopexit77 ], [ %13, %.preheader56 ]
  %31 = add nuw nsw i32 %.03465, 1
  %.not.not = icmp slt i32 %.03465, %28
  br i1 %.not.not, label %.preheader56, label %.critedge, !llvm.loop !21

.preheader54:                                     ; preds = %.lr.ph
  %32 = load i32, ptr %4, align 8, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.preheader53.lr.ph, label %.critedge

.preheader53.lr.ph:                               ; preds = %.preheader54
  %34 = getelementptr inbounds i8, ptr %0, i64 56
  %35 = getelementptr inbounds i8, ptr %0, i64 48
  %.sroa.211.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %36 = load i32, ptr %6, align 4, !tbaa !13
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.preheader53, label %.critedge

.preheader53:                                     ; preds = %.preheader53.lr.ph, %._crit_edge71
  %38 = phi i32 [ %47, %._crit_edge71 ], [ %32, %.preheader53.lr.ph ]
  %39 = phi i32 [ %48, %._crit_edge71 ], [ %36, %.preheader53.lr.ph ]
  %40 = phi i32 [ %49, %._crit_edge71 ], [ %36, %.preheader53.lr.ph ]
  %.04072 = phi i32 [ %50, %._crit_edge71 ], [ 0, %.preheader53.lr.ph ]
  %41 = icmp sgt i32 %40, 0
  %42 = load i32, ptr %0, align 8
  %43 = icmp sgt i32 %42, 0
  %or.cond88 = select i1 %41, i1 %43, i1 false
  br i1 %or.cond88, label %.preheader, label %._crit_edge71

.preheader:                                       ; preds = %.preheader53, %._crit_edge69
  %44 = phi i32 [ %52, %._crit_edge69 ], [ %39, %.preheader53 ]
  %45 = phi i32 [ %53, %._crit_edge69 ], [ %42, %.preheader53 ]
  %.04170 = phi i32 [ %54, %._crit_edge69 ], [ 0, %.preheader53 ]
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph68, label %._crit_edge69

._crit_edge71.loopexit:                           ; preds = %._crit_edge69
  %.pre79 = load i32, ptr %4, align 8, !tbaa !5
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge71.loopexit, %.preheader53
  %47 = phi i32 [ %.pre79, %._crit_edge71.loopexit ], [ %38, %.preheader53 ]
  %48 = phi i32 [ %52, %._crit_edge71.loopexit ], [ %39, %.preheader53 ]
  %49 = phi i32 [ %52, %._crit_edge71.loopexit ], [ %40, %.preheader53 ]
  %50 = add nuw nsw i32 %.04072, 1
  %51 = icmp slt i32 %50, %47
  br i1 %51, label %.preheader53, label %.critedge, !llvm.loop !22

._crit_edge69.loopexit:                           ; preds = %64
  %.pre = load i32, ptr %6, align 4, !tbaa !13
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge69.loopexit, %.preheader
  %52 = phi i32 [ %.pre, %._crit_edge69.loopexit ], [ %44, %.preheader ]
  %53 = phi i32 [ %66, %._crit_edge69.loopexit ], [ %45, %.preheader ]
  %54 = add nuw nsw i32 %.04170, 1
  %55 = icmp slt i32 %54, %52
  br i1 %55, label %.preheader, label %._crit_edge71.loopexit, !llvm.loop !23

.lr.ph68:                                         ; preds = %.preheader, %64
  %.04267 = phi i32 [ %65, %64 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  call void @_ZN9GridIndexC2Eiii(ptr noundef nonnull align 4 dereferenceable(12) %3, i32 noundef %.04267, i32 noundef %.04170, i32 noundef %.04072)
  %56 = load i8, ptr %34, align 8, !tbaa !24, !range !25, !noundef !26
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %58, label %61

58:                                               ; preds = %.lr.ph68
  %59 = load ptr, ptr %35, align 8, !tbaa !27
  %.sroa.010.0.copyload = load i64, ptr %3, align 8
  %.sroa.211.0.copyload = load i32, ptr %.sroa.211.0..sroa_idx, align 8, !tbaa !28
  %60 = call noundef zeroext i1 @_ZN7Array3dIbE3getE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %59, i64 %.sroa.010.0.copyload, i32 %.sroa.211.0.copyload)
  br i1 %60, label %61, label %64

61:                                               ; preds = %58, %.lr.ph68
  %.sroa.06.0.copyload = load i64, ptr %3, align 8
  %.sroa.27.0.copyload = load i32, ptr %.sroa.211.0..sroa_idx, align 8, !tbaa !28
  %62 = call noundef zeroext i1 @_ZN13Polygonizer3d16_isCellOnSurfaceE9GridIndex(ptr noundef nonnull align 8 dereferenceable(57) %0, i64 %.sroa.06.0.copyload, i32 %.sroa.27.0.copyload)
  br i1 %62, label %63, label %64

63:                                               ; preds = %61
  %.sroa.02.0.copyload = load i64, ptr %3, align 8
  %.sroa.23.0.copyload = load i32, ptr %.sroa.211.0..sroa_idx, align 8, !tbaa !28
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 %.sroa.02.0.copyload, i32 %.sroa.23.0.copyload)
  br label %64

64:                                               ; preds = %61, %63, %58
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  %65 = add nuw nsw i32 %.04267, 1
  %66 = load i32, ptr %0, align 8, !tbaa !14
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %.lr.ph68, label %._crit_edge69.loopexit, !llvm.loop !29

.critedge:                                        ; preds = %._crit_edge63, %._crit_edge71, %.preheader53.lr.ph, %.preheader56.lr.ph, %2, %.preheader54
  ret void
}

declare noundef double @_ZN11ScalarField19getScalarFieldValueEiii(ptr noundef nonnull align 8 dereferenceable(248), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Eiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIbE3getE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32), i64, i32) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40), i64, i32) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress 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 = { "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 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 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTS13Polygonizer3d", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !12, i64 40, !11, i64 48, !12, i64 56}
!7 = !{!"int", !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 = !{!"bool", !8, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!6, !11, i64 32}
!18 = !{!6, !10, i64 24}
!19 = distinct !{!19, !16, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}
!21 = distinct !{!21, !16, !20}
!22 = distinct !{!22, !16, !20}
!23 = distinct !{!23, !16, !20}
!24 = !{!6, !12, i64 56}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!6, !11, i64 48}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !16}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass