; LLVM IR from jrouwe/JoltPhysics :: TestFramework/Image/LoadTGA.ll (Z7LoadTGARSi)

; 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.JPH::Ref" = type { ptr }
%struct.TGAHeader = type <{ i8, i8, i8, i16, i16, i8, i16, i16, i16, i16, i8, i8 }>
%"class.std::fpos" = type { i64, %struct.__mbstate_t }
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }

@_ZN3JPH5TraceE = external global ptr, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7LoadTGARSi(ptr dead_on_unwind noalias writable sret(%"class.JPH::Ref") align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca %struct.TGAHeader, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.JPH::Ref", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::fpos", align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #9
  store i8 1, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 18, ptr %6) #9
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef %6, i64 noundef 18)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr i8, ptr %28, i64 -24
  %30 = load i64, ptr %29, align 8
  %31 = getelementptr inbounds i8, ptr %27, i64 %30
  %32 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %31)
  br i1 %32, label %33, label %34

33:                                               ; preds = %2
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  store i32 1, ptr %7, align 4
  br label %370

34:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %35 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 10
  %36 = load i8, ptr %35, align 1, !tbaa !13
  %37 = zext i8 %36 to i32
  %38 = add nsw i32 %37, 7
  %39 = ashr i32 %38, 3
  store i32 %39, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  %40 = load i32, ptr %8, align 4, !tbaa !16
  %41 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 8
  %42 = load i16, ptr %41, align 1, !tbaa !18
  %43 = zext i16 %42 to i32
  %44 = mul nsw i32 %40, %43
  store i32 %44, ptr %9, align 4, !tbaa !16
  %45 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 2
  %46 = load i8, ptr %45, align 1, !tbaa !19
  %47 = zext i8 %46 to i32
  %48 = icmp slt i32 %47, 1
  br i1 %48, label %54, label %49

49:                                               ; preds = %34
  %50 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 2
  %51 = load i8, ptr %50, align 1, !tbaa !19
  %52 = zext i8 %51 to i32
  %53 = icmp sgt i32 %52, 2
  br i1 %53, label %54, label %56

54:                                               ; preds = %49, %34
  %55 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !5
  call void (ptr, ...) %55(ptr noundef @.str)
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  store i32 1, ptr %7, align 4
  br label %369

56:                                               ; preds = %49
  %57 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 2
  %58 = load i8, ptr %57, align 1, !tbaa !19
  %59 = zext i8 %58 to i32
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %66

61:                                               ; preds = %56
  %62 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 1
  %63 = load i8, ptr %62, align 1, !tbaa !20
  %64 = zext i8 %63 to i32
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %76, label %66

66:                                               ; preds = %61, %56
  %67 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 2
  %68 = load i8, ptr %67, align 1, !tbaa !19
  %69 = zext i8 %68 to i32
  %70 = icmp eq i32 %69, 2
  br i1 %70, label %71, label %78

71:                                               ; preds = %66
  %72 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 1
  %73 = load i8, ptr %72, align 1, !tbaa !20
  %74 = zext i8 %73 to i32
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %78

76:                                               ; preds = %71, %61
  %77 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !5
  call void (ptr, ...) %77(ptr noundef @.str.1)
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  store i32 1, ptr %7, align 4
  br label %369

78:                                               ; preds = %71, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  call void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %79 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 10
  %80 = load i8, ptr %79, align 1, !tbaa !13
  %81 = zext i8 %80 to i32
  %82 = icmp eq i32 %81, 8
  br i1 %82, label %83, label %270

83:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %84 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 5
  %85 = load i8, ptr %84, align 1, !tbaa !21
  %86 = zext i8 %85 to i32
  switch i32 %86, label %91 [
    i32 15, label %87
    i32 16, label %88
    i32 24, label %89
    i32 32, label %90
  ]

87:                                               ; preds = %83
  store i32 5, ptr %11, align 4, !tbaa !22
  store i32 2, ptr %12, align 4, !tbaa !16
  br label %99

88:                                               ; preds = %83
  store i32 5, ptr %11, align 4, !tbaa !22
  store i32 2, ptr %12, align 4, !tbaa !16
  br label %99

89:                                               ; preds = %83
  store i32 9, ptr %11, align 4, !tbaa !22
  store i32 3, ptr %12, align 4, !tbaa !16
  br label %99

90:                                               ; preds = %83
  store i32 13, ptr %11, align 4, !tbaa !22
  store i32 4, ptr %12, align 4, !tbaa !16
  br label %99

91:                                               ; preds = %83
  %92 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !5
  invoke void (ptr, ...) %92(ptr noundef @.str.2)
          to label %93 unwind label %95

93:                                               ; preds = %91
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %94 unwind label %95

94:                                               ; preds = %93
  store i32 1, ptr %7, align 4
  br label %264

95:                                               ; preds = %105, %99, %93, %91
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %13, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %14, align 4
  br label %269

99:                                               ; preds = %90, %89, %88, %87
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 0
  %102 = load i8, ptr %101, align 1, !tbaa !24
  %103 = zext i8 %102 to i64
  %104 = add i64 18, %103
  invoke void @_ZNSt4fposI11__mbstate_tEC2El(ptr noundef nonnull align 8 dereferenceable(16) %15, i64 noundef %104)
          to label %105 unwind label %95

105:                                              ; preds = %99
  %106 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %107 = load i64, ptr %106, align 8
  %108 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %109 = load i64, ptr %108, align 8
  %110 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgESt4fposI11__mbstate_tE(ptr noundef nonnull align 8 dereferenceable(16) %100, i64 %107, i64 %109)
          to label %111 unwind label %95

111:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %112 = load i32, ptr %12, align 4, !tbaa !16
  %113 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 4
  %114 = load i16, ptr %113, align 1, !tbaa !25
  %115 = zext i16 %114 to i32
  %116 = mul nsw i32 %112, %115
  store i32 %116, ptr %16, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %117 = load i32, ptr %16, align 4, !tbaa !16
  %118 = sext i32 %117 to i64
  %119 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %118) #10
          to label %120 unwind label %168

120:                                              ; preds = %111
  store ptr %119, ptr %17, align 8, !tbaa !5
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = load ptr, ptr %17, align 8, !tbaa !5
  %123 = load i32, ptr %16, align 4, !tbaa !16
  %124 = sext i32 %123 to i64
  %125 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %121, ptr noundef %122, i64 noundef %124)
          to label %126 unwind label %168

126:                                              ; preds = %120
  %127 = load i8, ptr %5, align 1, !tbaa !9, !range !26, !noundef !27
  %128 = trunc i8 %127 to i1
  br i1 %128, label %129, label %138

129:                                              ; preds = %126
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = load ptr, ptr %130, align 8, !tbaa !11
  %132 = getelementptr i8, ptr %131, i64 -24
  %133 = load i64, ptr %132, align 8
  %134 = getelementptr inbounds i8, ptr %130, i64 %133
  %135 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %134)
          to label %136 unwind label %168

136:                                              ; preds = %129
  %137 = xor i1 %135, true
  br label %138

138:                                              ; preds = %136, %126
  %139 = phi i1 [ false, %126 ], [ %137, %136 ]
  %140 = zext i1 %139 to i8
  store i8 %140, ptr %5, align 1, !tbaa !9
  %141 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #10
          to label %142 unwind label %168

142:                                              ; preds = %138
  %143 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 8
  %144 = load i16, ptr %143, align 1, !tbaa !18
  %145 = zext i16 %144 to i32
  %146 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 9
  %147 = load i16, ptr %146, align 1, !tbaa !28
  %148 = zext i16 %147 to i32
  %149 = load i32, ptr %11, align 4, !tbaa !22
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %141, i32 noundef %145, i32 noundef %148, i32 noundef %149, i32 noundef 0)
          to label %150 unwind label %172

150:                                              ; preds = %142
  %151 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef %141)
          to label %152 unwind label %168

152:                                              ; preds = %150
  %153 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %154 unwind label %168

154:                                              ; preds = %152
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %153, i32 noundef 2)
          to label %155 unwind label %168

155:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %156 = load i32, ptr %9, align 4, !tbaa !16
  %157 = sext i32 %156 to i64
  %158 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %157) #10
          to label %159 unwind label %176

159:                                              ; preds = %155
  store ptr %158, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %160 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 9
  %161 = load i16, ptr %160, align 1, !tbaa !28
  %162 = zext i16 %161 to i32
  %163 = sub nsw i32 %162, 1
  store i32 %163, ptr %19, align 4, !tbaa !16
  br label %164

164:                                              ; preds = %248, %159
  %165 = load i32, ptr %19, align 4, !tbaa !16
  %166 = icmp sge i32 %165, 0
  br i1 %166, label %180, label %167

167:                                              ; preds = %164
  store i32 3, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %252

168:                                              ; preds = %154, %152, %150, %138, %129, %120, %111
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %13, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %14, align 4
  br label %268

172:                                              ; preds = %142
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %13, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %141, i64 noundef 64) #11
  br label %268

176:                                              ; preds = %254, %252, %155
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %13, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %14, align 4
  br label %267

180:                                              ; preds = %164
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = load ptr, ptr %18, align 8, !tbaa !5
  %183 = load i32, ptr %9, align 4, !tbaa !16
  %184 = sext i32 %183 to i64
  %185 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %181, ptr noundef %182, i64 noundef %184)
          to label %186 unwind label %214

186:                                              ; preds = %180
  %187 = load i8, ptr %5, align 1, !tbaa !9, !range !26, !noundef !27
  %188 = trunc i8 %187 to i1
  br i1 %188, label %189, label %198

189:                                              ; preds = %186
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = load ptr, ptr %190, align 8, !tbaa !11
  %192 = getelementptr i8, ptr %191, i64 -24
  %193 = load i64, ptr %192, align 8
  %194 = getelementptr inbounds i8, ptr %190, i64 %193
  %195 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %194)
          to label %196 unwind label %214

196:                                              ; preds = %189
  %197 = xor i1 %195, true
  br label %198

198:                                              ; preds = %196, %186
  %199 = phi i1 [ false, %186 ], [ %197, %196 ]
  %200 = zext i1 %199 to i8
  store i8 %200, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %201 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %201, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  %202 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %203 unwind label %218

203:                                              ; preds = %198
  %204 = load i32, ptr %19, align 4, !tbaa !16
  %205 = invoke noundef ptr @_ZN7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %202, i32 noundef %204)
          to label %206 unwind label %218

206:                                              ; preds = %203
  store ptr %205, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 0, ptr %22, align 4, !tbaa !16
  br label %207

207:                                              ; preds = %238, %206
  %208 = load i32, ptr %22, align 4, !tbaa !16
  %209 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 8
  %210 = load i16, ptr %209, align 1, !tbaa !18
  %211 = zext i16 %210 to i32
  %212 = icmp slt i32 %208, %211
  br i1 %212, label %222, label %213

213:                                              ; preds = %207
  store i32 6, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  br label %247

214:                                              ; preds = %189, %180
  %215 = landingpad { ptr, i32 }
          cleanup
  %216 = extractvalue { ptr, i32 } %215, 0
  store ptr %216, ptr %13, align 8
  %217 = extractvalue { ptr, i32 } %215, 1
  store i32 %217, ptr %14, align 4
  br label %251

218:                                              ; preds = %203, %198
  %219 = landingpad { ptr, i32 }
          cleanup
  %220 = extractvalue { ptr, i32 } %219, 0
  store ptr %220, ptr %13, align 8
  %221 = extractvalue { ptr, i32 } %219, 1
  store i32 %221, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  br label %251

222:                                              ; preds = %207
  %223 = load ptr, ptr %21, align 8, !tbaa !5
  %224 = load ptr, ptr %17, align 8, !tbaa !5
  %225 = load ptr, ptr %20, align 8, !tbaa !5
  %226 = load i8, ptr %225, align 1, !tbaa !29
  %227 = zext i8 %226 to i32
  %228 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 3
  %229 = load i16, ptr %228, align 1, !tbaa !30
  %230 = zext i16 %229 to i32
  %231 = sub nsw i32 %227, %230
  %232 = load i32, ptr %12, align 4, !tbaa !16
  %233 = mul nsw i32 %231, %232
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds i8, ptr %224, i64 %234
  %236 = load i32, ptr %12, align 4, !tbaa !16
  %237 = sext i32 %236 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %223, ptr align 1 %235, i64 %237, i1 false)
  br label %238

238:                                              ; preds = %222
  %239 = load i32, ptr %22, align 4, !tbaa !16
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %22, align 4, !tbaa !16
  %241 = load ptr, ptr %20, align 8, !tbaa !5
  %242 = getelementptr inbounds i8, ptr %241, i32 1
  store ptr %242, ptr %20, align 8, !tbaa !5
  %243 = load i32, ptr %12, align 4, !tbaa !16
  %244 = load ptr, ptr %21, align 8, !tbaa !5
  %245 = sext i32 %243 to i64
  %246 = getelementptr inbounds i8, ptr %244, i64 %245
  store ptr %246, ptr %21, align 8, !tbaa !5
  br label %207, !llvm.loop !31

247:                                              ; preds = %213
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  br label %248

248:                                              ; preds = %247
  %249 = load i32, ptr %19, align 4, !tbaa !16
  %250 = add nsw i32 %249, -1
  store i32 %250, ptr %19, align 4, !tbaa !16
  br label %164, !llvm.loop !33

251:                                              ; preds = %218, %214
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %267

252:                                              ; preds = %167
  %253 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %254 unwind label %176

254:                                              ; preds = %252
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %253)
          to label %255 unwind label %176

255:                                              ; preds = %254
  %256 = load ptr, ptr %17, align 8, !tbaa !5
  %257 = icmp eq ptr %256, null
  br i1 %257, label %259, label %258

258:                                              ; preds = %255
  call void @_ZdaPv(ptr noundef %256) #11
  br label %259

259:                                              ; preds = %258, %255
  %260 = load ptr, ptr %18, align 8, !tbaa !5
  %261 = icmp eq ptr %260, null
  br i1 %261, label %263, label %262

262:                                              ; preds = %259
  call void @_ZdaPv(ptr noundef %260) #11
  br label %263

263:                                              ; preds = %262, %259
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  store i32 0, ptr %7, align 4
  br label %264

264:                                              ; preds = %263, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  %265 = load i32, ptr %7, align 4
  switch i32 %265, label %367 [
    i32 0, label %266
  ]

266:                                              ; preds = %264
  br label %355

267:                                              ; preds = %251, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %268

268:                                              ; preds = %267, %172, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %269

269:                                              ; preds = %268, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %368

270:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  %271 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 10
  %272 = load i8, ptr %271, align 1, !tbaa !13
  %273 = zext i8 %272 to i32
  switch i32 %273, label %278 [
    i32 15, label %274
    i32 16, label %275
    i32 24, label %276
    i32 32, label %277
  ]

274:                                              ; preds = %270
  store i32 5, ptr %23, align 4, !tbaa !22
  br label %286

275:                                              ; preds = %270
  store i32 5, ptr %23, align 4, !tbaa !22
  br label %286

276:                                              ; preds = %270
  store i32 9, ptr %23, align 4, !tbaa !22
  br label %286

277:                                              ; preds = %270
  store i32 13, ptr %23, align 4, !tbaa !22
  br label %286

278:                                              ; preds = %270
  %279 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !5
  invoke void (ptr, ...) %279(ptr noundef @.str.3)
          to label %280 unwind label %282

280:                                              ; preds = %278
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %281 unwind label %282

281:                                              ; preds = %280
  store i32 1, ptr %7, align 4
  br label %351

282:                                              ; preds = %349, %347, %301, %299, %297, %286, %280, %278
  %283 = landingpad { ptr, i32 }
          cleanup
  %284 = extractvalue { ptr, i32 } %283, 0
  store ptr %284, ptr %13, align 8
  %285 = extractvalue { ptr, i32 } %283, 1
  store i32 %285, ptr %14, align 4
  br label %354

286:                                              ; preds = %277, %276, %275, %274
  %287 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #10
          to label %288 unwind label %282

288:                                              ; preds = %286
  %289 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 8
  %290 = load i16, ptr %289, align 1, !tbaa !18
  %291 = zext i16 %290 to i32
  %292 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 9
  %293 = load i16, ptr %292, align 1, !tbaa !28
  %294 = zext i16 %293 to i32
  %295 = load i32, ptr %23, align 4, !tbaa !22
  %296 = load i32, ptr %9, align 4, !tbaa !16
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %287, i32 noundef %291, i32 noundef %294, i32 noundef %295, i32 noundef %296)
          to label %297 unwind label %311

297:                                              ; preds = %288
  %298 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef %287)
          to label %299 unwind label %282

299:                                              ; preds = %297
  %300 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %301 unwind label %282

301:                                              ; preds = %299
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %300, i32 noundef 2)
          to label %302 unwind label %282

302:                                              ; preds = %301
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  %303 = getelementptr inbounds %struct.TGAHeader, ptr %6, i32 0, i32 9
  %304 = load i16, ptr %303, align 1, !tbaa !28
  %305 = zext i16 %304 to i32
  %306 = sub nsw i32 %305, 1
  store i32 %306, ptr %24, align 4, !tbaa !16
  br label %307

307:                                              ; preds = %340, %302
  %308 = load i32, ptr %24, align 4, !tbaa !16
  %309 = icmp sge i32 %308, 0
  br i1 %309, label %315, label %310

310:                                              ; preds = %307
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %347

311:                                              ; preds = %288
  %312 = landingpad { ptr, i32 }
          cleanup
  %313 = extractvalue { ptr, i32 } %312, 0
  store ptr %313, ptr %13, align 8
  %314 = extractvalue { ptr, i32 } %312, 1
  store i32 %314, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %287, i64 noundef 64) #11
  br label %354

315:                                              ; preds = %307
  %316 = load ptr, ptr %4, align 8, !tbaa !5
  %317 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %318 unwind label %343

318:                                              ; preds = %315
  %319 = load i32, ptr %24, align 4, !tbaa !16
  %320 = invoke noundef ptr @_ZN7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %317, i32 noundef %319)
          to label %321 unwind label %343

321:                                              ; preds = %318
  %322 = load i32, ptr %9, align 4, !tbaa !16
  %323 = sext i32 %322 to i64
  %324 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %316, ptr noundef %320, i64 noundef %323)
          to label %325 unwind label %343

325:                                              ; preds = %321
  %326 = load i8, ptr %5, align 1, !tbaa !9, !range !26, !noundef !27
  %327 = trunc i8 %326 to i1
  br i1 %327, label %328, label %337

328:                                              ; preds = %325
  %329 = load ptr, ptr %4, align 8, !tbaa !5
  %330 = load ptr, ptr %329, align 8, !tbaa !11
  %331 = getelementptr i8, ptr %330, i64 -24
  %332 = load i64, ptr %331, align 8
  %333 = getelementptr inbounds i8, ptr %329, i64 %332
  %334 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %333)
          to label %335 unwind label %343

335:                                              ; preds = %328
  %336 = xor i1 %334, true
  br label %337

337:                                              ; preds = %335, %325
  %338 = phi i1 [ false, %325 ], [ %336, %335 ]
  %339 = zext i1 %338 to i8
  store i8 %339, ptr %5, align 1, !tbaa !9
  br label %340

340:                                              ; preds = %337
  %341 = load i32, ptr %24, align 4, !tbaa !16
  %342 = add nsw i32 %341, -1
  store i32 %342, ptr %24, align 4, !tbaa !16
  br label %307, !llvm.loop !34

343:                                              ; preds = %328, %321, %318, %315
  %344 = landingpad { ptr, i32 }
          cleanup
  %345 = extractvalue { ptr, i32 } %344, 0
  store ptr %345, ptr %13, align 8
  %346 = extractvalue { ptr, i32 } %344, 1
  store i32 %346, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %354

347:                                              ; preds = %310
  %348 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %349 unwind label %282

349:                                              ; preds = %347
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %348)
          to label %350 unwind label %282

350:                                              ; preds = %349
  store i32 0, ptr %7, align 4
  br label %351

351:                                              ; preds = %350, %281
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  %352 = load i32, ptr %7, align 4
  switch i32 %352, label %367 [
    i32 0, label %353
  ]

353:                                              ; preds = %351
  br label %355

354:                                              ; preds = %343, %311, %282
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %368

355:                                              ; preds = %353, %266
  %356 = load i8, ptr %5, align 1, !tbaa !9, !range !26, !noundef !27
  %357 = trunc i8 %356 to i1
  br i1 %357, label %358, label %360

358:                                              ; preds = %355
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %359 unwind label %363

359:                                              ; preds = %358
  br label %362

360:                                              ; preds = %355
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %361 unwind label %363

361:                                              ; preds = %360
  br label %362

362:                                              ; preds = %361, %359
  store i32 1, ptr %7, align 4
  br label %367

363:                                              ; preds = %360, %358
  %364 = landingpad { ptr, i32 }
          cleanup
  %365 = extractvalue { ptr, i32 } %364, 0
  store ptr %365, ptr %13, align 8
  %366 = extractvalue { ptr, i32 } %364, 1
  store i32 %366, ptr %14, align 4
  br label %368

367:                                              ; preds = %362, %351, %264
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %369

368:                                              ; preds = %363, %354, %269
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 18, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #9
  br label %371

369:                                              ; preds = %367, %76, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %370

370:                                              ; preds = %369, %33
  call void @llvm.lifetime.end.p0(i64 18, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #9
  ret void

371:                                              ; preds = %368
  %372 = load ptr, ptr %13, align 8
  %373 = load i32, ptr %14, align 4
  %374 = insertvalue { ptr, i32 } poison, ptr %372, 0
  %375 = insertvalue { ptr, i32 } %374, i32 %373, 1
  resume { ptr, i32 } %375
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgESt4fposI11__mbstate_tE(ptr noundef nonnull align 8 dereferenceable(16), i64, i64) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4fposI11__mbstate_tEC2El(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #5 align 2

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

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

declare void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

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

declare void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #3 align 2

; 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) #8

declare void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48)) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 align 2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !7, i64 16}
!14 = !{!"_ZTS9TGAHeader", !7, i64 0, !7, i64 1, !7, i64 2, !15, i64 3, !15, i64 5, !7, i64 7, !15, i64 8, !15, i64 10, !15, i64 12, !15, i64 14, !7, i64 16, !7, i64 17}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!14, !15, i64 12}
!19 = !{!14, !7, i64 2}
!20 = !{!14, !7, i64 1}
!21 = !{!14, !7, i64 7}
!22 = !{!23, !23, i64 0}
!23 = !{!"_ZTS14ESurfaceFormat", !7, i64 0}
!24 = !{!14, !7, i64 0}
!25 = !{!14, !15, i64 5}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!14, !15, i64 14}
!29 = !{!7, !7, i64 0}
!30 = !{!14, !15, i64 3}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}
!34 = distinct !{!34, !32}


; 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.JPH::Ref" = type { ptr }
%struct.TGAHeader = type <{ i8, i8, i8, i16, i16, i8, i16, i16, i16, i16, i8, i8 }>
%"class.std::fpos" = type { i64, %struct.__mbstate_t }
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }

@_ZN3JPH5TraceE = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7LoadTGARSi(ptr dead_on_unwind noalias writable sret(%"class.JPH::Ref") align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.TGAHeader, align 1
  %4 = alloca %"class.JPH::Ref", align 8
  %5 = alloca %"class.std::fpos", align 8
  call void @llvm.lifetime.start.p0(i64 18, ptr nonnull %3) #9
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %3, i64 noundef 18)
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr %1, i64 %9
  %11 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %10)
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  br label %187

13:                                               ; preds = %2
  %14 = getelementptr inbounds i8, ptr %3, i64 16
  %15 = load i8, ptr %14, align 1, !tbaa !8
  %16 = zext i8 %15 to i32
  %17 = add nuw nsw i32 %16, 7
  %18 = lshr i32 %17, 3
  %19 = getelementptr inbounds i8, ptr %3, i64 12
  %20 = load i16, ptr %19, align 1, !tbaa !12
  %21 = zext i16 %20 to i32
  %22 = mul nuw nsw i32 %18, %21
  %23 = getelementptr inbounds i8, ptr %3, i64 2
  %24 = load i8, ptr %23, align 1
  %25 = add i8 %24, -3
  %or.cond = icmp ult i8 %25, -2
  br i1 %or.cond, label %26, label %28

26:                                               ; preds = %13
  %27 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !13
  call void (ptr, ...) %27(ptr noundef nonnull @.str)
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  br label %187

28:                                               ; preds = %13
  %29 = icmp eq i8 %24, 1
  %30 = getelementptr inbounds i8, ptr %3, i64 1
  %31 = load i8, ptr %30, align 1
  %32 = icmp ne i8 %31, 1
  %or.cond8 = select i1 %29, i1 %32, i1 false
  br i1 %or.cond8, label %36, label %33

33:                                               ; preds = %28
  %34 = icmp eq i8 %24, 2
  %35 = icmp ne i8 %31, 0
  %or.cond12 = select i1 %34, i1 %35, i1 false
  br i1 %or.cond12, label %36, label %38

36:                                               ; preds = %33, %28
  %37 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !13
  call void (ptr, ...) %37(ptr noundef nonnull @.str.1)
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  br label %187

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  call void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %39 = load i8, ptr %14, align 1, !tbaa !8
  switch i8 %39, label %138 [
    i8 8, label %40
    i8 15, label %143
    i8 16, label %143
    i8 24, label %136
    i8 32, label %137
  ]

40:                                               ; preds = %38
  %41 = getelementptr inbounds i8, ptr %3, i64 7
  %42 = load i8, ptr %41, align 1, !tbaa !15
  switch i8 %42, label %45 [
    i8 15, label %50
    i8 16, label %50
    i8 24, label %43
    i8 32, label %44
  ]

43:                                               ; preds = %40
  br label %50

44:                                               ; preds = %40
  br label %50

45:                                               ; preds = %40
  %46 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !13
  invoke void (ptr, ...) %46(ptr noundef nonnull @.str.2)
          to label %47 unwind label %48

47:                                               ; preds = %45
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %185 unwind label %48

48:                                               ; preds = %50, %47, %45
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %186

50:                                               ; preds = %40, %40, %44, %43
  %.079 = phi i32 [ 4, %44 ], [ 3, %43 ], [ 2, %40 ], [ 2, %40 ]
  %.067 = phi i32 [ 13, %44 ], [ 9, %43 ], [ 5, %40 ], [ 5, %40 ]
  %51 = load i8, ptr %3, align 1, !tbaa !16
  %52 = zext i8 %51 to i64
  %53 = add nuw nsw i64 %52, 18
  call void @_ZNSt4fposI11__mbstate_tEC2El(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %53)
  %54 = load i64, ptr %5, align 8
  %55 = getelementptr inbounds i8, ptr %5, i64 8
  %56 = load i64, ptr %55, align 8
  %57 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgESt4fposI11__mbstate_tE(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 %54, i64 %56)
          to label %58 unwind label %48

58:                                               ; preds = %50
  %59 = getelementptr inbounds i8, ptr %3, i64 5
  %60 = load i16, ptr %59, align 1, !tbaa !17
  %61 = zext i16 %60 to i32
  %62 = mul nuw nsw i32 %.079, %61
  %63 = zext nneg i32 %62 to i64
  %64 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %63) #10
          to label %65 unwind label %96

65:                                               ; preds = %58
  %66 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %64, i64 noundef %63)
          to label %67 unwind label %96

67:                                               ; preds = %65
  %68 = load ptr, ptr %1, align 8, !tbaa !5
  %69 = getelementptr i8, ptr %68, i64 -24
  %70 = load i64, ptr %69, align 8
  %71 = getelementptr inbounds i8, ptr %1, i64 %70
  %72 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %71)
          to label %73 unwind label %96

73:                                               ; preds = %67
  %74 = xor i1 %72, true
  %75 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #10
          to label %76 unwind label %96

76:                                               ; preds = %73
  %77 = load i16, ptr %19, align 1, !tbaa !12
  %78 = zext i16 %77 to i32
  %79 = getelementptr inbounds i8, ptr %3, i64 14
  %80 = load i16, ptr %79, align 1, !tbaa !18
  %81 = zext i16 %80 to i32
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %75, i32 noundef %78, i32 noundef %81, i32 noundef %.067, i32 noundef 0)
          to label %82 unwind label %98

82:                                               ; preds = %76
  %83 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull %75)
          to label %84 unwind label %96

84:                                               ; preds = %82
  %85 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %85, i32 noundef 2)
          to label %86 unwind label %96

86:                                               ; preds = %84
  %87 = zext nneg i32 %22 to i64
  %88 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %87) #10
          to label %89 unwind label %100

89:                                               ; preds = %86
  %90 = load i16, ptr %79, align 1, !tbaa !18
  %.not113 = icmp eq i16 %90, 0
  br i1 %.not113, label %._crit_edge111, label %.lr.ph110

.lr.ph110:                                        ; preds = %89
  %91 = zext i16 %90 to i32
  %92 = getelementptr inbounds i8, ptr %3, i64 3
  %93 = zext nneg i32 %.079 to i64
  br label %102

.loopexit:                                        ; preds = %.lr.ph105, %.preheader
  %94 = icmp sgt i32 %.063108.in, 1
  br i1 %94, label %102, label %._crit_edge111, !llvm.loop !19

._crit_edge111:                                   ; preds = %.loopexit, %89
  %.064.in.lcssa = phi i1 [ %74, %89 ], [ %114, %.loopexit ]
  %95 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %95)
          to label %.thread unwind label %100

96:                                               ; preds = %84, %82, %73, %67, %65, %58
  %97 = landingpad { ptr, i32 }
          cleanup
  br label %186

98:                                               ; preds = %76
  %99 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %75, i64 noundef 64) #11
  br label %186

100:                                              ; preds = %._crit_edge111, %86
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %186

102:                                              ; preds = %.lr.ph110, %.loopexit
  %.063108.in = phi i32 [ %91, %.lr.ph110 ], [ %.063108, %.loopexit ]
  %.064.in107 = phi i1 [ %74, %.lr.ph110 ], [ %114, %.loopexit ]
  %.063108 = add nsw i32 %.063108.in, -1
  %103 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %88, i64 noundef %87)
          to label %104 unwind label %118

104:                                              ; preds = %102
  br i1 %.064.in107, label %105, label %113

105:                                              ; preds = %104
  %106 = load ptr, ptr %1, align 8, !tbaa !5
  %107 = getelementptr i8, ptr %106, i64 -24
  %108 = load i64, ptr %107, align 8
  %109 = getelementptr inbounds i8, ptr %1, i64 %108
  %110 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %109)
          to label %111 unwind label %118

111:                                              ; preds = %105
  %112 = xor i1 %110, true
  br label %113

113:                                              ; preds = %111, %104
  %114 = phi i1 [ false, %104 ], [ %112, %111 ]
  %115 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %116 = invoke noundef ptr @_ZN7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %115, i32 noundef %.063108)
          to label %.preheader unwind label %120

.preheader:                                       ; preds = %113
  %117 = load i16, ptr %19, align 1, !tbaa !12
  %.not114 = icmp eq i16 %117, 0
  br i1 %.not114, label %.loopexit, label %.lr.ph105

118:                                              ; preds = %105, %102
  %119 = landingpad { ptr, i32 }
          cleanup
  br label %186

120:                                              ; preds = %113
  %121 = landingpad { ptr, i32 }
          cleanup
  br label %186

.lr.ph105:                                        ; preds = %.preheader, %.lr.ph105
  %.060104 = phi i32 [ %130, %.lr.ph105 ], [ 0, %.preheader ]
  %.061103 = phi ptr [ %132, %.lr.ph105 ], [ %116, %.preheader ]
  %.062102 = phi ptr [ %131, %.lr.ph105 ], [ %88, %.preheader ]
  %122 = load i8, ptr %.062102, align 1, !tbaa !21
  %123 = zext i8 %122 to i32
  %124 = load i16, ptr %92, align 1, !tbaa !22
  %125 = zext i16 %124 to i32
  %126 = sub nsw i32 %123, %125
  %127 = mul nsw i32 %126, %.079
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i8, ptr %64, i64 %128
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %.061103, ptr noundef nonnull align 1 dereferenceable(1) %129, i64 %93, i1 false)
  %130 = add nuw nsw i32 %.060104, 1
  %131 = getelementptr inbounds i8, ptr %.062102, i64 1
  %132 = getelementptr inbounds i8, ptr %.061103, i64 %93
  %133 = load i16, ptr %19, align 1, !tbaa !12
  %134 = zext i16 %133 to i32
  %135 = icmp ult i32 %130, %134
  br i1 %135, label %.lr.ph105, label %.loopexit, !llvm.loop !23

.thread:                                          ; preds = %._crit_edge111
  call void @_ZdaPv(ptr noundef nonnull %64) #11
  call void @_ZdaPv(ptr noundef nonnull %88) #11
  br i1 %.064.in.lcssa, label %181, label %182

136:                                              ; preds = %38
  br label %143

137:                                              ; preds = %38
  br label %143

138:                                              ; preds = %38
  %139 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !13
  invoke void (ptr, ...) %139(ptr noundef nonnull @.str.3)
          to label %140 unwind label %141

140:                                              ; preds = %138
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %185 unwind label %141

141:                                              ; preds = %._crit_edge, %153, %151, %143, %140, %138
  %142 = landingpad { ptr, i32 }
          cleanup
  br label %186

143:                                              ; preds = %38, %38, %137, %136
  %.059 = phi i32 [ 13, %137 ], [ 9, %136 ], [ 5, %38 ], [ 5, %38 ]
  %144 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #10
          to label %145 unwind label %141

145:                                              ; preds = %143
  %146 = load i16, ptr %19, align 1, !tbaa !12
  %147 = zext i16 %146 to i32
  %148 = getelementptr inbounds i8, ptr %3, i64 14
  %149 = load i16, ptr %148, align 1, !tbaa !18
  %150 = zext i16 %149 to i32
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %144, i32 noundef %147, i32 noundef %150, i32 noundef %.059, i32 noundef %22)
          to label %151 unwind label %160

151:                                              ; preds = %145
  %152 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull %144)
          to label %153 unwind label %141

153:                                              ; preds = %151
  %154 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %154, i32 noundef 2)
          to label %155 unwind label %141

155:                                              ; preds = %153
  %156 = load i16, ptr %148, align 1, !tbaa !18
  %.not = icmp eq i16 %156, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %155
  %157 = zext i16 %156 to i32
  %158 = zext nneg i32 %22 to i64
  br label %162

._crit_edge:                                      ; preds = %176, %155
  %.2.lcssa = phi i1 [ true, %155 ], [ %177, %176 ]
  %159 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %159)
          to label %.thread93 unwind label %141

160:                                              ; preds = %145
  %161 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %144, i64 noundef 64) #11
  br label %186

162:                                              ; preds = %.lr.ph, %176
  %.0101.in = phi i32 [ %157, %.lr.ph ], [ %.0101, %176 ]
  %.2100 = phi i1 [ true, %.lr.ph ], [ %177, %176 ]
  %.0101 = add nsw i32 %.0101.in, -1
  %163 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %164 = invoke noundef ptr @_ZN7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %163, i32 noundef %.0101)
          to label %165 unwind label %179

165:                                              ; preds = %162
  %166 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef %164, i64 noundef %158)
          to label %167 unwind label %179

167:                                              ; preds = %165
  br i1 %.2100, label %168, label %176

168:                                              ; preds = %167
  %169 = load ptr, ptr %1, align 8, !tbaa !5
  %170 = getelementptr i8, ptr %169, i64 -24
  %171 = load i64, ptr %170, align 8
  %172 = getelementptr inbounds i8, ptr %1, i64 %171
  %173 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %172)
          to label %174 unwind label %179

174:                                              ; preds = %168
  %175 = xor i1 %173, true
  br label %176

176:                                              ; preds = %174, %167
  %177 = phi i1 [ false, %167 ], [ %175, %174 ]
  %178 = icmp ugt i32 %.0101.in, 1
  br i1 %178, label %162, label %._crit_edge, !llvm.loop !24

179:                                              ; preds = %168, %165, %162
  %180 = landingpad { ptr, i32 }
          cleanup
  br label %186

.thread93:                                        ; preds = %._crit_edge
  br i1 %.2.lcssa, label %181, label %182

181:                                              ; preds = %.thread, %.thread93
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %185 unwind label %183

182:                                              ; preds = %.thread, %.thread93
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %185 unwind label %183

183:                                              ; preds = %182, %181
  %184 = landingpad { ptr, i32 }
          cleanup
  br label %186

185:                                              ; preds = %140, %47, %181, %182
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br label %187

186:                                              ; preds = %141, %160, %179, %48, %100, %120, %118, %98, %96, %183
  %.pn89 = phi { ptr, i32 } [ %184, %183 ], [ %49, %48 ], [ %97, %96 ], [ %99, %98 ], [ %101, %100 ], [ %121, %120 ], [ %119, %118 ], [ %142, %141 ], [ %180, %179 ], [ %161, %160 ]
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 18, ptr nonnull %3) #9
  resume { ptr, i32 } %.pn89

187:                                              ; preds = %26, %36, %185, %12
  call void @llvm.lifetime.end.p0(i64 18, ptr nonnull %3) #9
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgESt4fposI11__mbstate_tE(ptr noundef nonnull align 8 dereferenceable(16), i64, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4fposI11__mbstate_tEC2El(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #5 align 2

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

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

declare void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #7

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

declare void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress 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) #8

declare void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 #5 = { 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 #6 = { 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 #7 = { nobuiltin 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 16}
!9 = !{!"_ZTS9TGAHeader", !10, i64 0, !10, i64 1, !10, i64 2, !11, i64 3, !11, i64 5, !10, i64 7, !11, i64 8, !11, i64 10, !11, i64 12, !11, i64 14, !10, i64 16, !10, i64 17}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!"short", !10, i64 0}
!12 = !{!9, !11, i64 12}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!9, !10, i64 7}
!16 = !{!9, !10, i64 0}
!17 = !{!9, !11, i64 5}
!18 = !{!9, !11, i64 14}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !10, i64 0}
!22 = !{!9, !11, i64 3}
!23 = distinct !{!23, !20}
!24 = distinct !{!24, !20}


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