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

; 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 nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d20getGridIndexVerticesE9GridIndexPS0_(i64, i32, ptr noundef) #3

declare noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248), i64, i32) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN13Polygonizer3d19_calculateCubeIndexE9GridIndex(ptr noundef nonnull align 8 dereferenceable(57) %0, i64 %1, i32 %2) #5 align 2 {
  %4 = alloca %struct.GridIndex, align 4
  %5 = alloca { i64, i32 }, align 4
  %6 = alloca ptr, align 8
  %7 = alloca [8 x %struct.GridIndex], align 16
  %8 = alloca %struct.GridIndex, align 4
  %9 = alloca { i64, i32 }, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.GridIndex, align 4
  %12 = alloca { i64, i32 }, align 4
  %13 = alloca %struct.GridIndex, align 4
  %14 = alloca { i64, i32 }, align 4
  %15 = alloca %struct.GridIndex, align 4
  %16 = alloca { i64, i32 }, align 4
  %17 = alloca %struct.GridIndex, align 4
  %18 = alloca { i64, i32 }, align 4
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca { i64, i32 }, align 4
  %21 = alloca %struct.GridIndex, align 4
  %22 = alloca { i64, i32 }, align 4
  %23 = alloca %struct.GridIndex, align 4
  %24 = alloca { i64, i32 }, align 4
  %25 = alloca %struct.GridIndex, align 4
  %26 = alloca { i64, i32 }, align 4
  %27 = getelementptr inbounds { i64, i32 }, ptr %5, i32 0, i32 0
  store i64 %1, ptr %27, align 4
  %28 = getelementptr inbounds { i64, i32 }, ptr %5, i32 0, i32 1
  store i32 %2, ptr %28, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %5, i64 12, i1 false)
  store ptr %0, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr %7) #6
  %30 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i32 0, i32 0
  %31 = getelementptr inbounds %struct.GridIndex, ptr %30, i64 8
  br label %32

32:                                               ; preds = %32, %3
  %33 = phi ptr [ %30, %3 ], [ %34, %32 ]
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %33)
  %34 = getelementptr inbounds %struct.GridIndex, ptr %33, i64 1
  %35 = icmp eq ptr %34, %31
  br i1 %35, label %36, label %32

36:                                               ; preds = %32
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %4, i64 12, i1 false), !tbaa.struct !9
  %37 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %8, i64 12, i1 false)
  %38 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 0
  %39 = load i64, ptr %38, align 4
  %40 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 1
  %41 = load i32, ptr %40, align 4
  call void @_ZN6Grid3d20getGridIndexVerticesE9GridIndexPS0_(i64 %39, i32 %41, ptr noundef %37)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !10
  %42 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  %44 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 16 %44, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %11, i64 12, i1 false)
  %45 = getelementptr inbounds { i64, i32 }, ptr %12, i32 0, i32 0
  %46 = load i64, ptr %45, align 4
  %47 = getelementptr inbounds { i64, i32 }, ptr %12, i32 0, i32 1
  %48 = load i32, ptr %47, align 4
  %49 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %43, i64 %46, i32 %48)
  %50 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %51 = load double, ptr %50, align 8, !tbaa !16
  %52 = fcmp ogt double %49, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %36
  %54 = load i32, ptr %10, align 4, !tbaa !10
  %55 = or i32 %54, 1
  store i32 %55, ptr %10, align 4, !tbaa !10
  br label %56

56:                                               ; preds = %53, %36
  %57 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %58 = load ptr, ptr %57, align 8, !tbaa !12
  %59 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %59, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %13, i64 12, i1 false)
  %60 = getelementptr inbounds { i64, i32 }, ptr %14, i32 0, i32 0
  %61 = load i64, ptr %60, align 4
  %62 = getelementptr inbounds { i64, i32 }, ptr %14, i32 0, i32 1
  %63 = load i32, ptr %62, align 4
  %64 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %58, i64 %61, i32 %63)
  %65 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %66 = load double, ptr %65, align 8, !tbaa !16
  %67 = fcmp ogt double %64, %66
  br i1 %67, label %68, label %71

68:                                               ; preds = %56
  %69 = load i32, ptr %10, align 4, !tbaa !10
  %70 = or i32 %69, 2
  store i32 %70, ptr %10, align 4, !tbaa !10
  br label %71

71:                                               ; preds = %68, %56
  %72 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %73 = load ptr, ptr %72, align 8, !tbaa !12
  %74 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 8 %74, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %15, i64 12, i1 false)
  %75 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 0
  %76 = load i64, ptr %75, align 4
  %77 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 1
  %78 = load i32, ptr %77, align 4
  %79 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %73, i64 %76, i32 %78)
  %80 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %81 = load double, ptr %80, align 8, !tbaa !16
  %82 = fcmp ogt double %79, %81
  br i1 %82, label %83, label %86

83:                                               ; preds = %71
  %84 = load i32, ptr %10, align 4, !tbaa !10
  %85 = or i32 %84, 4
  store i32 %85, ptr %10, align 4, !tbaa !10
  br label %86

86:                                               ; preds = %83, %71
  %87 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %88 = load ptr, ptr %87, align 8, !tbaa !12
  %89 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %89, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %17, i64 12, i1 false)
  %90 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 0
  %91 = load i64, ptr %90, align 4
  %92 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 1
  %93 = load i32, ptr %92, align 4
  %94 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %88, i64 %91, i32 %93)
  %95 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %96 = load double, ptr %95, align 8, !tbaa !16
  %97 = fcmp ogt double %94, %96
  br i1 %97, label %98, label %101

98:                                               ; preds = %86
  %99 = load i32, ptr %10, align 4, !tbaa !10
  %100 = or i32 %99, 8
  store i32 %100, ptr %10, align 4, !tbaa !10
  br label %101

101:                                              ; preds = %98, %86
  %102 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %103 = load ptr, ptr %102, align 8, !tbaa !12
  %104 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 16 %104, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %19, i64 12, i1 false)
  %105 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 0
  %106 = load i64, ptr %105, align 4
  %107 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 1
  %108 = load i32, ptr %107, align 4
  %109 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %103, i64 %106, i32 %108)
  %110 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %111 = load double, ptr %110, align 8, !tbaa !16
  %112 = fcmp ogt double %109, %111
  br i1 %112, label %113, label %116

113:                                              ; preds = %101
  %114 = load i32, ptr %10, align 4, !tbaa !10
  %115 = or i32 %114, 16
  store i32 %115, ptr %10, align 4, !tbaa !10
  br label %116

116:                                              ; preds = %113, %101
  %117 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %118 = load ptr, ptr %117, align 8, !tbaa !12
  %119 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %119, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %21, i64 12, i1 false)
  %120 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 0
  %121 = load i64, ptr %120, align 4
  %122 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 1
  %123 = load i32, ptr %122, align 4
  %124 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %118, i64 %121, i32 %123)
  %125 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %126 = load double, ptr %125, align 8, !tbaa !16
  %127 = fcmp ogt double %124, %126
  br i1 %127, label %128, label %131

128:                                              ; preds = %116
  %129 = load i32, ptr %10, align 4, !tbaa !10
  %130 = or i32 %129, 32
  store i32 %130, ptr %10, align 4, !tbaa !10
  br label %131

131:                                              ; preds = %128, %116
  %132 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %133 = load ptr, ptr %132, align 8, !tbaa !12
  %134 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 8 %134, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %135 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %136 = load i64, ptr %135, align 4
  %137 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %138 = load i32, ptr %137, align 4
  %139 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %133, i64 %136, i32 %138)
  %140 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %141 = load double, ptr %140, align 8, !tbaa !16
  %142 = fcmp ogt double %139, %141
  br i1 %142, label %143, label %146

143:                                              ; preds = %131
  %144 = load i32, ptr %10, align 4, !tbaa !10
  %145 = or i32 %144, 64
  store i32 %145, ptr %10, align 4, !tbaa !10
  br label %146

146:                                              ; preds = %143, %131
  %147 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 6
  %148 = load ptr, ptr %147, align 8, !tbaa !12
  %149 = getelementptr inbounds [8 x %struct.GridIndex], ptr %7, i64 0, i64 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %149, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %25, i64 12, i1 false)
  %150 = getelementptr inbounds { i64, i32 }, ptr %26, i32 0, i32 0
  %151 = load i64, ptr %150, align 4
  %152 = getelementptr inbounds { i64, i32 }, ptr %26, i32 0, i32 1
  %153 = load i32, ptr %152, align 4
  %154 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %148, i64 %151, i32 %153)
  %155 = getelementptr inbounds %class.Polygonizer3d, ptr %29, i32 0, i32 5
  %156 = load double, ptr %155, align 8, !tbaa !16
  %157 = fcmp ogt double %154, %156
  br i1 %157, label %158, label %161

158:                                              ; preds = %146
  %159 = load i32, ptr %10, align 4, !tbaa !10
  %160 = or i32 %159, 128
  store i32 %160, ptr %10, align 4, !tbaa !10
  br label %161

161:                                              ; preds = %158, %146
  %162 = load i32, ptr %10, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr %7) #6
  ret i32 %162
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 32}
!13 = !{!"_ZTS13Polygonizer3d", !11, i64 0, !11, i64 4, !11, i64 8, !14, i64 16, !14, i64 24, !6, i64 32, !15, i64 40, !6, i64 48, !15, i64 56}
!14 = !{!"double", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!13, !14, i64 24}


; 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 nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d20getGridIndexVerticesE9GridIndexPS0_(i64, i32, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 256) i32 @_ZN13Polygonizer3d19_calculateCubeIndexE9GridIndex(ptr nocapture noundef nonnull readonly align 8 dereferenceable(57) %0, i64 %1, i32 %2) local_unnamed_addr #4 align 2 {
  %4 = alloca [8 x %struct.GridIndex], align 16
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %4) #5
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %.ptr.1 = getelementptr inbounds i8, ptr %4, i64 12
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %4, i64 24
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %4, i64 36
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %4, i64 48
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %4, i64 60
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %4, i64 72
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %4, i64 84
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.7)
  call void @_ZN6Grid3d20getGridIndexVerticesE9GridIndexPS0_(i64 %1, i32 %2, ptr noundef nonnull %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.029.0.copyload = load i64, ptr %4, align 16
  %.sroa.230.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  %.sroa.230.0.copyload = load i32, ptr %.sroa.230.0..sroa_idx, align 8, !tbaa !13
  %7 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %6, i64 %.sroa.029.0.copyload, i32 %.sroa.230.0.copyload)
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load double, ptr %8, align 8, !tbaa !14
  %10 = fcmp ogt double %7, %9
  %.0 = zext i1 %10 to i32
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.025.0.copyload = load i64, ptr %.ptr.1, align 4
  %.sroa.226.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 20
  %.sroa.226.0.copyload = load i32, ptr %.sroa.226.0..sroa_idx, align 4, !tbaa !13
  %12 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %11, i64 %.sroa.025.0.copyload, i32 %.sroa.226.0.copyload)
  %13 = load double, ptr %8, align 8, !tbaa !14
  %14 = fcmp ogt double %12, %13
  %15 = or disjoint i32 %.0, 2
  %.1 = select i1 %14, i32 %15, i32 %.0
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.021.0.copyload = load i64, ptr %.ptr.2, align 8
  %.sroa.222.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 32
  %.sroa.222.0.copyload = load i32, ptr %.sroa.222.0..sroa_idx, align 16, !tbaa !13
  %17 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %16, i64 %.sroa.021.0.copyload, i32 %.sroa.222.0.copyload)
  %18 = load double, ptr %8, align 8, !tbaa !14
  %19 = fcmp ogt double %17, %18
  %20 = or disjoint i32 %.1, 4
  %.2 = select i1 %19, i32 %20, i32 %.1
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.017.0.copyload = load i64, ptr %.ptr.3, align 4
  %.sroa.218.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 44
  %.sroa.218.0.copyload = load i32, ptr %.sroa.218.0..sroa_idx, align 4, !tbaa !13
  %22 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %21, i64 %.sroa.017.0.copyload, i32 %.sroa.218.0.copyload)
  %23 = load double, ptr %8, align 8, !tbaa !14
  %24 = fcmp ogt double %22, %23
  %25 = or disjoint i32 %.2, 8
  %.3 = select i1 %24, i32 %25, i32 %.2
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.013.0.copyload = load i64, ptr %.ptr.4, align 16
  %.sroa.214.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 56
  %.sroa.214.0.copyload = load i32, ptr %.sroa.214.0..sroa_idx, align 8, !tbaa !13
  %27 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %26, i64 %.sroa.013.0.copyload, i32 %.sroa.214.0.copyload)
  %28 = load double, ptr %8, align 8, !tbaa !14
  %29 = fcmp ogt double %27, %28
  %30 = or i32 %.3, 16
  %.4 = select i1 %29, i32 %30, i32 %.3
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.09.0.copyload = load i64, ptr %.ptr.5, align 4
  %.sroa.210.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 68
  %.sroa.210.0.copyload = load i32, ptr %.sroa.210.0..sroa_idx, align 4, !tbaa !13
  %32 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %31, i64 %.sroa.09.0.copyload, i32 %.sroa.210.0.copyload)
  %33 = load double, ptr %8, align 8, !tbaa !14
  %34 = fcmp ogt double %32, %33
  %35 = or i32 %.4, 32
  %.5 = select i1 %34, i32 %35, i32 %.4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.05.0.copyload = load i64, ptr %.ptr.6, align 8
  %.sroa.26.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 80
  %.sroa.26.0.copyload = load i32, ptr %.sroa.26.0..sroa_idx, align 16, !tbaa !13
  %37 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %36, i64 %.sroa.05.0.copyload, i32 %.sroa.26.0.copyload)
  %38 = load double, ptr %8, align 8, !tbaa !14
  %39 = fcmp ogt double %37, %38
  %40 = or i32 %.5, 64
  %.6 = select i1 %39, i32 %40, i32 %.5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %.sroa.01.0.copyload = load i64, ptr %.ptr.7, align 4
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 92
  %.sroa.22.0.copyload = load i32, ptr %.sroa.22.0..sroa_idx, align 4, !tbaa !13
  %42 = call noundef double @_ZN11ScalarField19getScalarFieldValueE9GridIndex(ptr noundef nonnull align 8 dereferenceable(248) %41, i64 %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload)
  %43 = load double, ptr %8, align 8, !tbaa !14
  %44 = fcmp ogt double %42, %43
  %45 = or i32 %.6, 128
  %.7 = select i1 %44, i32 %45, i32 %.6
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %4) #5
  ret i32 %.7
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !11, i64 32}
!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 = !{!7, !7, i64 0}
!14 = !{!6, !10, i64 24}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass