; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Grid.ll (ZN6R3GridC2ERK5R3Boxdii)

; 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.R3Grid = type { %class.R3Affine, %class.R3Affine, double, double, ptr, [3 x i32], i32, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@RN_EPSILON = external global double, align 8

declare void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #0

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

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

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6R3Grid28SetWorldToGridTransformationERK5R3Box(ptr noundef nonnull align 8 dereferenceable(592), ptr noundef nonnull align 8 dereferenceable(56)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3GridC2ERK5R3Boxdii(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, double noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %class.R3Grid, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  store i32 %4, ptr %10, align 4, !tbaa !11
  %15 = load ptr, ptr %6, align 8
  %16 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 0
  call void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272) %16)
  %17 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 1
  invoke void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272) %17)
          to label %18 unwind label %33

18:                                               ; preds = %5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = invoke noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56) %19)
          to label %21 unwind label %37

21:                                               ; preds = %18
  %22 = icmp ne i32 %20, 0
  br i1 %22, label %29, label %23

23:                                               ; preds = %21
  %24 = load double, ptr %8, align 8, !tbaa !9
  %25 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %26 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %24, double noundef %25)
          to label %27 unwind label %37

27:                                               ; preds = %23
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %29, label %50

29:                                               ; preds = %27, %21
  call void @llvm.lifetime.start.p0(i64 592, ptr %13) #7
  invoke void @_ZN6R3GridC1Eiii(ptr noundef nonnull align 8 dereferenceable(592) %13, i32 noundef 0, i32 noundef 0, i32 noundef 0)
          to label %30 unwind label %41

30:                                               ; preds = %29
  %31 = invoke noundef nonnull align 8 dereferenceable(592) ptr @_ZN6R3GridaSERKS_(ptr noundef nonnull align 8 dereferenceable(592) %15, ptr noundef nonnull align 8 dereferenceable(592) %13)
          to label %32 unwind label %45

32:                                               ; preds = %30
  call void @_ZN6R3GridD1Ev(ptr noundef nonnull align 8 dereferenceable(592) %13) #7
  call void @llvm.lifetime.end.p0(i64 592, ptr %13) #7
  br label %226

33:                                               ; preds = %5
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %11, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %12, align 4
  br label %228

37:                                               ; preds = %224, %206, %187, %114, %105, %102, %94, %85, %78, %69, %62, %53, %23, %18
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %11, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %12, align 4
  br label %227

41:                                               ; preds = %29
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %11, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %12, align 4
  br label %49

45:                                               ; preds = %30
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %11, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %12, align 4
  call void @_ZN6R3GridD1Ev(ptr noundef nonnull align 8 dereferenceable(592) %13) #7
  br label %49

49:                                               ; preds = %45, %41
  call void @llvm.lifetime.end.p0(i64 592, ptr %13) #7
  br label %227

50:                                               ; preds = %27
  %51 = load i32, ptr %10, align 4, !tbaa !11
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %53, label %102

53:                                               ; preds = %50
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %54)
          to label %56 unwind label %37

56:                                               ; preds = %53
  %57 = load double, ptr %8, align 8, !tbaa !9
  %58 = fdiv double %55, %57
  %59 = load i32, ptr %10, align 4, !tbaa !11
  %60 = sitofp i32 %59 to double
  %61 = fcmp ogt double %58, %60
  br i1 %61, label %62, label %69

62:                                               ; preds = %56
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %63)
          to label %65 unwind label %37

65:                                               ; preds = %62
  %66 = load i32, ptr %10, align 4, !tbaa !11
  %67 = sitofp i32 %66 to double
  %68 = fdiv double %64, %67
  store double %68, ptr %8, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %65, %56
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %70)
          to label %72 unwind label %37

72:                                               ; preds = %69
  %73 = load double, ptr %8, align 8, !tbaa !9
  %74 = fdiv double %71, %73
  %75 = load i32, ptr %10, align 4, !tbaa !11
  %76 = sitofp i32 %75 to double
  %77 = fcmp ogt double %74, %76
  br i1 %77, label %78, label %85

78:                                               ; preds = %72
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %79)
          to label %81 unwind label %37

81:                                               ; preds = %78
  %82 = load i32, ptr %10, align 4, !tbaa !11
  %83 = sitofp i32 %82 to double
  %84 = fdiv double %80, %83
  store double %84, ptr %8, align 8, !tbaa !9
  br label %85

85:                                               ; preds = %81, %72
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %86)
          to label %88 unwind label %37

88:                                               ; preds = %85
  %89 = load double, ptr %8, align 8, !tbaa !9
  %90 = fdiv double %87, %89
  %91 = load i32, ptr %10, align 4, !tbaa !11
  %92 = sitofp i32 %91 to double
  %93 = fcmp ogt double %90, %92
  br i1 %93, label %94, label %101

94:                                               ; preds = %88
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %95)
          to label %97 unwind label %37

97:                                               ; preds = %94
  %98 = load i32, ptr %10, align 4, !tbaa !11
  %99 = sitofp i32 %98 to double
  %100 = fdiv double %96, %99
  store double %100, ptr %8, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %97, %88
  br label %102

102:                                              ; preds = %101, %50
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %103)
          to label %105 unwind label %37

105:                                              ; preds = %102
  %106 = load double, ptr %8, align 8, !tbaa !9
  %107 = fdiv double %104, %106
  %108 = fadd double %107, 5.000000e-01
  %109 = fptosi double %108 to i32
  %110 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %111 = getelementptr inbounds [3 x i32], ptr %110, i64 0, i64 0
  store i32 %109, ptr %111, align 8, !tbaa !11
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %112)
          to label %114 unwind label %37

114:                                              ; preds = %105
  %115 = load double, ptr %8, align 8, !tbaa !9
  %116 = fdiv double %113, %115
  %117 = fadd double %116, 5.000000e-01
  %118 = fptosi double %117 to i32
  %119 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %120 = getelementptr inbounds [3 x i32], ptr %119, i64 0, i64 1
  store i32 %118, ptr %120, align 4, !tbaa !11
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %121)
          to label %123 unwind label %37

123:                                              ; preds = %114
  %124 = load double, ptr %8, align 8, !tbaa !9
  %125 = fdiv double %122, %124
  %126 = fadd double %125, 5.000000e-01
  %127 = fptosi double %126 to i32
  %128 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %129 = getelementptr inbounds [3 x i32], ptr %128, i64 0, i64 2
  store i32 %127, ptr %129, align 8, !tbaa !11
  %130 = load i32, ptr %9, align 4, !tbaa !11
  %131 = icmp sgt i32 %130, 0
  br i1 %131, label %132, label %163

132:                                              ; preds = %123
  %133 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %134 = getelementptr inbounds [3 x i32], ptr %133, i64 0, i64 0
  %135 = load i32, ptr %134, align 8, !tbaa !11
  %136 = load i32, ptr %9, align 4, !tbaa !11
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %132
  %139 = load i32, ptr %9, align 4, !tbaa !11
  %140 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %141 = getelementptr inbounds [3 x i32], ptr %140, i64 0, i64 0
  store i32 %139, ptr %141, align 8, !tbaa !11
  br label %142

142:                                              ; preds = %138, %132
  %143 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %144 = getelementptr inbounds [3 x i32], ptr %143, i64 0, i64 1
  %145 = load i32, ptr %144, align 4, !tbaa !11
  %146 = load i32, ptr %9, align 4, !tbaa !11
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %148, label %152

148:                                              ; preds = %142
  %149 = load i32, ptr %9, align 4, !tbaa !11
  %150 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %151 = getelementptr inbounds [3 x i32], ptr %150, i64 0, i64 1
  store i32 %149, ptr %151, align 4, !tbaa !11
  br label %152

152:                                              ; preds = %148, %142
  %153 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %154 = getelementptr inbounds [3 x i32], ptr %153, i64 0, i64 2
  %155 = load i32, ptr %154, align 8, !tbaa !11
  %156 = load i32, ptr %9, align 4, !tbaa !11
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %158, label %162

158:                                              ; preds = %152
  %159 = load i32, ptr %9, align 4, !tbaa !11
  %160 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %161 = getelementptr inbounds [3 x i32], ptr %160, i64 0, i64 2
  store i32 %159, ptr %161, align 8, !tbaa !11
  br label %162

162:                                              ; preds = %158, %152
  br label %163

163:                                              ; preds = %162, %123
  %164 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %165 = getelementptr inbounds [3 x i32], ptr %164, i64 0, i64 0
  %166 = load i32, ptr %165, align 8, !tbaa !11
  %167 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 6
  store i32 %166, ptr %167, align 4, !tbaa !13
  %168 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 6
  %169 = load i32, ptr %168, align 4, !tbaa !13
  %170 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %171 = getelementptr inbounds [3 x i32], ptr %170, i64 0, i64 1
  %172 = load i32, ptr %171, align 4, !tbaa !11
  %173 = mul nsw i32 %169, %172
  %174 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 7
  store i32 %173, ptr %174, align 8, !tbaa !20
  %175 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 7
  %176 = load i32, ptr %175, align 8, !tbaa !20
  %177 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 5
  %178 = getelementptr inbounds [3 x i32], ptr %177, i64 0, i64 2
  %179 = load i32, ptr %178, align 8, !tbaa !11
  %180 = mul nsw i32 %176, %179
  %181 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  store i32 %180, ptr %181, align 4, !tbaa !21
  %182 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  %183 = load i32, ptr %182, align 4, !tbaa !21
  %184 = icmp eq i32 %183, 0
  br i1 %184, label %185, label %187

185:                                              ; preds = %163
  %186 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 4
  store ptr null, ptr %186, align 8, !tbaa !22
  br label %198

187:                                              ; preds = %163
  %188 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  %189 = load i32, ptr %188, align 4, !tbaa !21
  %190 = sext i32 %189 to i64
  %191 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %190, i64 8)
  %192 = extractvalue { i64, i1 } %191, 1
  %193 = extractvalue { i64, i1 } %191, 0
  %194 = select i1 %192, i64 -1, i64 %193
  %195 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %194) #8
          to label %196 unwind label %37

196:                                              ; preds = %187
  %197 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 4
  store ptr %195, ptr %197, align 8, !tbaa !22
  br label %198

198:                                              ; preds = %196, %185
  %199 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  %200 = load i32, ptr %199, align 4, !tbaa !21
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %208

202:                                              ; preds = %198
  %203 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 4
  %204 = load ptr, ptr %203, align 8, !tbaa !22
  %205 = icmp ne ptr %204, null
  br i1 %205, label %208, label %206

206:                                              ; preds = %202
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 112, ptr noundef @.str.2)
          to label %207 unwind label %37

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207, %202, %198
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %209

209:                                              ; preds = %221, %208
  %210 = load i32, ptr %14, align 4, !tbaa !11
  %211 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  %212 = load i32, ptr %211, align 4, !tbaa !21
  %213 = icmp slt i32 %210, %212
  br i1 %213, label %215, label %214

214:                                              ; preds = %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %224

215:                                              ; preds = %209
  %216 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 4
  %217 = load ptr, ptr %216, align 8, !tbaa !22
  %218 = load i32, ptr %14, align 4, !tbaa !11
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds double, ptr %217, i64 %219
  store double 0.000000e+00, ptr %220, align 8, !tbaa !9
  br label %221

221:                                              ; preds = %215
  %222 = load i32, ptr %14, align 4, !tbaa !11
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %14, align 4, !tbaa !11
  br label %209, !llvm.loop !23

224:                                              ; preds = %214
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN6R3Grid28SetWorldToGridTransformationERK5R3Box(ptr noundef nonnull align 8 dereferenceable(592) %15, ptr noundef nonnull align 8 dereferenceable(56) %225)
          to label %226 unwind label %37

226:                                              ; preds = %224, %32
  ret void

227:                                              ; preds = %49, %37
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %17) #7
  br label %228

228:                                              ; preds = %227, %33
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %16) #7
  br label %229

229:                                              ; preds = %228
  %230 = load ptr, ptr %11, align 8
  %231 = load i32, ptr %12, align 4
  %232 = insertvalue { ptr, i32 } poison, ptr %230, 0
  %233 = insertvalue { ptr, i32 } %232, i32 %231, 1
  resume { ptr, i32 } %233
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(592) ptr @_ZN6R3GridaSERKS_(ptr noundef nonnull align 8 dereferenceable(592), ptr noundef nonnull align 8 dereferenceable(592)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) #6 align 2

declare void @_ZN6R3GridC1Eiii(ptr, i32, i32, i32)

declare void @_ZN6R3GridD1Ev(ptr)

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nobuiltin allocsize(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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }

!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 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 580}
!14 = !{!"_ZTS6R3Grid", !15, i64 0, !15, i64 272, !10, i64 544, !10, i64 552, !6, i64 560, !7, i64 568, !12, i64 580, !12, i64 584, !12, i64 588}
!15 = !{!"_ZTS8R3Affine", !16, i64 0, !17, i64 8, !17, i64 136, !18, i64 264}
!16 = !{!"_ZTS16R3Transformation"}
!17 = !{!"_ZTS8R4Matrix", !7, i64 0}
!18 = !{!"_ZTS7RNFlags", !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!14, !12, i64 584}
!21 = !{!14, !12, i64 588}
!22 = !{!14, !6, i64 560}
!23 = distinct !{!23, !24}
!24 = !{!"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.R3Grid = type { %class.R3Affine, %class.R3Affine, double, double, ptr, [3 x i32], i32, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@RN_EPSILON = external local_unnamed_addr global double, align 8

declare void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6R3Grid28SetWorldToGridTransformationERK5R3Box(ptr noundef nonnull align 8 dereferenceable(592), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3GridC2ERK5R3Boxdii(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, double noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.R3Grid, align 8
  tail call void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 272
  invoke void @_ZN8R3AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7)
          to label %8 unwind label %19

8:                                                ; preds = %5
  %9 = invoke noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %10 unwind label %21

10:                                               ; preds = %8
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %11, label %15

11:                                               ; preds = %10
  %12 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %13 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %2, double noundef %12)
          to label %14 unwind label %21

14:                                               ; preds = %11
  %.not50 = icmp eq i32 %13, 0
  br i1 %.not50, label %28, label %15

15:                                               ; preds = %14, %10
  call void @llvm.lifetime.start.p0(i64 592, ptr nonnull %6) #7
  invoke void @_ZN6R3GridC1Eiii(ptr noundef nonnull align 8 dereferenceable(592) %6, i32 noundef 0, i32 noundef 0, i32 noundef 0)
          to label %16 unwind label %23

16:                                               ; preds = %15
  %17 = invoke noundef nonnull align 8 dereferenceable(592) ptr @_ZN6R3GridaSERKS_(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef nonnull align 8 dereferenceable(592) %6)
          to label %18 unwind label %25

18:                                               ; preds = %16
  call void @_ZN6R3GridD1Ev(ptr noundef nonnull align 8 dereferenceable(592) %6) #7
  call void @llvm.lifetime.end.p0(i64 592, ptr nonnull %6) #7
  br label %112

19:                                               ; preds = %5
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %114

21:                                               ; preds = %._crit_edge, %101, %66, %60, %58, %54, %49, %45, %40, %36, %30, %11, %8
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %113

23:                                               ; preds = %15
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %16
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6R3GridD1Ev(ptr noundef nonnull align 8 dereferenceable(592) %6) #7
  br label %27

27:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 592, ptr nonnull %6) #7
  br label %113

28:                                               ; preds = %14
  %29 = icmp sgt i32 %4, 0
  br i1 %29, label %30, label %58

30:                                               ; preds = %28
  %31 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %32 unwind label %21

32:                                               ; preds = %30
  %33 = fdiv double %31, %2
  %34 = uitofp nneg i32 %4 to double
  %35 = fcmp ogt double %33, %34
  br i1 %35, label %36, label %40

36:                                               ; preds = %32
  %37 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %38 unwind label %21

38:                                               ; preds = %36
  %39 = fdiv double %37, %34
  br label %40

40:                                               ; preds = %38, %32
  %.041 = phi double [ %39, %38 ], [ %2, %32 ]
  %41 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %42 unwind label %21

42:                                               ; preds = %40
  %43 = fdiv double %41, %.041
  %44 = fcmp ogt double %43, %34
  br i1 %44, label %45, label %49

45:                                               ; preds = %42
  %46 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %47 unwind label %21

47:                                               ; preds = %45
  %48 = fdiv double %46, %34
  br label %49

49:                                               ; preds = %47, %42
  %.142 = phi double [ %48, %47 ], [ %.041, %42 ]
  %50 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %51 unwind label %21

51:                                               ; preds = %49
  %52 = fdiv double %50, %.142
  %53 = fcmp ogt double %52, %34
  br i1 %53, label %54, label %58

54:                                               ; preds = %51
  %55 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %56 unwind label %21

56:                                               ; preds = %54
  %57 = fdiv double %55, %34
  br label %58

58:                                               ; preds = %51, %56, %28
  %.243 = phi double [ %57, %56 ], [ %.142, %51 ], [ %2, %28 ]
  %59 = invoke noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %60 unwind label %21

60:                                               ; preds = %58
  %61 = fdiv double %59, %.243
  %62 = fadd double %61, 5.000000e-01
  %63 = fptosi double %62 to i32
  %64 = getelementptr inbounds i8, ptr %0, i64 568
  store i32 %63, ptr %64, align 8, !tbaa !9
  %65 = invoke noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %66 unwind label %21

66:                                               ; preds = %60
  %67 = fdiv double %65, %.243
  %68 = fadd double %67, 5.000000e-01
  %69 = fptosi double %68 to i32
  %70 = getelementptr inbounds i8, ptr %0, i64 572
  store i32 %69, ptr %70, align 4, !tbaa !9
  %71 = invoke noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %72 unwind label %21

72:                                               ; preds = %66
  %73 = fdiv double %71, %.243
  %74 = fadd double %73, 5.000000e-01
  %75 = fptosi double %74 to i32
  %76 = getelementptr inbounds i8, ptr %0, i64 576
  store i32 %75, ptr %76, align 8, !tbaa !9
  %77 = icmp sgt i32 %3, 0
  %.pre = load i32, ptr %64, align 8, !tbaa !9
  br i1 %77, label %78, label %._crit_edge62

._crit_edge62:                                    ; preds = %72
  %.pre63 = load i32, ptr %70, align 4, !tbaa !9
  br label %90

78:                                               ; preds = %72
  %79 = icmp slt i32 %.pre, %3
  br i1 %79, label %80, label %81

80:                                               ; preds = %78
  store i32 %3, ptr %64, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %80, %78
  %82 = phi i32 [ %3, %80 ], [ %.pre, %78 ]
  %83 = load i32, ptr %70, align 4, !tbaa !9
  %84 = icmp slt i32 %83, %3
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i32 %3, ptr %70, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %85, %81
  %87 = phi i32 [ %3, %85 ], [ %83, %81 ]
  %88 = icmp slt i32 %75, %3
  br i1 %88, label %89, label %90

89:                                               ; preds = %86
  store i32 %3, ptr %76, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %._crit_edge62, %86, %89
  %91 = phi i32 [ %75, %86 ], [ %3, %89 ], [ %75, %._crit_edge62 ]
  %92 = phi i32 [ %87, %86 ], [ %87, %89 ], [ %.pre63, %._crit_edge62 ]
  %93 = phi i32 [ %82, %86 ], [ %82, %89 ], [ %.pre, %._crit_edge62 ]
  %94 = getelementptr inbounds i8, ptr %0, i64 580
  store i32 %93, ptr %94, align 4, !tbaa !11
  %95 = mul nsw i32 %92, %93
  %96 = getelementptr inbounds i8, ptr %0, i64 584
  store i32 %95, ptr %96, align 8, !tbaa !19
  %97 = mul nsw i32 %91, %95
  %98 = getelementptr inbounds i8, ptr %0, i64 588
  store i32 %97, ptr %98, align 4, !tbaa !20
  %99 = icmp eq i32 %97, 0
  br i1 %99, label %.thread64, label %101

.thread64:                                        ; preds = %90
  %100 = getelementptr inbounds i8, ptr %0, i64 560
  store ptr null, ptr %100, align 8, !tbaa !21
  br label %._crit_edge

101:                                              ; preds = %90
  %102 = sext i32 %97 to i64
  %103 = icmp slt i32 %97, 0
  %104 = shl nsw i64 %102, 3
  %105 = select i1 %103, i64 -1, i64 %104
  %106 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %105) #8
          to label %107 unwind label %21

107:                                              ; preds = %101
  %108 = getelementptr inbounds i8, ptr %0, i64 560
  store ptr %106, ptr %108, align 8, !tbaa !21
  %109 = icmp sgt i32 %97, 0
  br i1 %109, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %107
  %110 = zext nneg i32 %97 to i64
  %111 = shl nuw nsw i64 %110, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %106, i8 0, i64 %111, i1 false), !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.thread64, %.lr.ph, %107
  invoke void @_ZN6R3Grid28SetWorldToGridTransformationERK5R3Box(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef nonnull align 8 dereferenceable(56) %1)
          to label %112 unwind label %21

112:                                              ; preds = %._crit_edge, %18
  ret void

113:                                              ; preds = %27, %21
  %.pn.pn = phi { ptr, i32 } [ %.pn, %27 ], [ %22, %21 ]
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7) #7
  br label %114

114:                                              ; preds = %113, %19
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %113 ], [ %20, %19 ]
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #7
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5R3Box7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(592) ptr @_ZN6R3GridaSERKS_(ptr noundef nonnull align 8 dereferenceable(592), ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7XLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7YLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5R3Box7ZLengthEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #5 align 2

declare void @_ZN6R3GridC1Eiii(ptr, i32, i32, i32) local_unnamed_addr

declare void @_ZN6R3GridD1Ev(ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin allocsize(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 580}
!12 = !{!"_ZTS6R3Grid", !13, i64 0, !13, i64 272, !6, i64 544, !6, i64 552, !18, i64 560, !7, i64 568, !10, i64 580, !10, i64 584, !10, i64 588}
!13 = !{!"_ZTS8R3Affine", !14, i64 0, !15, i64 8, !15, i64 136, !16, i64 264}
!14 = !{!"_ZTS16R3Transformation"}
!15 = !{!"_ZTS8R4Matrix", !7, i64 0}
!16 = !{!"_ZTS7RNFlags", !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!12, !10, i64 584}
!20 = !{!12, !10, i64 588}
!21 = !{!12, !18, i64 560}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass