; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Grid.ll (ZN6R2GridC2ERKS_iiii)

; 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.R2Vector = type { [2 x double] }
%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R2Grid = type { %class.R2Affine, %class.R2Affine, double, ptr, [2 x i32], i32, i32 }

@.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

declare void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84)) 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) #4 align 2

; Function Attrs: nounwind
declare void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2GridC2ERKS_iiii(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef nonnull align 8 dereferenceable(208) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca %class.R2Vector, align 8
  %22 = alloca %class.R2Affine, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  %23 = load ptr, ptr %7, align 8
  %24 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 0
  call void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84) %24)
  %25 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 1
  invoke void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84) %25)
          to label %26 unwind label %47

26:                                               ; preds = %6
  %27 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 3
  store ptr null, ptr %27, align 8, !tbaa !11
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = sub nsw i32 %28, %29
  %31 = add nsw i32 %30, 1
  %32 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %33 = getelementptr inbounds [2 x i32], ptr %32, i64 0, i64 0
  store i32 %31, ptr %33, align 8, !tbaa !9
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = sub nsw i32 %34, %35
  %37 = add nsw i32 %36, 1
  %38 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %39 = getelementptr inbounds [2 x i32], ptr %38, i64 0, i64 1
  store i32 %37, ptr %39, align 4, !tbaa !9
  %40 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %41 = getelementptr inbounds [2 x i32], ptr %40, i64 0, i64 0
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %44, label %51

44:                                               ; preds = %26
  %45 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %46 = getelementptr inbounds [2 x i32], ptr %45, i64 0, i64 0
  store i32 0, ptr %46, align 8, !tbaa !9
  br label %51

47:                                               ; preds = %6
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %13, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %14, align 4
  br label %202

51:                                               ; preds = %44, %26
  %52 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %53 = getelementptr inbounds [2 x i32], ptr %52, i64 0, i64 1
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = icmp slt i32 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %51
  %57 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %58 = getelementptr inbounds [2 x i32], ptr %57, i64 0, i64 1
  store i32 0, ptr %58, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %56, %51
  %60 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %61 = getelementptr inbounds [2 x i32], ptr %60, i64 0, i64 0
  %62 = load i32, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 5
  store i32 %62, ptr %63, align 8, !tbaa !17
  %64 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 5
  %65 = load i32, ptr %64, align 8, !tbaa !17
  %66 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %67 = getelementptr inbounds [2 x i32], ptr %66, i64 0, i64 1
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = mul nsw i32 %65, %68
  %70 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 6
  store i32 %69, ptr %70, align 4, !tbaa !18
  %71 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 6
  %72 = load i32, ptr %71, align 4, !tbaa !18
  %73 = icmp sle i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %59
  %75 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 3
  store ptr null, ptr %75, align 8, !tbaa !11
  br label %91

76:                                               ; preds = %59
  %77 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 6
  %78 = load i32, ptr %77, align 4, !tbaa !18
  %79 = sext i32 %78 to i64
  %80 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %79, i64 8)
  %81 = extractvalue { i64, i1 } %80, 1
  %82 = extractvalue { i64, i1 } %80, 0
  %83 = select i1 %81, i64 -1, i64 %82
  %84 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %83) #8
          to label %85 unwind label %87

85:                                               ; preds = %76
  %86 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 3
  store ptr %84, ptr %86, align 8, !tbaa !11
  br label %91

87:                                               ; preds = %164, %99, %76
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %13, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %14, align 4
  br label %201

91:                                               ; preds = %85, %74
  %92 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 6
  %93 = load i32, ptr %92, align 4, !tbaa !18
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %101

95:                                               ; preds = %91
  %96 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !11
  %98 = icmp ne ptr %97, null
  br i1 %98, label %101, label %99

99:                                               ; preds = %95
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 105, ptr noundef @.str.2)
          to label %100 unwind label %87

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100, %95, %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %161, %101
  %103 = load i32, ptr %15, align 4, !tbaa !9
  %104 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %105 = getelementptr inbounds [2 x i32], ptr %104, i64 0, i64 1
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = icmp slt i32 %103, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %102
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %164

109:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = add nsw i32 %110, %111
  store i32 %112, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %113

113:                                              ; preds = %157, %109
  %114 = load i32, ptr %18, align 4, !tbaa !9
  %115 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 4
  %116 = getelementptr inbounds [2 x i32], ptr %115, i64 0, i64 0
  %117 = load i32, ptr %116, align 8, !tbaa !9
  %118 = icmp slt i32 %114, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %113
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %160

120:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %121 = load i32, ptr %9, align 4, !tbaa !9
  %122 = load i32, ptr %18, align 4, !tbaa !9
  %123 = add nsw i32 %121, %122
  store i32 %123, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  store double 0.000000e+00, ptr %20, align 8, !tbaa !19
  %124 = load i32, ptr %19, align 4, !tbaa !9
  %125 = icmp sge i32 %124, 0
  br i1 %125, label %126, label %152

126:                                              ; preds = %120
  %127 = load i32, ptr %19, align 4, !tbaa !9
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %128)
          to label %130 unwind label %147

130:                                              ; preds = %126
  %131 = icmp slt i32 %127, %129
  br i1 %131, label %132, label %152

132:                                              ; preds = %130
  %133 = load i32, ptr %17, align 4, !tbaa !9
  %134 = icmp sge i32 %133, 0
  br i1 %134, label %135, label %151

135:                                              ; preds = %132
  %136 = load i32, ptr %17, align 4, !tbaa !9
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %137)
          to label %139 unwind label %147

139:                                              ; preds = %135
  %140 = icmp slt i32 %136, %138
  br i1 %140, label %141, label %151

141:                                              ; preds = %139
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load i32, ptr %19, align 4, !tbaa !9
  %144 = load i32, ptr %17, align 4, !tbaa !9
  %145 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %142, i32 noundef %143, i32 noundef %144)
          to label %146 unwind label %147

146:                                              ; preds = %141
  store double %145, ptr %20, align 8, !tbaa !19
  br label %151

147:                                              ; preds = %152, %141, %135, %126
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %13, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %201

151:                                              ; preds = %146, %139, %132
  br label %152

152:                                              ; preds = %151, %130, %120
  %153 = load i32, ptr %18, align 4, !tbaa !9
  %154 = load i32, ptr %15, align 4, !tbaa !9
  %155 = load double, ptr %20, align 8, !tbaa !19
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %23, i32 noundef %153, i32 noundef %154, double noundef %155)
          to label %156 unwind label %147

156:                                              ; preds = %152
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %18, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %18, align 4, !tbaa !9
  br label %113, !llvm.loop !20

160:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %15, align 4, !tbaa !9
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %15, align 4, !tbaa !9
  br label %102, !llvm.loop !22

164:                                              ; preds = %108
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = getelementptr inbounds %class.R2Grid, ptr %165, i32 0, i32 1
  %167 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 1
  %168 = invoke noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %167, ptr noundef nonnull align 8 dereferenceable(84) %166)
          to label %169 unwind label %87

169:                                              ; preds = %164
  %170 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #9
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = sub nsw i32 0, %171
  %173 = sitofp i32 %172 to double
  %174 = load i32, ptr %10, align 4, !tbaa !9
  %175 = sub nsw i32 0, %174
  %176 = sitofp i32 %175 to double
  invoke void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16) %21, double noundef %173, double noundef %176)
          to label %177 unwind label %188

177:                                              ; preds = %169
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %170, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %178 unwind label %188

178:                                              ; preds = %177
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #9
  %179 = load ptr, ptr %8, align 8, !tbaa !5
  %180 = getelementptr inbounds %class.R2Grid, ptr %179, i32 0, i32 2
  %181 = load double, ptr %180, align 8, !tbaa !23
  %182 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 2
  store double %181, ptr %182, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 88, ptr %22) #9
  %183 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 1
  invoke void @_ZNK8R2Affine7InverseEv(ptr dead_on_unwind writable sret(%class.R2Affine) align 8 %22, ptr noundef nonnull align 8 dereferenceable(84) %183)
          to label %184 unwind label %192

184:                                              ; preds = %178
  %185 = getelementptr inbounds %class.R2Grid, ptr %23, i32 0, i32 0
  %186 = invoke noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %185, ptr noundef nonnull align 8 dereferenceable(84) %22)
          to label %187 unwind label %196

187:                                              ; preds = %184
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %22) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %22) #9
  ret void

188:                                              ; preds = %177, %169
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %13, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #9
  br label %201

192:                                              ; preds = %178
  %193 = landingpad { ptr, i32 }
          cleanup
  %194 = extractvalue { ptr, i32 } %193, 0
  store ptr %194, ptr %13, align 8
  %195 = extractvalue { ptr, i32 } %193, 1
  store i32 %195, ptr %14, align 4
  br label %200

196:                                              ; preds = %184
  %197 = landingpad { ptr, i32 }
          cleanup
  %198 = extractvalue { ptr, i32 } %197, 0
  store ptr %198, ptr %13, align 8
  %199 = extractvalue { ptr, i32 } %197, 1
  store i32 %199, ptr %14, align 4
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %22) #9
  br label %200

200:                                              ; preds = %196, %192
  call void @llvm.lifetime.end.p0(i64 88, ptr %22) #9
  br label %201

201:                                              ; preds = %200, %188, %147, %87
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %25) #9
  br label %202

202:                                              ; preds = %201, %47
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %24) #9
  br label %203

203:                                              ; preds = %202
  %204 = load ptr, ptr %13, align 8
  %205 = load i32, ptr %14, align 4
  %206 = insertvalue { ptr, i32 } poison, ptr %204, 0
  %207 = insertvalue { ptr, i32 } %206, i32 %205, 1
  resume { ptr, i32 } %207
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef, double noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

declare void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R2Affine7InverseEv(ptr dead_on_unwind noalias writable sret(%class.R2Affine) align 8, ptr noundef nonnull align 8 dereferenceable(84)) #4 align 2

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 = { 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 "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 = { 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 = { inlinehint 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 #8 = { builtin allocsize(0) }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 184}
!12 = !{!"_ZTS6R2Grid", !13, i64 0, !13, i64 88, !16, i64 176, !6, i64 184, !7, i64 192, !10, i64 200, !10, i64 204}
!13 = !{!"_ZTS8R2Affine", !14, i64 0, !15, i64 8, !10, i64 80}
!14 = !{!"_ZTS16R2Transformation"}
!15 = !{!"_ZTS8R3Matrix", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!12, !10, i64 200}
!18 = !{!12, !10, i64 204}
!19 = !{!16, !16, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = !{!12, !16, i64 176}


; 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.R2Vector = type { [2 x double] }
%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }

declare void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84)) 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2GridC2ERKS_iiii(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef nonnull align 8 dereferenceable(208) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %class.R2Vector, align 8
  %8 = alloca %class.R2Affine, align 8
  tail call void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84) %0)
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  invoke void @_ZN8R2AffineC1Ev(ptr noundef nonnull align 8 dereferenceable(84) %9)
          to label %10 unwind label %20

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 184
  store ptr null, ptr %11, align 8, !tbaa !5
  %12 = sub nsw i32 %4, %2
  %13 = add nsw i32 %12, 1
  %14 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 %13, ptr %14, align 8, !tbaa !15
  %15 = sub nsw i32 %5, %3
  %16 = add nsw i32 %15, 1
  %17 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 %16, ptr %17, align 4, !tbaa !15
  %18 = icmp slt i32 %12, -1
  br i1 %18, label %19, label %22

19:                                               ; preds = %10
  store i32 0, ptr %14, align 8, !tbaa !15
  br label %22

20:                                               ; preds = %6
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %96

22:                                               ; preds = %19, %10
  %23 = phi i32 [ 0, %19 ], [ %13, %10 ]
  %24 = icmp slt i32 %15, -1
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  store i32 0, ptr %17, align 4, !tbaa !15
  br label %26

26:                                               ; preds = %25, %22
  %27 = phi i32 [ 0, %25 ], [ %16, %22 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 200
  store i32 %23, ptr %28, align 8, !tbaa !16
  %29 = mul nsw i32 %27, %23
  %30 = getelementptr inbounds i8, ptr %0, i64 204
  store i32 %29, ptr %30, align 4, !tbaa !17
  %31 = icmp eq i32 %29, 0
  br i1 %31, label %.thread, label %32

32:                                               ; preds = %26
  %33 = zext nneg i32 %29 to i64
  %34 = shl nuw nsw i64 %33, 3
  %35 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %34) #7
          to label %.thread unwind label %36

36:                                               ; preds = %._crit_edge55, %32
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %95

.thread:                                          ; preds = %26, %32
  %.sink = phi ptr [ %35, %32 ], [ null, %26 ]
  store ptr %.sink, ptr %11, align 8, !tbaa !5
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %.thread
  %invariant.op = xor i32 %2, -1
  %38 = load i32, ptr %14, align 8, !tbaa !15
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph54.split, label %._crit_edge55

._crit_edge55:                                    ; preds = %._crit_edge, %.lr.ph54, %.thread
  %40 = getelementptr inbounds i8, ptr %1, i64 88
  %41 = invoke noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %9, ptr noundef nonnull align 8 dereferenceable(84) %40)
          to label %75 unwind label %36

.lr.ph54.split:                                   ; preds = %.lr.ph54, %._crit_edge
  %42 = phi i32 [ %55, %._crit_edge ], [ %38, %.lr.ph54 ]
  %.03651 = phi i32 [ %56, %._crit_edge ], [ 0, %.lr.ph54 ]
  %43 = add i32 %.03651, %3
  %44 = icmp sgt i32 %42, 0
  br i1 %44, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph54.split
  %45 = icmp sgt i32 %43, -1
  br i1 %45, label %.lr.ph.split, label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph, %50
  %.03250.us = phi i32 [ %51, %50 ], [ 0, %.lr.ph ]
  %46 = icmp sgt i32 %.03250.us, %invariant.op
  br i1 %46, label %47, label %49

47:                                               ; preds = %.lr.ph.split.us
  %48 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %1)
  br label %49

49:                                               ; preds = %47, %.lr.ph.split.us
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.03250.us, i32 noundef %.03651, double noundef 0.000000e+00)
          to label %50 unwind label %.split.us

50:                                               ; preds = %49
  %51 = add nuw nsw i32 %.03250.us, 1
  %52 = load i32, ptr %14, align 8, !tbaa !15
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !18

.split.us:                                        ; preds = %49
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %95

._crit_edge:                                      ; preds = %50, %71, %.lr.ph54.split
  %55 = phi i32 [ %42, %.lr.ph54.split ], [ %73, %71 ], [ %52, %50 ]
  %56 = add nuw nsw i32 %.03651, 1
  %57 = load i32, ptr %17, align 4, !tbaa !15
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %.lr.ph54.split, label %._crit_edge55, !llvm.loop !20

.lr.ph.split:                                     ; preds = %.lr.ph, %71
  %.03250 = phi i32 [ %72, %71 ], [ 0, %.lr.ph ]
  %59 = add nsw i32 %.03250, %2
  %60 = icmp sgt i32 %59, -1
  br i1 %60, label %61, label %70

61:                                               ; preds = %.lr.ph.split
  %62 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %1)
  %63 = icmp slt i32 %59, %62
  br i1 %63, label %64, label %70

64:                                               ; preds = %61
  %65 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %1)
  %66 = icmp slt i32 %43, %65
  br i1 %66, label %67, label %70

67:                                               ; preds = %64
  %68 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %1, i32 noundef %59, i32 noundef %43)
          to label %70 unwind label %.split

.split:                                           ; preds = %70, %67
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %95

70:                                               ; preds = %67, %64, %61, %.lr.ph.split
  %.0 = phi double [ 0.000000e+00, %64 ], [ 0.000000e+00, %61 ], [ 0.000000e+00, %.lr.ph.split ], [ %68, %67 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.03250, i32 noundef %.03651, double noundef %.0)
          to label %71 unwind label %.split

71:                                               ; preds = %70
  %72 = add nuw nsw i32 %.03250, 1
  %73 = load i32, ptr %14, align 8, !tbaa !15
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph.split, label %._crit_edge, !llvm.loop !18

75:                                               ; preds = %._crit_edge55
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #8
  %76 = sub nsw i32 0, %2
  %77 = sitofp i32 %76 to double
  %78 = sub nsw i32 0, %3
  %79 = sitofp i32 %78 to double
  invoke void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16) %7, double noundef %77, double noundef %79)
          to label %80 unwind label %88

80:                                               ; preds = %75
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %9, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %81 unwind label %88

81:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  %82 = getelementptr inbounds i8, ptr %1, i64 176
  %83 = load double, ptr %82, align 8, !tbaa !22
  %84 = getelementptr inbounds i8, ptr %0, i64 176
  store double %83, ptr %84, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %8) #8
  invoke void @_ZNK8R2Affine7InverseEv(ptr dead_on_unwind nonnull writable sret(%class.R2Affine) align 8 %8, ptr noundef nonnull align 8 dereferenceable(84) %9)
          to label %85 unwind label %90

85:                                               ; preds = %81
  %86 = invoke noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) %8)
          to label %87 unwind label %92

87:                                               ; preds = %85
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %8) #8
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %8) #8
  ret void

88:                                               ; preds = %80, %75
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  br label %95

90:                                               ; preds = %81
  %91 = landingpad { ptr, i32 }
          cleanup
  br label %94

92:                                               ; preds = %85
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %8) #8
  br label %94

94:                                               ; preds = %92, %90
  %.pn = phi { ptr, i32 } [ %93, %92 ], [ %91, %90 ]
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %8) #8
  br label %95

95:                                               ; preds = %.split, %.split.us, %94, %88, %36
  %.pn42 = phi { ptr, i32 } [ %.pn, %94 ], [ %89, %88 ], [ %37, %36 ], [ %69, %.split ], [ %54, %.split.us ]
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %9) #8
  br label %96

96:                                               ; preds = %95, %20
  %.pn42.pn = phi { ptr, i32 } [ %.pn42, %95 ], [ %21, %20 ]
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %0) #8
  resume { ptr, i32 } %.pn42.pn
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef, double noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

declare void @_ZN8R2VectorC1Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R2Affine7InverseEv(ptr dead_on_unwind noalias writable sret(%class.R2Affine) align 8, ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #3 align 2

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 = { 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 = { 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 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 #7 = { builtin allocsize(0) }
attributes #8 = { 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, !14, i64 184}
!6 = !{!"_ZTS6R2Grid", !7, i64 0, !7, i64 88, !13, i64 176, !14, i64 184, !10, i64 192, !12, i64 200, !12, i64 204}
!7 = !{!"_ZTS8R2Affine", !8, i64 0, !9, i64 8, !12, i64 80}
!8 = !{!"_ZTS16R2Transformation"}
!9 = !{!"_ZTS8R3Matrix", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"double", !10, i64 0}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!6, !12, i64 200}
!17 = !{!6, !12, i64 204}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19, !21}
!21 = !{!"llvm.loop.unswitch.partial.disable"}
!22 = !{!6, !13, i64 176}


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