; LLVM IR from drohmer/cgp :: library/third_party/src/jpeg (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], 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, [8 x ptr], [4 x ptr], [4 x ptr], i32, [4 x i32], [4 x i8], ptr, i32, i32, i8, [128 x i8], [8320 x i8], [128 x i8], [3 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8], i32, [4 x i32], [4 x i8], ptr, [10 x i32], ptr, [256 x i32], [256 x i32], [256 x i32], [256 x i32], ptr, ptr, i32, i8, [3 x i8], i32, [4 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: 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 void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef) #1

; 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(13652), 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(13652)) #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_i(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #3 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.jpgd::jpeg_decoder", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %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 i8, align 1
  %26 = alloca i32, align 4
  %27 = alloca i8, align 1
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %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
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %39, label %38

38:                                               ; preds = %5
  store ptr null, ptr %6, align 8
  br label %341

39:                                               ; preds = %5
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %40, align 4, !tbaa !9
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %52

43:                                               ; preds = %39
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %52

46:                                               ; preds = %43
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %49, %46, %43, %39
  store ptr null, ptr %6, align 8
  br label %341

53:                                               ; preds = %49
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = icmp ne i32 %54, 1
  br i1 %55, label %56, label %63

56:                                               ; preds = %53
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 3
  br i1 %58, label %59, label %63

59:                                               ; preds = %56
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 4
  br i1 %61, label %62, label %63

62:                                               ; preds = %59
  store ptr null, ptr %6, align 8
  br label %341

63:                                               ; preds = %59, %56, %53
  call void @llvm.lifetime.start.p0(i64 13656, ptr %12) #4
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamE(ptr noundef nonnull align 8 dereferenceable(13652) %12, ptr noundef %64)
  %65 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %66 unwind label %69

66:                                               ; preds = %63
  %67 = icmp ne i32 %65, 0
  br i1 %67, label %68, label %73

68:                                               ; preds = %66
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %339

69:                                               ; preds = %63
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %13, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %14, align 4
  br label %340

73:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %74 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder9get_widthEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %75 unwind label %89

75:                                               ; preds = %73
  store i32 %74, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %76 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder10get_heightEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %77 unwind label %93

77:                                               ; preds = %75
  store i32 %76, ptr %17, align 4, !tbaa !9
  %78 = load i32, ptr %16, align 4, !tbaa !9
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %78, ptr %79, align 4, !tbaa !9
  %80 = load i32, ptr %17, align 4, !tbaa !9
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %80, ptr %81, align 4, !tbaa !9
  %82 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %83 unwind label %93

83:                                               ; preds = %77
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %82, ptr %84, align 4, !tbaa !9
  %85 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder14begin_decodingEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %86 unwind label %93

86:                                               ; preds = %83
  %87 = icmp ne i32 %85, 0
  br i1 %87, label %88, label %97

88:                                               ; preds = %86
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %336

89:                                               ; preds = %73
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %13, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %14, align 4
  br label %338

93:                                               ; preds = %83, %77, %75
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %13, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %14, align 4
  br label %337

97:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %98 = load i32, ptr %16, align 4, !tbaa !9
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = mul nsw i32 %98, %99
  store i32 %100, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %101 = load i32, ptr %18, align 4, !tbaa !9
  %102 = load i32, ptr %17, align 4, !tbaa !9
  %103 = mul nsw i32 %101, %102
  %104 = sext i32 %103 to i64
  %105 = invoke noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef %104)
          to label %106 unwind label %110

106:                                              ; preds = %97
  store ptr %105, ptr %19, align 8, !tbaa !5
  %107 = load ptr, ptr %19, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %114, label %109

109:                                              ; preds = %106
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %334

110:                                              ; preds = %97
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %13, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %14, align 4
  br label %335

114:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %115

115:                                              ; preds = %326, %114
  %116 = load i32, ptr %20, align 4, !tbaa !9
  %117 = load i32, ptr %17, align 4, !tbaa !9
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  store i32 2, ptr %15, align 4
  br label %330

120:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %121 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13652) %12, ptr noundef %21, ptr noundef %22)
          to label %122 unwind label %127

122:                                              ; preds = %120
  %123 = icmp ne i32 %121, 0
  br i1 %123, label %124, label %131

124:                                              ; preds = %122
  %125 = load ptr, ptr %19, align 8, !tbaa !5
  invoke void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef %125)
          to label %126 unwind label %127

126:                                              ; preds = %124
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %323

127:                                              ; preds = %124, %120
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %13, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %14, align 4
  br label %329

131:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %132 = load ptr, ptr %19, align 8, !tbaa !5
  %133 = load i32, ptr %20, align 4, !tbaa !9
  %134 = load i32, ptr %18, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i8, ptr %132, i64 %136
  store ptr %137, ptr %23, align 8, !tbaa !5
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = icmp eq i32 %138, 1
  br i1 %139, label %140, label %144

140:                                              ; preds = %131
  %141 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %142 unwind label %156

142:                                              ; preds = %140
  %143 = icmp eq i32 %141, 1
  br i1 %143, label %151, label %144

144:                                              ; preds = %142, %131
  %145 = load i32, ptr %11, align 4, !tbaa !9
  %146 = icmp eq i32 %145, 4
  br i1 %146, label %147, label %160

147:                                              ; preds = %144
  %148 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %149 unwind label %156

149:                                              ; preds = %147
  %150 = icmp eq i32 %148, 3
  br i1 %150, label %151, label %160

151:                                              ; preds = %149, %142
  %152 = load ptr, ptr %23, align 8, !tbaa !5
  %153 = load ptr, ptr %21, align 8, !tbaa !5
  %154 = load i32, ptr %18, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %152, ptr align 1 %153, i64 %155, i1 false)
  br label %322

156:                                              ; preds = %224, %160, %147, %140
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %13, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  br label %329

160:                                              ; preds = %149, %144
  %161 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %162 unwind label %156

162:                                              ; preds = %160
  %163 = icmp eq i32 %161, 1
  br i1 %163, label %164, label %224

164:                                              ; preds = %162
  %165 = load i32, ptr %11, align 4, !tbaa !9
  %166 = icmp eq i32 %165, 3
  br i1 %166, label %167, label %194

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

168:                                              ; preds = %190, %167
  %169 = load i32, ptr %24, align 4, !tbaa !9
  %170 = load i32, ptr %16, align 4, !tbaa !9
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %193

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

190:                                              ; preds = %173
  %191 = load i32, ptr %24, align 4, !tbaa !9
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %24, align 4, !tbaa !9
  br label %168, !llvm.loop !12

193:                                              ; preds = %172
  br label %223

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

195:                                              ; preds = %219, %194
  %196 = load i32, ptr %26, align 4, !tbaa !9
  %197 = load i32, ptr %16, align 4, !tbaa !9
  %198 = icmp slt i32 %196, %197
  br i1 %198, label %200, label %199

199:                                              ; preds = %195
  store i32 8, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  br label %222

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

219:                                              ; preds = %200
  %220 = load i32, ptr %26, align 4, !tbaa !9
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %26, align 4, !tbaa !9
  br label %195, !llvm.loop !14

222:                                              ; preds = %199
  br label %223

223:                                              ; preds = %222, %193
  br label %321

224:                                              ; preds = %162
  %225 = invoke noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %12)
          to label %226 unwind label %156

226:                                              ; preds = %224
  %227 = icmp eq i32 %225, 3
  br i1 %227, label %228, label %320

228:                                              ; preds = %226
  %229 = load i32, ptr %11, align 4, !tbaa !9
  %230 = icmp eq i32 %229, 1
  br i1 %230, label %231, label %279

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

232:                                              ; preds = %275, %231
  %233 = load i32, ptr %31, align 4, !tbaa !9
  %234 = load i32, ptr %16, align 4, !tbaa !9
  %235 = icmp slt i32 %233, %234
  br i1 %235, label %237, label %236

236:                                              ; preds = %232
  store i32 11, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #4
  br label %278

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

275:                                              ; preds = %237
  %276 = load i32, ptr %31, align 4, !tbaa !9
  %277 = add nsw i32 %276, 1
  store i32 %277, ptr %31, align 4, !tbaa !9
  br label %232, !llvm.loop !15

278:                                              ; preds = %236
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  br label %319

279:                                              ; preds = %228
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #4
  store i32 0, ptr %35, align 4, !tbaa !9
  br label %280

280:                                              ; preds = %315, %279
  %281 = load i32, ptr %35, align 4, !tbaa !9
  %282 = load i32, ptr %16, align 4, !tbaa !9
  %283 = icmp slt i32 %281, %282
  br i1 %283, label %285, label %284

284:                                              ; preds = %280
  store i32 14, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #4
  br label %318

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

315:                                              ; preds = %285
  %316 = load i32, ptr %35, align 4, !tbaa !9
  %317 = add nsw i32 %316, 1
  store i32 %317, ptr %35, align 4, !tbaa !9
  br label %280, !llvm.loop !16

318:                                              ; preds = %284
  br label %319

319:                                              ; preds = %318, %278
  br label %320

320:                                              ; preds = %319, %226
  br label %321

321:                                              ; preds = %320, %223
  br label %322

322:                                              ; preds = %321, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  store i32 0, ptr %15, align 4
  br label %323

323:                                              ; preds = %322, %126
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  %324 = load i32, ptr %15, align 4
  switch i32 %324, label %330 [
    i32 0, label %325
  ]

325:                                              ; preds = %323
  br label %326

326:                                              ; preds = %325
  %327 = load i32, ptr %20, align 4, !tbaa !9
  %328 = add nsw i32 %327, 1
  store i32 %328, ptr %20, align 4, !tbaa !9
  br label %115, !llvm.loop !17

329:                                              ; preds = %156, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %335

330:                                              ; preds = %323, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  %331 = load i32, ptr %15, align 4
  switch i32 %331, label %334 [
    i32 2, label %332
  ]

332:                                              ; preds = %330
  %333 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %333, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %334

334:                                              ; preds = %332, %330, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %336

335:                                              ; preds = %329, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %337

336:                                              ; preds = %334, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %339

337:                                              ; preds = %335, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %338

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

339:                                              ; preds = %336, %68
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13652) %12) #4
  call void @llvm.lifetime.end.p0(i64 13656, ptr %12) #4
  br label %341

340:                                              ; preds = %338, %69
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13652) %12) #4
  call void @llvm.lifetime.end.p0(i64 13656, ptr %12) #4
  br label %343

341:                                              ; preds = %339, %62, %52, %38
  %342 = load ptr, ptr %6, align 8
  ret ptr %342

343:                                              ; preds = %340
  %344 = load ptr, ptr %13, align 8
  %345 = load i32, ptr %14, align 4
  %346 = insertvalue { ptr, i32 } poison, ptr %344, 0
  %347 = insertvalue { ptr, i32 } %346, i32 %345, 1
  resume { ptr, i32 } %347
}

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

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

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

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

declare void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamE(ptr, ptr)

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], 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, [8 x ptr], [4 x ptr], [4 x ptr], i32, [4 x i32], [4 x i8], ptr, i32, i32, i8, [128 x i8], [8320 x i8], [128 x i8], [3 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8], i32, [4 x i32], [4 x i8], ptr, [10 x i32], ptr, [256 x i32], [256 x i32], [256 x i32], [256 x i32], ptr, ptr, i32, i8, [3 x i8], i32, [4 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: 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 void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef) local_unnamed_addr #1

; 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(13652), 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(13652)) 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_i(ptr noundef %0, ptr noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3, i32 noundef %4) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.jpgd::jpeg_decoder", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %181, label %9

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

14:                                               ; preds = %9
  switch i32 %4, label %181 [
    i32 4, label %15
    i32 3, label %15
    i32 1, label %15
  ]

15:                                               ; preds = %14, %14, %14
  call void @llvm.lifetime.start.p0(i64 13656, ptr nonnull %6) #4
  call void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamE(ptr noundef nonnull align 8 dereferenceable(13652) %6, ptr noundef nonnull %0)
  %16 = call noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13652) %6)
  %.not110 = icmp eq i32 %16, 0
  br i1 %.not110, label %17, label %.loopexit125

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

22:                                               ; preds = %17
  %.not111 = icmp eq i32 %21, 0
  br i1 %.not111, label %25, label %.loopexit125

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

25:                                               ; preds = %22
  %26 = mul nsw i32 %18, %4
  %27 = mul nsw i32 %26, %19
  %28 = sext i32 %27 to i64
  %29 = call noundef ptr @_ZN4jpgdL11jpgd_mallocEm(i64 noundef %28)
  %.not112 = icmp eq ptr %29, null
  br i1 %.not112, label %.loopexit125, label %.preheader124

.preheader124:                                    ; preds = %25
  %.not115137 = icmp sgt i32 %19, 0
  br i1 %.not115137, label %.lr.ph139, label %.loopexit125

.lr.ph139:                                        ; preds = %.preheader124
  %30 = icmp eq i32 %4, 1
  %31 = icmp eq i32 %4, 4
  %32 = icmp sgt i32 %18, 0
  %33 = icmp eq i32 %4, 3
  %34 = sext i32 %26 to i64
  %wide.trip.count162 = zext nneg i32 %19 to i64
  %wide.trip.count147 = zext i32 %18 to i64
  %35 = add nsw i64 %wide.trip.count147, -1
  %xtraiter = and i64 %wide.trip.count147, 1
  %36 = icmp eq i64 %35, 0
  %unroll_iter = and i64 %wide.trip.count147, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %xtraiter173 = and i64 %wide.trip.count147, 1
  %37 = icmp eq i64 %35, 0
  %unroll_iter175 = and i64 %wide.trip.count147, 2147483646
  %lcmp.mod174.not = icmp eq i64 %xtraiter173, 0
  %xtraiter177 = and i64 %wide.trip.count147, 3
  %38 = icmp ult i32 %18, 4
  %unroll_iter179 = and i64 %wide.trip.count147, 2147483644
  %lcmp.mod178.not = icmp eq i64 %xtraiter177, 0
  br label %39

39:                                               ; preds = %.lr.ph139, %179
  %indvars.iv159 = phi i64 [ 0, %.lr.ph139 ], [ %indvars.iv.next160, %179 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %40 = invoke noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13652) %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
          to label %41 unwind label %42

41:                                               ; preds = %39
  %.not114 = icmp eq i32 %40, 0
  br i1 %.not114, label %44, label %.thread117

.thread117:                                       ; preds = %41
  call void @_ZN4jpgdL9jpgd_freeEPv(ptr noundef nonnull %29)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %.loopexit125

42:                                               ; preds = %39
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %180

44:                                               ; preds = %41
  %45 = mul nsw i64 %indvars.iv159, %34
  %46 = getelementptr inbounds i8, ptr %29, i64 %45
  br i1 %30, label %47, label %50

47:                                               ; preds = %44
  %48 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %6)
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %54, label %.thread

50:                                               ; preds = %44
  br i1 %31, label %51, label %.thread

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

54:                                               ; preds = %51, %47
  %55 = load ptr, ptr %7, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %46, ptr align 1 %55, i64 %34, i1 false)
  br label %.thread116

.thread:                                          ; preds = %47, %51, %50
  %56 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %6)
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %97

58:                                               ; preds = %.thread
  br i1 %33, label %.preheader, label %.preheader118

.preheader118:                                    ; preds = %58
  br i1 %32, label %.lr.ph133.preheader, label %.loopexit

.lr.ph133.preheader:                              ; preds = %.preheader118
  br i1 %37, label %.loopexit.loopexit170.unr-lcssa, label %.lr.ph133

.preheader:                                       ; preds = %58
  br i1 %32, label %.lr.ph136.preheader, label %.loopexit

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

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

.lr.ph133:                                        ; preds = %.lr.ph133.preheader, %.lr.ph133
  %indvars.iv149 = phi i64 [ %indvars.iv.next150.1, %.lr.ph133 ], [ 0, %.lr.ph133.preheader ]
  %.199132 = phi ptr [ %96, %.lr.ph133 ], [ %46, %.lr.ph133.preheader ]
  %niter176 = phi i64 [ %niter176.next.1, %.lr.ph133 ], [ 0, %.lr.ph133.preheader ]
  %83 = load ptr, ptr %7, align 8, !tbaa !9
  %84 = getelementptr inbounds i8, ptr %83, i64 %indvars.iv149
  %85 = load i8, ptr %84, align 1, !tbaa !11
  store i8 %85, ptr %.199132, align 1, !tbaa !11
  %86 = getelementptr inbounds i8, ptr %.199132, i64 1
  store i8 %85, ptr %86, align 1, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %.199132, i64 2
  store i8 %85, ptr %87, align 1, !tbaa !11
  %88 = getelementptr inbounds i8, ptr %.199132, i64 3
  store i8 -1, ptr %88, align 1, !tbaa !11
  %89 = getelementptr inbounds i8, ptr %.199132, i64 4
  %indvars.iv.next150 = or disjoint i64 %indvars.iv149, 1
  %90 = load ptr, ptr %7, align 8, !tbaa !9
  %91 = getelementptr inbounds i8, ptr %90, i64 %indvars.iv.next150
  %92 = load i8, ptr %91, align 1, !tbaa !11
  store i8 %92, ptr %89, align 1, !tbaa !11
  %93 = getelementptr inbounds i8, ptr %.199132, i64 5
  store i8 %92, ptr %93, align 1, !tbaa !11
  %94 = getelementptr inbounds i8, ptr %.199132, i64 6
  store i8 %92, ptr %94, align 1, !tbaa !11
  %95 = getelementptr inbounds i8, ptr %.199132, i64 7
  store i8 -1, ptr %95, align 1, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %.199132, i64 8
  %indvars.iv.next150.1 = add nuw nsw i64 %indvars.iv149, 2
  %niter176.next.1 = add i64 %niter176, 2
  %niter176.ncmp.1 = icmp eq i64 %niter176.next.1, %unroll_iter175
  br i1 %niter176.ncmp.1, label %.loopexit.loopexit170.unr-lcssa, label %.lr.ph133, !llvm.loop !14

97:                                               ; preds = %.thread
  %98 = call noundef i32 @_ZNK4jpgd12jpeg_decoder18get_num_componentsEv(ptr noundef nonnull align 8 dereferenceable(13652) %6)
  %99 = icmp eq i32 %98, 3
  br i1 %99, label %100, label %.thread116

100:                                              ; preds = %97
  br i1 %30, label %.preheader120, label %.preheader122

.preheader122:                                    ; preds = %100
  br i1 %32, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader122
  br i1 %36, label %.loopexit.loopexit172.unr-lcssa, label %.lr.ph

.preheader120:                                    ; preds = %100
  br i1 %32, label %.lr.ph130, label %.loopexit

.lr.ph130:                                        ; preds = %.preheader120, %.lr.ph130
  %indvars.iv144 = phi i64 [ %indvars.iv.next145, %.lr.ph130 ], [ 0, %.preheader120 ]
  %.2100128 = phi ptr [ %122, %.lr.ph130 ], [ %46, %.preheader120 ]
  %101 = load ptr, ptr %7, align 8, !tbaa !9
  %102 = shl nsw i64 %indvars.iv144, 2
  %103 = getelementptr inbounds i8, ptr %101, i64 %102
  %104 = load i8, ptr %103, align 1, !tbaa !11
  %105 = zext i8 %104 to i32
  %106 = or disjoint i64 %102, 1
  %107 = getelementptr inbounds i8, ptr %101, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !11
  %109 = zext i8 %108 to i32
  %110 = or disjoint i64 %102, 2
  %111 = getelementptr inbounds i8, ptr %101, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !11
  %113 = zext i8 %112 to i32
  %114 = mul nuw nsw i32 %105, 19595
  %115 = mul nuw nsw i32 %109, 38470
  %116 = mul nuw nsw i32 %113, 7471
  %117 = add nuw nsw i32 %114, 32768
  %118 = add nuw nsw i32 %117, %115
  %119 = add nuw nsw i32 %118, %116
  %120 = lshr i32 %119, 16
  %121 = trunc nuw i32 %120 to i8
  %122 = getelementptr inbounds i8, ptr %.2100128, i64 1
  store i8 %121, ptr %.2100128, align 1, !tbaa !11
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %exitcond148.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count147
  br i1 %exitcond148.not, label %.loopexit, label %.lr.ph130, !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 ]
  %.3101126 = phi ptr [ %152, %.lr.ph ], [ %46, %.lr.ph.preheader ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %123 = load ptr, ptr %7, align 8, !tbaa !9
  %124 = shl nsw i64 %indvars.iv, 2
  %125 = getelementptr inbounds i8, ptr %123, i64 %124
  %126 = load i8, ptr %125, align 1, !tbaa !11
  store i8 %126, ptr %.3101126, align 1, !tbaa !11
  %127 = load ptr, ptr %7, align 8, !tbaa !9
  %128 = or disjoint i64 %124, 1
  %129 = getelementptr inbounds i8, ptr %127, i64 %128
  %130 = load i8, ptr %129, align 1, !tbaa !11
  %131 = getelementptr inbounds i8, ptr %.3101126, i64 1
  store i8 %130, ptr %131, align 1, !tbaa !11
  %132 = load ptr, ptr %7, align 8, !tbaa !9
  %133 = or disjoint i64 %124, 2
  %134 = getelementptr inbounds i8, ptr %132, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !11
  %136 = getelementptr inbounds i8, ptr %.3101126, i64 2
  store i8 %135, ptr %136, align 1, !tbaa !11
  %137 = getelementptr inbounds i8, ptr %.3101126, i64 3
  %138 = load ptr, ptr %7, align 8, !tbaa !9
  %indvars.iv.next = shl i64 %indvars.iv, 2
  %139 = or disjoint i64 %indvars.iv.next, 4
  %140 = getelementptr inbounds i8, ptr %138, i64 %139
  %141 = load i8, ptr %140, align 1, !tbaa !11
  store i8 %141, ptr %137, align 1, !tbaa !11
  %142 = load ptr, ptr %7, align 8, !tbaa !9
  %143 = or disjoint i64 %indvars.iv.next, 5
  %144 = getelementptr inbounds i8, ptr %142, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !11
  %146 = getelementptr inbounds i8, ptr %.3101126, i64 4
  store i8 %145, ptr %146, align 1, !tbaa !11
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = or disjoint i64 %indvars.iv.next, 6
  %149 = getelementptr inbounds i8, ptr %147, i64 %148
  %150 = load i8, ptr %149, align 1, !tbaa !11
  %151 = getelementptr inbounds i8, ptr %.3101126, i64 5
  store i8 %150, ptr %151, align 1, !tbaa !11
  %152 = getelementptr inbounds i8, ptr %.3101126, 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.loopexit172.unr-lcssa, label %.lr.ph, !llvm.loop !16

.thread116:                                       ; preds = %54, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %179

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph136, %.lr.ph136.preheader
  %indvars.iv154.unr = phi i64 [ 0, %.lr.ph136.preheader ], [ %indvars.iv.next155.3, %.lr.ph136 ]
  %.098135.unr = phi ptr [ %46, %.lr.ph136.preheader ], [ %82, %.lr.ph136 ]
  br i1 %lcmp.mod178.not, label %.loopexit, label %.lr.ph136.epil

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

.loopexit.loopexit170.unr-lcssa:                  ; preds = %.lr.ph133, %.lr.ph133.preheader
  %indvars.iv149.unr = phi i64 [ 0, %.lr.ph133.preheader ], [ %indvars.iv.next150.1, %.lr.ph133 ]
  %.199132.unr = phi ptr [ %46, %.lr.ph133.preheader ], [ %96, %.lr.ph133 ]
  br i1 %lcmp.mod174.not, label %.loopexit, label %.lr.ph133.epil

.lr.ph133.epil:                                   ; preds = %.loopexit.loopexit170.unr-lcssa
  %159 = load ptr, ptr %7, align 8, !tbaa !9
  %160 = getelementptr inbounds i8, ptr %159, i64 %indvars.iv149.unr
  %161 = load i8, ptr %160, align 1, !tbaa !11
  store i8 %161, ptr %.199132.unr, align 1, !tbaa !11
  %162 = getelementptr inbounds i8, ptr %.199132.unr, i64 1
  store i8 %161, ptr %162, align 1, !tbaa !11
  %163 = getelementptr inbounds i8, ptr %.199132.unr, i64 2
  store i8 %161, ptr %163, align 1, !tbaa !11
  %164 = getelementptr inbounds i8, ptr %.199132.unr, i64 3
  store i8 -1, ptr %164, align 1, !tbaa !11
  br label %.loopexit

.loopexit.loopexit172.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %.3101126.unr = phi ptr [ %46, %.lr.ph.preheader ], [ %152, %.lr.ph ]
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph.epil

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

.loopexit:                                        ; preds = %.lr.ph.epil, %.loopexit.loopexit172.unr-lcssa, %.lr.ph130, %.lr.ph133.epil, %.loopexit.loopexit170.unr-lcssa, %.loopexit.loopexit.unr-lcssa, %.lr.ph136.epil, %.preheader122, %.preheader120, %.preheader118, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %179

179:                                              ; preds = %.loopexit, %.thread116
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
  br i1 %exitcond163.not, label %.loopexit125, label %39, !llvm.loop !19

180:                                              ; preds = %42, %23
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %24, %23 ]
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13652) %6) #4
  call void @llvm.lifetime.end.p0(i64 13656, ptr nonnull %6) #4
  resume { ptr, i32 } %.pn

.loopexit125:                                     ; preds = %179, %.preheader124, %.thread117, %22, %25, %15
  %.5 = phi ptr [ null, %15 ], [ null, %22 ], [ null, %25 ], [ null, %.thread117 ], [ %29, %.preheader124 ], [ %29, %179 ]
  call void @_ZN4jpgd12jpeg_decoderD1Ev(ptr noundef nonnull align 8 dereferenceable(13652) %6) #4
  call void @llvm.lifetime.end.p0(i64 13656, ptr nonnull %6) #4
  br label %181

181:                                              ; preds = %14, %9, %5, %.loopexit125
  %.6 = phi ptr [ %.5, %.loopexit125 ], [ null, %5 ], [ null, %9 ], [ null, %14 ]
  ret ptr %.6
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4jpgd12jpeg_decoder14get_error_codeEv(ptr noundef nonnull align 8 dereferenceable(13652)) 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(13652)) 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(13652)) 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(13652)) local_unnamed_addr #1 align 2

declare void @_ZN4jpgd12jpeg_decoderC1EPNS_19jpeg_decoder_streamE(ptr, ptr) 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