; 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] }

@_ZN4jpgdL5g_ZAGE = external hidden global [64 x i32], align 16

; 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: mustprogress noreturn uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523), i32 noundef) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #3 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %19, i32 0, i32 27
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = shl i32 1, %21
  store i32 %22, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %23, i32 0, i32 27
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = shl i32 -1, %25
  store i32 %26, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %28, i32 0, i32 45
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [4 x ptr], ptr %29, i64 0, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_getpEPNS0_9coeff_bufEii(ptr noundef nonnull align 8 dereferenceable(13523) %27, ptr noundef %33, i32 noundef %34, i32 noundef %35)
  store ptr %36, ptr %14, align 8, !tbaa !5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %37, i32 0, i32 26
  %39 = load i32, ptr %38, align 8, !tbaa !15
  %40 = icmp sgt i32 %39, 63
  br i1 %40, label %41, label %43

41:                                               ; preds = %4
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %42, i32 noundef -230) #5
  unreachable

43:                                               ; preds = %4
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %44, i32 0, i32 25
  %46 = load i32, ptr %45, align 4, !tbaa !16
  store i32 %46, ptr %10, align 4, !tbaa !9
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %47, i32 0, i32 46
  %49 = load i32, ptr %48, align 8, !tbaa !17
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %209

51:                                               ; preds = %43
  br label %52

52:                                               ; preds = %205, %51
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %54, i32 0, i32 26
  %56 = load i32, ptr %55, align 8, !tbaa !15
  %57 = icmp sle i32 %53, %56
  br i1 %57, label %58, label %208

58:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %59, i32 0, i32 24
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [4 x i32], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  store i32 %64, ptr %15, align 4, !tbaa !9
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = icmp uge i32 %65, 8
  br i1 %66, label %67, label %69

67:                                               ; preds = %58
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %68, i32 noundef -230) #5
  unreachable

69:                                               ; preds = %58
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %71, i32 0, i32 43
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds [8 x ptr], ptr %72, i64 0, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = call noundef i32 @_ZN4jpgd12jpeg_decoder11huff_decodeEPNS0_11huff_tablesE(ptr noundef nonnull align 8 dereferenceable(13523) %70, ptr noundef %76)
  store i32 %77, ptr %9, align 4, !tbaa !9
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = ashr i32 %78, 4
  store i32 %79, ptr %11, align 4, !tbaa !9
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = and i32 %80, 15
  store i32 %81, ptr %9, align 4, !tbaa !9
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %98

84:                                               ; preds = %69
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = icmp ne i32 %85, 1
  br i1 %86, label %87, label %89

87:                                               ; preds = %84
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %88, i32 noundef -230) #5
  unreachable

89:                                               ; preds = %84
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %90, i32 noundef 1)
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %89
  %94 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %94, ptr %9, align 4, !tbaa !9
  br label %97

95:                                               ; preds = %89
  %96 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %96, ptr %9, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %95, %93
  br label %118

98:                                               ; preds = %69
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 15
  br i1 %100, label %101, label %117

101:                                              ; preds = %98
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = shl i32 1, %102
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %104, i32 0, i32 46
  store i32 %103, ptr %105, align 8, !tbaa !17
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %116

108:                                              ; preds = %101
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load i32, ptr %11, align 4, !tbaa !9
  %111 = call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %109, i32 noundef %110)
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %112, i32 0, i32 46
  %114 = load i32, ptr %113, align 8, !tbaa !17
  %115 = add i32 %114, %111
  store i32 %115, ptr %113, align 8, !tbaa !17
  br label %116

116:                                              ; preds = %108, %101
  store i32 2, ptr %16, align 4
  br label %202

117:                                              ; preds = %98
  br label %118

118:                                              ; preds = %117, %97
  br label %119

119:                                              ; preds = %179, %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = and i32 %121, 63
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i16, ptr %120, i64 %126
  store ptr %127, ptr %17, align 8, !tbaa !5
  %128 = load ptr, ptr %17, align 8, !tbaa !5
  %129 = load i16, ptr %128, align 2, !tbaa !18
  %130 = sext i16 %129 to i32
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %167

132:                                              ; preds = %119
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %133, i32 noundef 1)
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %166

136:                                              ; preds = %132
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = load i16, ptr %137, align 2, !tbaa !18
  %139 = sext i16 %138 to i32
  %140 = load i32, ptr %12, align 4, !tbaa !9
  %141 = and i32 %139, %140
  %142 = icmp eq i32 %141, 0
  br i1 %142, label %143, label %165

143:                                              ; preds = %136
  %144 = load ptr, ptr %17, align 8, !tbaa !5
  %145 = load i16, ptr %144, align 2, !tbaa !18
  %146 = sext i16 %145 to i32
  %147 = icmp sge i32 %146, 0
  br i1 %147, label %148, label %156

148:                                              ; preds = %143
  %149 = load ptr, ptr %17, align 8, !tbaa !5
  %150 = load i16, ptr %149, align 2, !tbaa !18
  %151 = sext i16 %150 to i32
  %152 = load i32, ptr %12, align 4, !tbaa !9
  %153 = add nsw i32 %151, %152
  %154 = trunc i32 %153 to i16
  %155 = load ptr, ptr %17, align 8, !tbaa !5
  store i16 %154, ptr %155, align 2, !tbaa !18
  br label %164

156:                                              ; preds = %143
  %157 = load ptr, ptr %17, align 8, !tbaa !5
  %158 = load i16, ptr %157, align 2, !tbaa !18
  %159 = sext i16 %158 to i32
  %160 = load i32, ptr %13, align 4, !tbaa !9
  %161 = add nsw i32 %159, %160
  %162 = trunc i32 %161 to i16
  %163 = load ptr, ptr %17, align 8, !tbaa !5
  store i16 %162, ptr %163, align 2, !tbaa !18
  br label %164

164:                                              ; preds = %156, %148
  br label %165

165:                                              ; preds = %164, %136
  br label %166

166:                                              ; preds = %165, %132
  br label %173

167:                                              ; preds = %119
  %168 = load i32, ptr %11, align 4, !tbaa !9
  %169 = add nsw i32 %168, -1
  store i32 %169, ptr %11, align 4, !tbaa !9
  %170 = icmp slt i32 %169, 0
  br i1 %170, label %171, label %172

171:                                              ; preds = %167
  store i32 5, ptr %16, align 4
  br label %176

172:                                              ; preds = %167
  br label %173

173:                                              ; preds = %172, %166
  %174 = load i32, ptr %10, align 4, !tbaa !9
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %16, align 4
  br label %176

176:                                              ; preds = %173, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %177 = load i32, ptr %16, align 4
  switch i32 %177, label %279 [
    i32 0, label %178
    i32 5, label %185
  ]

178:                                              ; preds = %176
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %10, align 4, !tbaa !9
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %181, i32 0, i32 26
  %183 = load i32, ptr %182, align 8, !tbaa !15
  %184 = icmp sle i32 %180, %183
  br i1 %184, label %119, label %185, !llvm.loop !20

185:                                              ; preds = %179, %176
  %186 = load i32, ptr %9, align 4, !tbaa !9
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %201

188:                                              ; preds = %185
  %189 = load i32, ptr %10, align 4, !tbaa !9
  %190 = icmp slt i32 %189, 64
  br i1 %190, label %191, label %201

191:                                              ; preds = %188
  %192 = load i32, ptr %9, align 4, !tbaa !9
  %193 = trunc i32 %192 to i16
  %194 = load ptr, ptr %14, align 8, !tbaa !5
  %195 = load i32, ptr %10, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds i16, ptr %194, i64 %199
  store i16 %193, ptr %200, align 2, !tbaa !18
  br label %201

201:                                              ; preds = %191, %188, %185
  store i32 0, ptr %16, align 4
  br label %202

202:                                              ; preds = %201, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %203 = load i32, ptr %16, align 4
  switch i32 %203, label %279 [
    i32 0, label %204
    i32 2, label %208
  ]

204:                                              ; preds = %202
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %10, align 4, !tbaa !9
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %10, align 4, !tbaa !9
  br label %52, !llvm.loop !22

208:                                              ; preds = %202, %52
  br label %209

209:                                              ; preds = %208, %43
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %210, i32 0, i32 46
  %212 = load i32, ptr %211, align 8, !tbaa !17
  %213 = icmp sgt i32 %212, 0
  br i1 %213, label %214, label %278

214:                                              ; preds = %209
  br label %215

215:                                              ; preds = %270, %214
  %216 = load i32, ptr %10, align 4, !tbaa !9
  %217 = load ptr, ptr %5, align 8, !tbaa !5
  %218 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %217, i32 0, i32 26
  %219 = load i32, ptr %218, align 8, !tbaa !15
  %220 = icmp sle i32 %216, %219
  br i1 %220, label %221, label %273

221:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %222 = load ptr, ptr %14, align 8, !tbaa !5
  %223 = load i32, ptr %10, align 4, !tbaa !9
  %224 = and i32 %223, 63
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !9
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds i16, ptr %222, i64 %228
  store ptr %229, ptr %18, align 8, !tbaa !5
  %230 = load ptr, ptr %18, align 8, !tbaa !5
  %231 = load i16, ptr %230, align 2, !tbaa !18
  %232 = sext i16 %231 to i32
  %233 = icmp ne i32 %232, 0
  br i1 %233, label %234, label %269

234:                                              ; preds = %221
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %235, i32 noundef 1)
  %237 = icmp ne i32 %236, 0
  br i1 %237, label %238, label %268

238:                                              ; preds = %234
  %239 = load ptr, ptr %18, align 8, !tbaa !5
  %240 = load i16, ptr %239, align 2, !tbaa !18
  %241 = sext i16 %240 to i32
  %242 = load i32, ptr %12, align 4, !tbaa !9
  %243 = and i32 %241, %242
  %244 = icmp eq i32 %243, 0
  br i1 %244, label %245, label %267

245:                                              ; preds = %238
  %246 = load ptr, ptr %18, align 8, !tbaa !5
  %247 = load i16, ptr %246, align 2, !tbaa !18
  %248 = sext i16 %247 to i32
  %249 = icmp sge i32 %248, 0
  br i1 %249, label %250, label %258

250:                                              ; preds = %245
  %251 = load ptr, ptr %18, align 8, !tbaa !5
  %252 = load i16, ptr %251, align 2, !tbaa !18
  %253 = sext i16 %252 to i32
  %254 = load i32, ptr %12, align 4, !tbaa !9
  %255 = add nsw i32 %253, %254
  %256 = trunc i32 %255 to i16
  %257 = load ptr, ptr %18, align 8, !tbaa !5
  store i16 %256, ptr %257, align 2, !tbaa !18
  br label %266

258:                                              ; preds = %245
  %259 = load ptr, ptr %18, align 8, !tbaa !5
  %260 = load i16, ptr %259, align 2, !tbaa !18
  %261 = sext i16 %260 to i32
  %262 = load i32, ptr %13, align 4, !tbaa !9
  %263 = add nsw i32 %261, %262
  %264 = trunc i32 %263 to i16
  %265 = load ptr, ptr %18, align 8, !tbaa !5
  store i16 %264, ptr %265, align 2, !tbaa !18
  br label %266

266:                                              ; preds = %258, %250
  br label %267

267:                                              ; preds = %266, %238
  br label %268

268:                                              ; preds = %267, %234
  br label %269

269:                                              ; preds = %268, %221
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %270

270:                                              ; preds = %269
  %271 = load i32, ptr %10, align 4, !tbaa !9
  %272 = add nsw i32 %271, 1
  store i32 %272, ptr %10, align 4, !tbaa !9
  br label %215, !llvm.loop !23

273:                                              ; preds = %215
  %274 = load ptr, ptr %5, align 8, !tbaa !5
  %275 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %274, i32 0, i32 46
  %276 = load i32, ptr %275, align 8, !tbaa !17
  %277 = add nsw i32 %276, -1
  store i32 %277, ptr %275, align 8, !tbaa !17
  br label %278

278:                                              ; preds = %273, %209
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret void

279:                                              ; preds = %202, %176
  unreachable
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 572}
!12 = !{!"_ZTSN4jpgd12jpeg_decoderE", !7, i64 0, !10, i64 200, !6, i64 208, !10, i64 216, !10, i64 220, !6, i64 224, !10, i64 232, !7, i64 236, !7, i64 248, !7, i64 312, !7, i64 376, !10, i64 408, !10, i64 412, !7, i64 416, !7, i64 432, !7, i64 448, !7, i64 464, !7, i64 480, !7, i64 496, !10, i64 512, !7, i64 516, !7, i64 532, !7, i64 548, !10, i64 564, !10, i64 568, !10, i64 572, !10, i64 576, !10, i64 580, !10, i64 584, !10, i64 588, !10, i64 592, !10, i64 596, !10, i64 600, !7, i64 604, !10, i64 644, !10, i64 648, !10, i64 652, !10, i64 656, !10, i64 660, !10, i64 664, !7, i64 672, !7, i64 736, !7, i64 768, !10, i64 800, !7, i64 804, !6, i64 824, !10, i64 832, !10, i64 836, !7, i64 840, !7, i64 904, !7, i64 9224, !10, i64 9288, !10, i64 9292, !10, i64 9296, !10, i64 9300, !10, i64 9304, !10, i64 9308, !10, i64 9312, !10, i64 9316, !7, i64 9320, !6, i64 9336, !7, i64 9344, !6, i64 9384, !6, i64 9392, !7, i64 9400, !7, i64 10424, !7, i64 11448, !7, i64 12472, !6, i64 13496, !6, i64 13504, !13, i64 13512, !10, i64 13516, !14, i64 13520, !14, i64 13521, !14, i64 13522}
!13 = !{!"_ZTSN4jpgd11jpgd_statusE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !10, i64 568}
!16 = !{!12, !10, i64 564}
!17 = !{!12, !10, i64 800}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


; 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"

@_ZN4jpgdL5g_ZAGE = external hidden local_unnamed_addr global [64 x i32], align 16

; Function Attrs: mustprogress noreturn uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523), i32 noundef) local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 572
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = shl nuw i32 1, %6
  %8 = shl nsw i32 -1, %6
  %9 = getelementptr inbounds i8, ptr %0, i64 768
  %10 = sext i32 %1 to i64
  %11 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 %10
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_getpEPNS0_9coeff_bufEii(ptr noundef nonnull align 8 dereferenceable(13523) %0, ptr noundef %12, i32 noundef %2, i32 noundef %3)
  %14 = getelementptr inbounds i8, ptr %0, i64 568
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %16 = icmp sgt i32 %15, 63
  br i1 %16, label %17, label %18

17:                                               ; preds = %4
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef -230) #3
  unreachable

18:                                               ; preds = %4
  %19 = getelementptr inbounds i8, ptr %0, i64 564
  %20 = load i32, ptr %19, align 4, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 800
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %.preheader119, label %thread-pre-split

.preheader119:                                    ; preds = %18
  %.not126 = icmp sgt i32 %20, %15
  br i1 %.not126, label %thread-pre-split.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader119
  %24 = getelementptr inbounds i8, ptr %0, i64 548
  %25 = getelementptr inbounds [4 x i32], ptr %24, i64 0, i64 %10
  %26 = getelementptr inbounds i8, ptr %0, i64 672
  br label %27

27:                                               ; preds = %.lr.ph, %82
  %.078127 = phi i32 [ %20, %.lr.ph ], [ %83, %82 ]
  %28 = load i32, ptr %25, align 4, !tbaa !17
  %29 = icmp ugt i32 %28, 7
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef -230) #3
  unreachable

31:                                               ; preds = %27
  %32 = zext nneg i32 %28 to i64
  %33 = getelementptr inbounds [8 x ptr], ptr %26, i64 0, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder11huff_decodeEPNS0_11huff_tablesE(ptr noundef nonnull align 8 dereferenceable(13523) %0, ptr noundef %34)
  %36 = ashr i32 %35, 4
  %37 = and i32 %35, 15
  switch i32 %37, label %38 [
    i32 0, label %41
    i32 1, label %39
  ]

38:                                               ; preds = %31
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef -230) #3
  unreachable

39:                                               ; preds = %31
  %40 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 1)
  %.not98 = icmp eq i32 %40, 0
  %. = select i1 %.not98, i32 %8, i32 %7
  br label %48

41:                                               ; preds = %31
  %.not95 = icmp eq i32 %36, 15
  br i1 %.not95, label %48, label %42

42:                                               ; preds = %41
  %43 = shl nuw i32 1, %36
  store i32 %43, ptr %21, align 8, !tbaa !16
  %.not96 = icmp ult i32 %35, 16
  br i1 %.not96, label %thread-pre-split, label %44

44:                                               ; preds = %42
  %45 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %36)
  %46 = load i32, ptr %21, align 8, !tbaa !16
  %47 = add i32 %46, %45
  store i32 %47, ptr %21, align 8, !tbaa !16
  br label %thread-pre-split

48:                                               ; preds = %39, %41
  %.0 = phi i32 [ 0, %41 ], [ %., %39 ]
  br label %49

49:                                               ; preds = %69, %48
  %.081 = phi i32 [ %36, %48 ], [ %.182, %69 ]
  %.1 = phi i32 [ %.078127, %48 ], [ %70, %69 ]
  %50 = and i32 %.1, 63
  %51 = zext nneg i32 %50 to i64
  %52 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !17
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i16, ptr %13, i64 %54
  %56 = load i16, ptr %55, align 2, !tbaa !18
  %.not99 = icmp eq i16 %56, 0
  br i1 %.not99, label %66, label %57

57:                                               ; preds = %49
  %58 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 1)
  %.not100 = icmp eq i32 %58, 0
  br i1 %.not100, label %69, label %59

59:                                               ; preds = %57
  %60 = load i16, ptr %55, align 2, !tbaa !18
  %61 = sext i16 %60 to i32
  %62 = and i32 %7, %61
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %.sink.split, label %69

.sink.split:                                      ; preds = %59
  %64 = icmp slt i16 %60, 0
  %.154.v = select i1 %64, i32 %8, i32 %7
  %.154 = trunc i32 %.154.v to i16
  %65 = add i16 %60, %.154
  store i16 %65, ptr %55, align 2, !tbaa !18
  br label %69

66:                                               ; preds = %49
  %67 = add nsw i32 %.081, -1
  %68 = icmp slt i32 %.081, 1
  br i1 %68, label %72, label %69

69:                                               ; preds = %.sink.split, %59, %57, %66
  %.182 = phi i32 [ %.081, %59 ], [ %.081, %57 ], [ %67, %66 ], [ %.081, %.sink.split ]
  %70 = add nsw i32 %.1, 1
  %71 = load i32, ptr %14, align 8, !tbaa !14
  %.not101.not = icmp slt i32 %.1, %71
  br i1 %.not101.not, label %49, label %72, !llvm.loop !20

72:                                               ; preds = %66, %69
  %.2112 = phi i32 [ %70, %69 ], [ %.1, %66 ]
  %73 = icmp ne i32 %.0, 0
  %74 = icmp slt i32 %.2112, 64
  %or.cond = select i1 %73, i1 %74, i1 false
  br i1 %or.cond, label %75, label %82

75:                                               ; preds = %72
  %76 = trunc i32 %.0 to i16
  %77 = sext i32 %.2112 to i64
  %78 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !17
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i16, ptr %13, i64 %80
  store i16 %76, ptr %81, align 2, !tbaa !18
  br label %82

82:                                               ; preds = %75, %72
  %83 = add nsw i32 %.2112, 1
  %84 = load i32, ptr %14, align 8, !tbaa !14
  %.not.not = icmp slt i32 %.2112, %84
  br i1 %.not.not, label %27, label %thread-pre-split.loopexit, !llvm.loop !22

thread-pre-split.loopexit:                        ; preds = %82
  %.pr.pre = load i32, ptr %21, align 8, !tbaa !16
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %thread-pre-split.loopexit, %44, %42, %18
  %85 = phi i32 [ %47, %44 ], [ %43, %42 ], [ %22, %18 ], [ %.pr.pre, %thread-pre-split.loopexit ]
  %.4 = phi i32 [ %.078127, %44 ], [ %.078127, %42 ], [ %20, %18 ], [ %83, %thread-pre-split.loopexit ]
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.preheader, label %thread-pre-split.thread

.preheader:                                       ; preds = %thread-pre-split
  %87 = load i32, ptr %14, align 8, !tbaa !14
  %.not102128 = icmp sgt i32 %.4, %87
  br i1 %.not102128, label %._crit_edge, label %.lr.ph130

.lr.ph130:                                        ; preds = %.preheader, %104
  %.5129 = phi i32 [ %105, %104 ], [ %.4, %.preheader ]
  %88 = and i32 %.5129, 63
  %89 = zext nneg i32 %88 to i64
  %90 = getelementptr inbounds [64 x i32], ptr @_ZN4jpgdL5g_ZAGE, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !17
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i16, ptr %13, i64 %92
  %94 = load i16, ptr %93, align 2, !tbaa !18
  %.not103 = icmp eq i16 %94, 0
  br i1 %.not103, label %104, label %95

95:                                               ; preds = %.lr.ph130
  %96 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19get_bits_no_markersEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 1)
  %.not104 = icmp eq i32 %96, 0
  br i1 %.not104, label %104, label %97

97:                                               ; preds = %95
  %98 = load i16, ptr %93, align 2, !tbaa !18
  %99 = sext i16 %98 to i32
  %100 = and i32 %7, %99
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %.sink.split152, label %104

.sink.split152:                                   ; preds = %97
  %102 = icmp slt i16 %98, 0
  %.155.v = select i1 %102, i32 %8, i32 %7
  %.155 = trunc i32 %.155.v to i16
  %103 = add i16 %98, %.155
  store i16 %103, ptr %93, align 2, !tbaa !18
  br label %104

104:                                              ; preds = %.sink.split152, %95, %97, %.lr.ph130
  %105 = add nsw i32 %.5129, 1
  %106 = load i32, ptr %14, align 8, !tbaa !14
  %.not102.not = icmp slt i32 %.5129, %106
  br i1 %.not102.not, label %.lr.ph130, label %._crit_edge.loopexit, !llvm.loop !23

._crit_edge.loopexit:                             ; preds = %104
  %.pre = load i32, ptr %21, align 8, !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %107 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %85, %.preheader ]
  %108 = add nsw i32 %107, -1
  store i32 %108, ptr %21, align 8, !tbaa !16
  br label %thread-pre-split.thread

thread-pre-split.thread:                          ; preds = %.preheader119, %._crit_edge, %thread-pre-split
  ret void
}

attributes #0 = { mustprogress noreturn 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 #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { noreturn }

!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, !9, i64 572}
!6 = !{!"_ZTSN4jpgd12jpeg_decoderE", !7, i64 0, !9, i64 200, !10, i64 208, !9, i64 216, !9, i64 220, !10, i64 224, !9, i64 232, !7, i64 236, !7, i64 248, !7, i64 312, !7, i64 376, !9, i64 408, !9, i64 412, !7, i64 416, !7, i64 432, !7, i64 448, !7, i64 464, !7, i64 480, !7, i64 496, !9, i64 512, !7, i64 516, !7, i64 532, !7, i64 548, !9, i64 564, !9, i64 568, !9, i64 572, !9, i64 576, !9, i64 580, !9, i64 584, !9, i64 588, !9, i64 592, !9, i64 596, !9, i64 600, !7, i64 604, !9, i64 644, !9, i64 648, !9, i64 652, !9, i64 656, !9, i64 660, !9, i64 664, !7, i64 672, !7, i64 736, !7, i64 768, !9, i64 800, !7, i64 804, !10, i64 824, !9, i64 832, !9, i64 836, !7, i64 840, !7, i64 904, !7, i64 9224, !9, i64 9288, !9, i64 9292, !9, i64 9296, !9, i64 9300, !9, i64 9304, !9, i64 9308, !9, i64 9312, !9, i64 9316, !7, i64 9320, !10, i64 9336, !7, i64 9344, !10, i64 9384, !10, i64 9392, !7, i64 9400, !7, i64 10424, !7, i64 11448, !7, i64 12472, !10, i64 13496, !10, i64 13504, !11, i64 13512, !9, i64 13516, !12, i64 13520, !12, i64 13521, !12, i64 13522}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"_ZTSN4jpgd11jpgd_statusE", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !9, i64 568}
!15 = !{!6, !9, i64 564}
!16 = !{!6, !9, i64 800}
!17 = !{!9, !9, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}


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