; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder (jpgd)

; 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.jpgd::jpeg_decoder" = type <{ [1 x %struct.__jmp_buf_tag], i32, [4 x i8], ptr, i32, i32, ptr, i32, [8 x i8], [4 x i8], [8 x ptr], [8 x ptr], [4 x ptr], i32, i32, [4 x i32], [4 x i32], [4 x i32], [4 x i32], [4 x i32], [4 x i32], i32, [4 x i32], [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, i32, [4 x i8], [8 x ptr], [4 x ptr], [4 x ptr], i32, [4 x i32], [4 x i8], ptr, i32, i32, [64 x i8], [8320 x i8], [64 x i8], i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], ptr, [10 x i32], ptr, ptr, [256 x i32], [256 x i32], [256 x i32], [256 x i32], ptr, ptr, i32, i32, i8, i8, i8, [5 x i8] }>
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4jpgd12jpeg_decoder14begin_decodingEv(ptr noundef nonnull align 8 dereferenceable(13523)) #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN4jpgd33decompress_jpeg_image_from_streamEPNS_19jpeg_decoder_streamEPiS2_S2_ij(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) #3 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.jpgd::jpeg_decoder", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca i8, align 1
  %28 = alloca i32, align 4
  %29 = alloca i8, align 1
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %6
  store ptr null, ptr %7, align 8
  br label %344

41:                                               ; preds = %6
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %42, align 4, !tbaa !9
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %54

45:                                               ; preds = %41
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %54

48:                                               ; preds = %45
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %54

51:                                               ; preds = %48
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %55, label %54

54:                                               ; preds = %51, %48, %45, %41
  store ptr null, ptr %7, align 8
  br label %344

55:                                               ; preds = %51
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = icmp ne i32 %56, 1
  br i1 %57, label %58, label %65

58:                                               ; preds = %55
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 3
  br i1 %60, label %61, label %65

61:                                               ; preds = %58
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = icmp ne i32 %62, 4
  br i1 %63, label %64, label %65

64:                                               ; preds = %61
  store ptr null, ptr %7, align 8
  br label %344

65:                                               ; preds = %61, %58, %55
  call void @llvm.lifetime.start.p0(i64 13528, ptr %14) #4
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load i32, ptr %13, align 4, !tbaa !9
  call void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamEj(ptr noundef nonnull align 8 dereferenceable(13523) %14, ptr noundef %66, i32 noundef %67)
  %68 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %69 unwind label %72

69:                                               ; preds = %65
  %70 = icmp ne i32 %68, 0
  br i1 %70, label %71, label %76

71:                                               ; preds = %69
  store ptr null, ptr %7, align 8
  store i32 1, ptr %17, align 4
  br label %342

72:                                               ; preds = %65
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %15, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %16, align 4
  br label %343

76:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %77 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder9get_widthEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %78 unwind label %92

78:                                               ; preds = %76
  store i32 %77, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %79 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder10get_heightEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %80 unwind label %96

80:                                               ; preds = %78
  store i32 %79, ptr %19, align 4, !tbaa !9
  %81 = load i32, ptr %18, align 4, !tbaa !9
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %81, ptr %82, align 4, !tbaa !9
  %83 = load i32, ptr %19, align 4, !tbaa !9
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %83, ptr %84, align 4, !tbaa !9
  %85 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %86 unwind label %96

86:                                               ; preds = %80
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %85, ptr %87, align 4, !tbaa !9
  %88 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder14begin_decodingEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %89 unwind label %96

89:                                               ; preds = %86
  %90 = icmp ne i32 %88, 0
  br i1 %90, label %91, label %100

91:                                               ; preds = %89
  store ptr null, ptr %7, align 8
  store i32 1, ptr %17, align 4
  br label %339

92:                                               ; preds = %76
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %15, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %16, align 4
  br label %341

96:                                               ; preds = %86, %80, %78
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %15, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %16, align 4
  br label %340

100:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %101 = load i32, ptr %18, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = mul nsw i32 %101, %102
  store i32 %103, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %104 = load i32, ptr %20, align 4, !tbaa !9
  %105 = load i32, ptr %19, align 4, !tbaa !9
  %106 = mul nsw i32 %104, %105
  %107 = sext i32 %106 to i64
  %108 = invoke noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef %107)
          to label %109 unwind label %113

109:                                              ; preds = %100
  store ptr %108, ptr %21, align 8, !tbaa !5
  %110 = load ptr, ptr %21, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %117, label %112

112:                                              ; preds = %109
  store ptr null, ptr %7, align 8
  store i32 1, ptr %17, align 4
  br label %337

113:                                              ; preds = %100
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %15, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %16, align 4
  br label %338

117:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %329, %117
  %119 = load i32, ptr %22, align 4, !tbaa !9
  %120 = load i32, ptr %19, align 4, !tbaa !9
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 2, ptr %17, align 4
  br label %333

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %124 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13523) %14, ptr noundef %23, ptr noundef %24)
          to label %125 unwind label %130

125:                                              ; preds = %123
  %126 = icmp ne i32 %124, 0
  br i1 %126, label %127, label %134

127:                                              ; preds = %125
  %128 = load ptr, ptr %21, align 8, !tbaa !5
  invoke void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef %128)
          to label %129 unwind label %130

129:                                              ; preds = %127
  store ptr null, ptr %7, align 8
  store i32 1, ptr %17, align 4
  br label %326

130:                                              ; preds = %127, %123
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %15, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %16, align 4
  br label %332

134:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %135 = load ptr, ptr %21, align 8, !tbaa !5
  %136 = load i32, ptr %22, align 4, !tbaa !9
  %137 = load i32, ptr %20, align 4, !tbaa !9
  %138 = mul nsw i32 %136, %137
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds i8, ptr %135, i64 %139
  store ptr %140, ptr %25, align 8, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !9
  %142 = icmp eq i32 %141, 1
  br i1 %142, label %143, label %147

143:                                              ; preds = %134
  %144 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %145 unwind label %159

145:                                              ; preds = %143
  %146 = icmp eq i32 %144, 1
  br i1 %146, label %154, label %147

147:                                              ; preds = %145, %134
  %148 = load i32, ptr %12, align 4, !tbaa !9
  %149 = icmp eq i32 %148, 4
  br i1 %149, label %150, label %163

150:                                              ; preds = %147
  %151 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %152 unwind label %159

152:                                              ; preds = %150
  %153 = icmp eq i32 %151, 3
  br i1 %153, label %154, label %163

154:                                              ; preds = %152, %145
  %155 = load ptr, ptr %25, align 8, !tbaa !5
  %156 = load ptr, ptr %23, align 8, !tbaa !5
  %157 = load i32, ptr %20, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %155, ptr align 1 %156, i64 %158, i1 false)
  br label %325

159:                                              ; preds = %227, %163, %150, %143
  %160 = landingpad { ptr, i32 }
          cleanup
  %161 = extractvalue { ptr, i32 } %160, 0
  store ptr %161, ptr %15, align 8
  %162 = extractvalue { ptr, i32 } %160, 1
  store i32 %162, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  br label %332

163:                                              ; preds = %152, %147
  %164 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %165 unwind label %159

165:                                              ; preds = %163
  %166 = icmp eq i32 %164, 1
  br i1 %166, label %167, label %227

167:                                              ; preds = %165
  %168 = load i32, ptr %12, align 4, !tbaa !9
  %169 = icmp eq i32 %168, 3
  br i1 %169, label %170, label %197

170:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %193, %170
  %172 = load i32, ptr %26, align 4, !tbaa !9
  %173 = load i32, ptr %18, align 4, !tbaa !9
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %176, label %175

175:                                              ; preds = %171
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  br label %196

176:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #4
  %177 = load ptr, ptr %23, align 8, !tbaa !5
  %178 = load i32, ptr %26, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i8, ptr %177, i64 %179
  %181 = load i8, ptr %180, align 1, !tbaa !11
  store i8 %181, ptr %27, align 1, !tbaa !11
  %182 = load i8, ptr %27, align 1, !tbaa !11
  %183 = load ptr, ptr %25, align 8, !tbaa !5
  %184 = getelementptr inbounds i8, ptr %183, i64 0
  store i8 %182, ptr %184, align 1, !tbaa !11
  %185 = load i8, ptr %27, align 1, !tbaa !11
  %186 = load ptr, ptr %25, align 8, !tbaa !5
  %187 = getelementptr inbounds i8, ptr %186, i64 1
  store i8 %185, ptr %187, align 1, !tbaa !11
  %188 = load i8, ptr %27, align 1, !tbaa !11
  %189 = load ptr, ptr %25, align 8, !tbaa !5
  %190 = getelementptr inbounds i8, ptr %189, i64 2
  store i8 %188, ptr %190, align 1, !tbaa !11
  %191 = load ptr, ptr %25, align 8, !tbaa !5
  %192 = getelementptr inbounds i8, ptr %191, i64 3
  store ptr %192, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #4
  br label %193

193:                                              ; preds = %176
  %194 = load i32, ptr %26, align 4, !tbaa !9
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %26, align 4, !tbaa !9
  br label %171, !llvm.loop !12

196:                                              ; preds = %175
  br label %226

197:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  store i32 0, ptr %28, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %222, %197
  %199 = load i32, ptr %28, align 4, !tbaa !9
  %200 = load i32, ptr %18, align 4, !tbaa !9
  %201 = icmp slt i32 %199, %200
  br i1 %201, label %203, label %202

202:                                              ; preds = %198
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  br label %225

203:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #4
  %204 = load ptr, ptr %23, align 8, !tbaa !5
  %205 = load i32, ptr %28, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds i8, ptr %204, i64 %206
  %208 = load i8, ptr %207, align 1, !tbaa !11
  store i8 %208, ptr %29, align 1, !tbaa !11
  %209 = load i8, ptr %29, align 1, !tbaa !11
  %210 = load ptr, ptr %25, align 8, !tbaa !5
  %211 = getelementptr inbounds i8, ptr %210, i64 0
  store i8 %209, ptr %211, align 1, !tbaa !11
  %212 = load i8, ptr %29, align 1, !tbaa !11
  %213 = load ptr, ptr %25, align 8, !tbaa !5
  %214 = getelementptr inbounds i8, ptr %213, i64 1
  store i8 %212, ptr %214, align 1, !tbaa !11
  %215 = load i8, ptr %29, align 1, !tbaa !11
  %216 = load ptr, ptr %25, align 8, !tbaa !5
  %217 = getelementptr inbounds i8, ptr %216, i64 2
  store i8 %215, ptr %217, align 1, !tbaa !11
  %218 = load ptr, ptr %25, align 8, !tbaa !5
  %219 = getelementptr inbounds i8, ptr %218, i64 3
  store i8 -1, ptr %219, align 1, !tbaa !11
  %220 = load ptr, ptr %25, align 8, !tbaa !5
  %221 = getelementptr inbounds i8, ptr %220, i64 4
  store ptr %221, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #4
  br label %222

222:                                              ; preds = %203
  %223 = load i32, ptr %28, align 4, !tbaa !9
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %28, align 4, !tbaa !9
  br label %198, !llvm.loop !14

225:                                              ; preds = %202
  br label %226

226:                                              ; preds = %225, %196
  br label %324

227:                                              ; preds = %165
  %228 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %14)
          to label %229 unwind label %159

229:                                              ; preds = %227
  %230 = icmp eq i32 %228, 3
  br i1 %230, label %231, label %323

231:                                              ; preds = %229
  %232 = load i32, ptr %12, align 4, !tbaa !9
  %233 = icmp eq i32 %232, 1
  br i1 %233, label %234, label %282

234:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #4
  store i32 19595, ptr %30, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #4
  store i32 38470, ptr %31, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #4
  store i32 7471, ptr %32, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #4
  store i32 0, ptr %33, align 4, !tbaa !9
  br label %235

235:                                              ; preds = %278, %234
  %236 = load i32, ptr %33, align 4, !tbaa !9
  %237 = load i32, ptr %18, align 4, !tbaa !9
  %238 = icmp slt i32 %236, %237
  br i1 %238, label %240, label %239

239:                                              ; preds = %235
  store i32 11, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #4
  br label %281

240:                                              ; preds = %235
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #4
  %241 = load ptr, ptr %23, align 8, !tbaa !5
  %242 = load i32, ptr %33, align 4, !tbaa !9
  %243 = mul nsw i32 %242, 4
  %244 = add nsw i32 %243, 0
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds i8, ptr %241, i64 %245
  %247 = load i8, ptr %246, align 1, !tbaa !11
  %248 = zext i8 %247 to i32
  store i32 %248, ptr %34, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #4
  %249 = load ptr, ptr %23, align 8, !tbaa !5
  %250 = load i32, ptr %33, align 4, !tbaa !9
  %251 = mul nsw i32 %250, 4
  %252 = add nsw i32 %251, 1
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds i8, ptr %249, i64 %253
  %255 = load i8, ptr %254, align 1, !tbaa !11
  %256 = zext i8 %255 to i32
  store i32 %256, ptr %35, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #4
  %257 = load ptr, ptr %23, align 8, !tbaa !5
  %258 = load i32, ptr %33, align 4, !tbaa !9
  %259 = mul nsw i32 %258, 4
  %260 = add nsw i32 %259, 2
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds i8, ptr %257, i64 %261
  %263 = load i8, ptr %262, align 1, !tbaa !11
  %264 = zext i8 %263 to i32
  store i32 %264, ptr %36, align 4, !tbaa !9
  %265 = load i32, ptr %34, align 4, !tbaa !9
  %266 = mul nsw i32 %265, 19595
  %267 = load i32, ptr %35, align 4, !tbaa !9
  %268 = mul nsw i32 %267, 38470
  %269 = add nsw i32 %266, %268
  %270 = load i32, ptr %36, align 4, !tbaa !9
  %271 = mul nsw i32 %270, 7471
  %272 = add nsw i32 %269, %271
  %273 = add nsw i32 %272, 32768
  %274 = ashr i32 %273, 16
  %275 = trunc i32 %274 to i8
  %276 = load ptr, ptr %25, align 8, !tbaa !5
  %277 = getelementptr inbounds i8, ptr %276, i32 1
  store ptr %277, ptr %25, align 8, !tbaa !5
  store i8 %275, ptr %276, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #4
  br label %278

278:                                              ; preds = %240
  %279 = load i32, ptr %33, align 4, !tbaa !9
  %280 = add nsw i32 %279, 1
  store i32 %280, ptr %33, align 4, !tbaa !9
  br label %235, !llvm.loop !15

281:                                              ; preds = %239
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #4
  br label %322

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

283:                                              ; preds = %318, %282
  %284 = load i32, ptr %37, align 4, !tbaa !9
  %285 = load i32, ptr %18, align 4, !tbaa !9
  %286 = icmp slt i32 %284, %285
  br i1 %286, label %288, label %287

287:                                              ; preds = %283
  store i32 14, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #4
  br label %321

288:                                              ; preds = %283
  %289 = load ptr, ptr %23, align 8, !tbaa !5
  %290 = load i32, ptr %37, align 4, !tbaa !9
  %291 = mul nsw i32 %290, 4
  %292 = add nsw i32 %291, 0
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds i8, ptr %289, i64 %293
  %295 = load i8, ptr %294, align 1, !tbaa !11
  %296 = load ptr, ptr %25, align 8, !tbaa !5
  %297 = getelementptr inbounds i8, ptr %296, i64 0
  store i8 %295, ptr %297, align 1, !tbaa !11
  %298 = load ptr, ptr %23, align 8, !tbaa !5
  %299 = load i32, ptr %37, align 4, !tbaa !9
  %300 = mul nsw i32 %299, 4
  %301 = add nsw i32 %300, 1
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds i8, ptr %298, i64 %302
  %304 = load i8, ptr %303, align 1, !tbaa !11
  %305 = load ptr, ptr %25, align 8, !tbaa !5
  %306 = getelementptr inbounds i8, ptr %305, i64 1
  store i8 %304, ptr %306, align 1, !tbaa !11
  %307 = load ptr, ptr %23, align 8, !tbaa !5
  %308 = load i32, ptr %37, align 4, !tbaa !9
  %309 = mul nsw i32 %308, 4
  %310 = add nsw i32 %309, 2
  %311 = sext i32 %310 to i64
  %312 = getelementptr inbounds i8, ptr %307, i64 %311
  %313 = load i8, ptr %312, align 1, !tbaa !11
  %314 = load ptr, ptr %25, align 8, !tbaa !5
  %315 = getelementptr inbounds i8, ptr %314, i64 2
  store i8 %313, ptr %315, align 1, !tbaa !11
  %316 = load ptr, ptr %25, align 8, !tbaa !5
  %317 = getelementptr inbounds i8, ptr %316, i64 3
  store ptr %317, ptr %25, align 8, !tbaa !5
  br label %318

318:                                              ; preds = %288
  %319 = load i32, ptr %37, align 4, !tbaa !9
  %320 = add nsw i32 %319, 1
  store i32 %320, ptr %37, align 4, !tbaa !9
  br label %283, !llvm.loop !16

321:                                              ; preds = %287
  br label %322

322:                                              ; preds = %321, %281
  br label %323

323:                                              ; preds = %322, %229
  br label %324

324:                                              ; preds = %323, %226
  br label %325

325:                                              ; preds = %324, %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  store i32 0, ptr %17, align 4
  br label %326

326:                                              ; preds = %325, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  %327 = load i32, ptr %17, align 4
  switch i32 %327, label %333 [
    i32 0, label %328
  ]

328:                                              ; preds = %326
  br label %329

329:                                              ; preds = %328
  %330 = load i32, ptr %22, align 4, !tbaa !9
  %331 = add nsw i32 %330, 1
  store i32 %331, ptr %22, align 4, !tbaa !9
  br label %118, !llvm.loop !17

332:                                              ; preds = %159, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %338

333:                                              ; preds = %326, %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  %334 = load i32, ptr %17, align 4
  switch i32 %334, label %337 [
    i32 2, label %335
  ]

335:                                              ; preds = %333
  %336 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %336, ptr %7, align 8
  store i32 1, ptr %17, align 4
  br label %337

337:                                              ; preds = %335, %333, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %339

338:                                              ; preds = %332, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %340

339:                                              ; preds = %337, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %342

340:                                              ; preds = %338, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %341

341:                                              ; preds = %340, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %343

342:                                              ; preds = %339, %71
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13523) %14) #4
  call void @llvm.lifetime.end.p0(i64 13528, ptr %14) #4
  br label %344

343:                                              ; preds = %341, %72
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13523) %14) #4
  call void @llvm.lifetime.end.p0(i64 13528, ptr %14) #4
  br label %346

344:                                              ; preds = %342, %64, %54, %40
  %345 = load ptr, ptr %7, align 8
  ret ptr %345

346:                                              ; preds = %343
  %347 = load ptr, ptr %15, align 8
  %348 = load i32, ptr %16, align 4
  %349 = insertvalue { ptr, i32 } poison, ptr %347, 0
  %350 = insertvalue { ptr, i32 } %349, i32 %348, 1
  resume { ptr, i32 } %350
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13523)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder9get_widthEv(ptr noundef nonnull align 8 dereferenceable(13523)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder10get_heightEv(ptr noundef nonnull align 8 dereferenceable(13523)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523)) #1 align 2

declare void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamEj(ptr, ptr, i32)

declare void @_ZN4jpgd12jpeg_decoderD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


; 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.jpgd::jpeg_decoder" = type <{ [1 x %struct.__jmp_buf_tag], i32, [4 x i8], ptr, i32, i32, ptr, i32, [8 x i8], [4 x i8], [8 x ptr], [8 x ptr], [4 x ptr], i32, i32, [4 x i32], [4 x i32], [4 x i32], [4 x i32], [4 x i32], [4 x i32], i32, [4 x i32], [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, i32, [4 x i8], [8 x ptr], [4 x ptr], [4 x ptr], i32, [4 x i32], [4 x i8], ptr, i32, i32, [64 x i8], [8320 x i8], [64 x i8], i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], ptr, [10 x i32], ptr, ptr, [256 x i32], [256 x i32], [256 x i32], [256 x i32], ptr, ptr, i32, i32, i8, i8, i8, [5 x i8] }>
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4jpgd12jpeg_decoder14begin_decodingEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN4jpgd33decompress_jpeg_image_from_streamEPNS_19jpeg_decoder_streamEPiS2_S2_ij(ptr noundef %0, ptr noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.jpgd::jpeg_decoder", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %182, label %10

10:                                               ; preds = %6
  store i32 0, ptr %3, align 4, !tbaa !5
  %11 = icmp ne ptr %0, null
  %12 = icmp ne ptr %1, null
  %or.cond = and i1 %11, %12
  %13 = icmp ne ptr %2, null
  %or.cond4 = and i1 %or.cond, %13
  %14 = icmp ne i32 %4, 0
  %or.cond6 = and i1 %or.cond4, %14
  br i1 %or.cond6, label %15, label %182

15:                                               ; preds = %10
  switch i32 %4, label %182 [
    i32 4, label %16
    i32 3, label %16
    i32 1, label %16
  ]

16:                                               ; preds = %15, %15, %15
  call void @llvm.lifetime.start.p0(i64 13528, ptr nonnull %7) #4
  call void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamEj(ptr noundef nonnull align 8 dereferenceable(13523) %7, ptr noundef nonnull %0, i32 noundef %5)
  %17 = call noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %.not111 = icmp eq i32 %17, 0
  br i1 %.not111, label %18, label %.loopexit126

18:                                               ; preds = %16
  %19 = call noundef i32 @_ZNK4jpgd12jpeg_decoder9get_widthEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %20 = call noundef i32 @_ZNK4jpgd12jpeg_decoder10get_heightEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  store i32 %19, ptr %1, align 4, !tbaa !5
  store i32 %20, ptr %2, align 4, !tbaa !5
  %21 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  store i32 %21, ptr %3, align 4, !tbaa !5
  %22 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder14begin_decodingEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
          to label %23 unwind label %24

23:                                               ; preds = %18
  %.not112 = icmp eq i32 %22, 0
  br i1 %.not112, label %26, label %.loopexit126

24:                                               ; preds = %18
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %181

26:                                               ; preds = %23
  %27 = mul nsw i32 %19, %4
  %28 = mul nsw i32 %27, %20
  %29 = sext i32 %28 to i64
  %30 = call noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef %29)
  %.not113 = icmp eq ptr %30, null
  br i1 %.not113, label %.loopexit126, label %.preheader125

.preheader125:                                    ; preds = %26
  %.not116138 = icmp sgt i32 %20, 0
  br i1 %.not116138, label %.lr.ph140, label %.loopexit126

.lr.ph140:                                        ; preds = %.preheader125
  %31 = icmp eq i32 %4, 1
  %32 = icmp eq i32 %4, 4
  %33 = icmp sgt i32 %19, 0
  %34 = icmp eq i32 %4, 3
  %35 = sext i32 %27 to i64
  %wide.trip.count163 = zext nneg i32 %20 to i64
  %wide.trip.count148 = zext i32 %19 to i64
  %36 = add nsw i64 %wide.trip.count148, -1
  %xtraiter = and i64 %wide.trip.count148, 1
  %37 = icmp eq i64 %36, 0
  %unroll_iter = and i64 %wide.trip.count148, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %xtraiter174 = and i64 %wide.trip.count148, 1
  %38 = icmp eq i64 %36, 0
  %unroll_iter176 = and i64 %wide.trip.count148, 2147483646
  %lcmp.mod175.not = icmp eq i64 %xtraiter174, 0
  %xtraiter178 = and i64 %wide.trip.count148, 3
  %39 = icmp ult i32 %19, 4
  %unroll_iter180 = and i64 %wide.trip.count148, 2147483644
  %lcmp.mod179.not = icmp eq i64 %xtraiter178, 0
  br label %40

40:                                               ; preds = %.lr.ph140, %180
  %indvars.iv160 = phi i64 [ 0, %.lr.ph140 ], [ %indvars.iv.next161, %180 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  %41 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13523) %7, ptr noundef nonnull %8, ptr noundef nonnull %9)
          to label %42 unwind label %43

42:                                               ; preds = %40
  %.not115 = icmp eq i32 %41, 0
  br i1 %.not115, label %45, label %.thread118

.thread118:                                       ; preds = %42
  call void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef nonnull %30)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %.loopexit126

43:                                               ; preds = %40
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %181

45:                                               ; preds = %42
  %46 = mul nsw i64 %indvars.iv160, %35
  %47 = getelementptr inbounds i8, ptr %30, i64 %46
  br i1 %31, label %48, label %51

48:                                               ; preds = %45
  %49 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %55, label %.thread

51:                                               ; preds = %45
  br i1 %32, label %52, label %.thread

52:                                               ; preds = %51
  %53 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %54 = icmp eq i32 %53, 3
  br i1 %54, label %55, label %.thread

55:                                               ; preds = %52, %48
  %56 = load ptr, ptr %8, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %47, ptr align 1 %56, i64 %35, i1 false)
  br label %.thread117

.thread:                                          ; preds = %48, %52, %51
  %57 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %58 = icmp eq i32 %57, 1
  br i1 %58, label %59, label %98

59:                                               ; preds = %.thread
  br i1 %34, label %.preheader, label %.preheader119

.preheader119:                                    ; preds = %59
  br i1 %33, label %.lr.ph134.preheader, label %.loopexit

.lr.ph134.preheader:                              ; preds = %.preheader119
  br i1 %38, label %.loopexit.loopexit171.unr-lcssa, label %.lr.ph134

.preheader:                                       ; preds = %59
  br i1 %33, label %.lr.ph137.preheader, label %.loopexit

.lr.ph137.preheader:                              ; preds = %.preheader
  br i1 %39, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph137

.lr.ph137:                                        ; preds = %.lr.ph137.preheader, %.lr.ph137
  %indvars.iv155 = phi i64 [ %indvars.iv.next156.3, %.lr.ph137 ], [ 0, %.lr.ph137.preheader ]
  %.099136 = phi ptr [ %83, %.lr.ph137 ], [ %47, %.lr.ph137.preheader ]
  %niter181 = phi i64 [ %niter181.next.3, %.lr.ph137 ], [ 0, %.lr.ph137.preheader ]
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = getelementptr inbounds i8, ptr %60, i64 %indvars.iv155
  %62 = load i8, ptr %61, align 1, !tbaa !11
  store i8 %62, ptr %.099136, align 1, !tbaa !11
  %63 = getelementptr inbounds i8, ptr %.099136, i64 1
  store i8 %62, ptr %63, align 1, !tbaa !11
  %64 = getelementptr inbounds i8, ptr %.099136, i64 2
  store i8 %62, ptr %64, align 1, !tbaa !11
  %65 = getelementptr inbounds i8, ptr %.099136, i64 3
  %indvars.iv.next156 = or disjoint i64 %indvars.iv155, 1
  %66 = load ptr, ptr %8, align 8, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %66, i64 %indvars.iv.next156
  %68 = load i8, ptr %67, align 1, !tbaa !11
  store i8 %68, ptr %65, align 1, !tbaa !11
  %69 = getelementptr inbounds i8, ptr %.099136, i64 4
  store i8 %68, ptr %69, align 1, !tbaa !11
  %70 = getelementptr inbounds i8, ptr %.099136, i64 5
  store i8 %68, ptr %70, align 1, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %.099136, i64 6
  %indvars.iv.next156.1 = or disjoint i64 %indvars.iv155, 2
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = getelementptr inbounds i8, ptr %72, i64 %indvars.iv.next156.1
  %74 = load i8, ptr %73, align 1, !tbaa !11
  store i8 %74, ptr %71, align 1, !tbaa !11
  %75 = getelementptr inbounds i8, ptr %.099136, i64 7
  store i8 %74, ptr %75, align 1, !tbaa !11
  %76 = getelementptr inbounds i8, ptr %.099136, i64 8
  store i8 %74, ptr %76, align 1, !tbaa !11
  %77 = getelementptr inbounds i8, ptr %.099136, i64 9
  %indvars.iv.next156.2 = or disjoint i64 %indvars.iv155, 3
  %78 = load ptr, ptr %8, align 8, !tbaa !9
  %79 = getelementptr inbounds i8, ptr %78, i64 %indvars.iv.next156.2
  %80 = load i8, ptr %79, align 1, !tbaa !11
  store i8 %80, ptr %77, align 1, !tbaa !11
  %81 = getelementptr inbounds i8, ptr %.099136, i64 10
  store i8 %80, ptr %81, align 1, !tbaa !11
  %82 = getelementptr inbounds i8, ptr %.099136, i64 11
  store i8 %80, ptr %82, align 1, !tbaa !11
  %83 = getelementptr inbounds i8, ptr %.099136, i64 12
  %indvars.iv.next156.3 = add nuw nsw i64 %indvars.iv155, 4
  %niter181.next.3 = add i64 %niter181, 4
  %niter181.ncmp.3 = icmp eq i64 %niter181.next.3, %unroll_iter180
  br i1 %niter181.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph137, !llvm.loop !12

.lr.ph134:                                        ; preds = %.lr.ph134.preheader, %.lr.ph134
  %indvars.iv150 = phi i64 [ %indvars.iv.next151.1, %.lr.ph134 ], [ 0, %.lr.ph134.preheader ]
  %.1100133 = phi ptr [ %97, %.lr.ph134 ], [ %47, %.lr.ph134.preheader ]
  %niter177 = phi i64 [ %niter177.next.1, %.lr.ph134 ], [ 0, %.lr.ph134.preheader ]
  %84 = load ptr, ptr %8, align 8, !tbaa !9
  %85 = getelementptr inbounds i8, ptr %84, i64 %indvars.iv150
  %86 = load i8, ptr %85, align 1, !tbaa !11
  store i8 %86, ptr %.1100133, align 1, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %.1100133, i64 1
  store i8 %86, ptr %87, align 1, !tbaa !11
  %88 = getelementptr inbounds i8, ptr %.1100133, i64 2
  store i8 %86, ptr %88, align 1, !tbaa !11
  %89 = getelementptr inbounds i8, ptr %.1100133, i64 3
  store i8 -1, ptr %89, align 1, !tbaa !11
  %90 = getelementptr inbounds i8, ptr %.1100133, i64 4
  %indvars.iv.next151 = or disjoint i64 %indvars.iv150, 1
  %91 = load ptr, ptr %8, align 8, !tbaa !9
  %92 = getelementptr inbounds i8, ptr %91, i64 %indvars.iv.next151
  %93 = load i8, ptr %92, align 1, !tbaa !11
  store i8 %93, ptr %90, align 1, !tbaa !11
  %94 = getelementptr inbounds i8, ptr %.1100133, i64 5
  store i8 %93, ptr %94, align 1, !tbaa !11
  %95 = getelementptr inbounds i8, ptr %.1100133, i64 6
  store i8 %93, ptr %95, align 1, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %.1100133, i64 7
  store i8 -1, ptr %96, align 1, !tbaa !11
  %97 = getelementptr inbounds i8, ptr %.1100133, i64 8
  %indvars.iv.next151.1 = add nuw nsw i64 %indvars.iv150, 2
  %niter177.next.1 = add i64 %niter177, 2
  %niter177.ncmp.1 = icmp eq i64 %niter177.next.1, %unroll_iter176
  br i1 %niter177.ncmp.1, label %.loopexit.loopexit171.unr-lcssa, label %.lr.ph134, !llvm.loop !14

98:                                               ; preds = %.thread
  %99 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523) %7)
  %100 = icmp eq i32 %99, 3
  br i1 %100, label %101, label %.thread117

101:                                              ; preds = %98
  br i1 %31, label %.preheader121, label %.preheader123

.preheader123:                                    ; preds = %101
  br i1 %33, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader123
  br i1 %37, label %.loopexit.loopexit173.unr-lcssa, label %.lr.ph

.preheader121:                                    ; preds = %101
  br i1 %33, label %.lr.ph131, label %.loopexit

.lr.ph131:                                        ; preds = %.preheader121, %.lr.ph131
  %indvars.iv145 = phi i64 [ %indvars.iv.next146, %.lr.ph131 ], [ 0, %.preheader121 ]
  %.2101129 = phi ptr [ %123, %.lr.ph131 ], [ %47, %.preheader121 ]
  %102 = load ptr, ptr %8, align 8, !tbaa !9
  %103 = shl nsw i64 %indvars.iv145, 2
  %104 = getelementptr inbounds i8, ptr %102, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = or disjoint i64 %103, 1
  %108 = getelementptr inbounds i8, ptr %102, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = zext i8 %109 to i32
  %111 = or disjoint i64 %103, 2
  %112 = getelementptr inbounds i8, ptr %102, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !11
  %114 = zext i8 %113 to i32
  %115 = mul nuw nsw i32 %106, 19595
  %116 = mul nuw nsw i32 %110, 38470
  %117 = mul nuw nsw i32 %114, 7471
  %118 = add nuw nsw i32 %115, 32768
  %119 = add nuw nsw i32 %118, %116
  %120 = add nuw nsw i32 %119, %117
  %121 = lshr i32 %120, 16
  %122 = trunc nuw i32 %121 to i8
  %123 = getelementptr inbounds i8, ptr %.2101129, i64 1
  store i8 %122, ptr %.2101129, align 1, !tbaa !11
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %exitcond149.not = icmp eq i64 %indvars.iv.next146, %wide.trip.count148
  br i1 %exitcond149.not, label %.loopexit, label %.lr.ph131, !llvm.loop !15

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %.3102127 = phi ptr [ %153, %.lr.ph ], [ %47, %.lr.ph.preheader ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %124 = load ptr, ptr %8, align 8, !tbaa !9
  %125 = shl nsw i64 %indvars.iv, 2
  %126 = getelementptr inbounds i8, ptr %124, i64 %125
  %127 = load i8, ptr %126, align 1, !tbaa !11
  store i8 %127, ptr %.3102127, align 1, !tbaa !11
  %128 = load ptr, ptr %8, align 8, !tbaa !9
  %129 = or disjoint i64 %125, 1
  %130 = getelementptr inbounds i8, ptr %128, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !11
  %132 = getelementptr inbounds i8, ptr %.3102127, i64 1
  store i8 %131, ptr %132, align 1, !tbaa !11
  %133 = load ptr, ptr %8, align 8, !tbaa !9
  %134 = or disjoint i64 %125, 2
  %135 = getelementptr inbounds i8, ptr %133, i64 %134
  %136 = load i8, ptr %135, align 1, !tbaa !11
  %137 = getelementptr inbounds i8, ptr %.3102127, i64 2
  store i8 %136, ptr %137, align 1, !tbaa !11
  %138 = getelementptr inbounds i8, ptr %.3102127, i64 3
  %139 = load ptr, ptr %8, align 8, !tbaa !9
  %indvars.iv.next = shl i64 %indvars.iv, 2
  %140 = or disjoint i64 %indvars.iv.next, 4
  %141 = getelementptr inbounds i8, ptr %139, i64 %140
  %142 = load i8, ptr %141, align 1, !tbaa !11
  store i8 %142, ptr %138, align 1, !tbaa !11
  %143 = load ptr, ptr %8, align 8, !tbaa !9
  %144 = or disjoint i64 %indvars.iv.next, 5
  %145 = getelementptr inbounds i8, ptr %143, i64 %144
  %146 = load i8, ptr %145, align 1, !tbaa !11
  %147 = getelementptr inbounds i8, ptr %.3102127, i64 4
  store i8 %146, ptr %147, align 1, !tbaa !11
  %148 = load ptr, ptr %8, align 8, !tbaa !9
  %149 = or disjoint i64 %indvars.iv.next, 6
  %150 = getelementptr inbounds i8, ptr %148, i64 %149
  %151 = load i8, ptr %150, align 1, !tbaa !11
  %152 = getelementptr inbounds i8, ptr %.3102127, i64 5
  store i8 %151, ptr %152, align 1, !tbaa !11
  %153 = getelementptr inbounds i8, ptr %.3102127, i64 6
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.loopexit.loopexit173.unr-lcssa, label %.lr.ph, !llvm.loop !16

.thread117:                                       ; preds = %55, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %180

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph137, %.lr.ph137.preheader
  %indvars.iv155.unr = phi i64 [ 0, %.lr.ph137.preheader ], [ %indvars.iv.next156.3, %.lr.ph137 ]
  %.099136.unr = phi ptr [ %47, %.lr.ph137.preheader ], [ %83, %.lr.ph137 ]
  br i1 %lcmp.mod179.not, label %.loopexit, label %.lr.ph137.epil

.lr.ph137.epil:                                   ; preds = %.loopexit.loopexit.unr-lcssa, %.lr.ph137.epil
  %indvars.iv155.epil = phi i64 [ %indvars.iv.next156.epil, %.lr.ph137.epil ], [ %indvars.iv155.unr, %.loopexit.loopexit.unr-lcssa ]
  %.099136.epil = phi ptr [ %159, %.lr.ph137.epil ], [ %.099136.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph137.epil ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %154 = load ptr, ptr %8, align 8, !tbaa !9
  %155 = getelementptr inbounds i8, ptr %154, i64 %indvars.iv155.epil
  %156 = load i8, ptr %155, align 1, !tbaa !11
  store i8 %156, ptr %.099136.epil, align 1, !tbaa !11
  %157 = getelementptr inbounds i8, ptr %.099136.epil, i64 1
  store i8 %156, ptr %157, align 1, !tbaa !11
  %158 = getelementptr inbounds i8, ptr %.099136.epil, i64 2
  store i8 %156, ptr %158, align 1, !tbaa !11
  %159 = getelementptr inbounds i8, ptr %.099136.epil, i64 3
  %indvars.iv.next156.epil = add nuw nsw i64 %indvars.iv155.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter178
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.lr.ph137.epil, !llvm.loop !17

.loopexit.loopexit171.unr-lcssa:                  ; preds = %.lr.ph134, %.lr.ph134.preheader
  %indvars.iv150.unr = phi i64 [ 0, %.lr.ph134.preheader ], [ %indvars.iv.next151.1, %.lr.ph134 ]
  %.1100133.unr = phi ptr [ %47, %.lr.ph134.preheader ], [ %97, %.lr.ph134 ]
  br i1 %lcmp.mod175.not, label %.loopexit, label %.lr.ph134.epil

.lr.ph134.epil:                                   ; preds = %.loopexit.loopexit171.unr-lcssa
  %160 = load ptr, ptr %8, align 8, !tbaa !9
  %161 = getelementptr inbounds i8, ptr %160, i64 %indvars.iv150.unr
  %162 = load i8, ptr %161, align 1, !tbaa !11
  store i8 %162, ptr %.1100133.unr, align 1, !tbaa !11
  %163 = getelementptr inbounds i8, ptr %.1100133.unr, i64 1
  store i8 %162, ptr %163, align 1, !tbaa !11
  %164 = getelementptr inbounds i8, ptr %.1100133.unr, i64 2
  store i8 %162, ptr %164, align 1, !tbaa !11
  %165 = getelementptr inbounds i8, ptr %.1100133.unr, i64 3
  store i8 -1, ptr %165, align 1, !tbaa !11
  br label %.loopexit

.loopexit.loopexit173.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %.3102127.unr = phi ptr [ %47, %.lr.ph.preheader ], [ %153, %.lr.ph ]
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.loopexit.loopexit173.unr-lcssa
  %166 = load ptr, ptr %8, align 8, !tbaa !9
  %167 = shl nsw i64 %indvars.iv.unr, 2
  %168 = getelementptr inbounds i8, ptr %166, i64 %167
  %169 = load i8, ptr %168, align 1, !tbaa !11
  store i8 %169, ptr %.3102127.unr, align 1, !tbaa !11
  %170 = load ptr, ptr %8, align 8, !tbaa !9
  %171 = or disjoint i64 %167, 1
  %172 = getelementptr inbounds i8, ptr %170, i64 %171
  %173 = load i8, ptr %172, align 1, !tbaa !11
  %174 = getelementptr inbounds i8, ptr %.3102127.unr, i64 1
  store i8 %173, ptr %174, align 1, !tbaa !11
  %175 = load ptr, ptr %8, align 8, !tbaa !9
  %176 = or disjoint i64 %167, 2
  %177 = getelementptr inbounds i8, ptr %175, i64 %176
  %178 = load i8, ptr %177, align 1, !tbaa !11
  %179 = getelementptr inbounds i8, ptr %.3102127.unr, i64 2
  store i8 %178, ptr %179, align 1, !tbaa !11
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.epil, %.loopexit.loopexit173.unr-lcssa, %.lr.ph131, %.lr.ph134.epil, %.loopexit.loopexit171.unr-lcssa, %.loopexit.loopexit.unr-lcssa, %.lr.ph137.epil, %.preheader123, %.preheader121, %.preheader119, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %180

180:                                              ; preds = %.loopexit, %.thread117
  %indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count163
  br i1 %exitcond164.not, label %.loopexit126, label %40, !llvm.loop !19

181:                                              ; preds = %43, %24
  %.pn = phi { ptr, i32 } [ %44, %43 ], [ %25, %24 ]
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13523) %7) #4
  call void @llvm.lifetime.end.p0(i64 13528, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn

.loopexit126:                                     ; preds = %180, %.preheader125, %.thread118, %23, %26, %16
  %.5 = phi ptr [ null, %16 ], [ null, %23 ], [ null, %26 ], [ null, %.thread118 ], [ %30, %.preheader125 ], [ %30, %180 ]
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13523) %7) #4
  call void @llvm.lifetime.end.p0(i64 13528, ptr nonnull %7) #4
  br label %182

182:                                              ; preds = %15, %10, %6, %.loopexit126
  %.6 = phi ptr [ %.5, %.loopexit126 ], [ null, %6 ], [ null, %10 ], [ null, %15 ]
  ret ptr %.6
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder9get_widthEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder10get_heightEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #1 align 2

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

declare void @_ZN4jpgd12jpeg_decoderD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !13}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass