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

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

@.str.1 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv = external hidden unnamed_addr constant [47 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, 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 i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %31 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 4, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %32 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 5
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 36
  %35 = load i32, ptr %34, align 4, !tbaa !15
  %36 = sub nsw i32 %33, %35
  store i32 %36, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = and i32 %37, 15
  store i32 %38, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %39 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 5
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = ashr i32 %40, 1
  %42 = sub nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %43 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 72
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  store ptr %44, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = and i32 %45, 1
  %47 = icmp ne i32 %46, 0
  %48 = zext i1 %47 to i64
  %49 = select i1 %47, i32 3, i32 1
  store i32 %49, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = and i32 %50, 1
  %52 = icmp ne i32 %51, 0
  %53 = zext i1 %52 to i64
  %54 = select i1 %52, i32 1, i32 3
  store i32 %54, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = sub nsw i32 %55, 1
  %57 = ashr i32 %56, 1
  store i32 %57, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %62, label %65

62:                                               ; preds = %1
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  br label %67

65:                                               ; preds = %1
  %66 = load i32, ptr %6, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %65, %62
  %68 = phi i32 [ %64, %62 ], [ %66, %65 ]
  store i32 %68, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %69 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 66
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  store ptr %70, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %71 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 66
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  store ptr %72, ptr %13, align 8, !tbaa !5
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = icmp sge i32 %73, 0
  br i1 %74, label %75, label %110

75:                                               ; preds = %67
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = and i32 %76, 15
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %83, label %79

79:                                               ; preds = %75
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = and i32 %80, 15
  %82 = icmp eq i32 %81, 15
  br i1 %82, label %83, label %110

83:                                               ; preds = %79, %75
  %84 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 36
  %85 = load i32, ptr %84, align 4, !tbaa !15
  %86 = icmp sgt i32 %85, 1
  br i1 %86, label %87, label %110

87:                                               ; preds = %83
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  br label %93

91:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 1737, ptr noundef @__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv) #5
  unreachable

92:                                               ; No predecessors!
  br label %93

93:                                               ; preds = %92, %90
  %94 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 78
  %95 = load i8, ptr %94, align 2, !tbaa !18, !range !19, !noundef !20
  %96 = trunc i8 %95 to i1
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  br label %100

98:                                               ; preds = %93
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 1738, ptr noundef @__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv) #5
  unreachable

99:                                               ; No predecessors!
  br label %100

100:                                              ; preds = %99, %97
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = and i32 %101, 15
  %103 = icmp eq i32 %102, 15
  br i1 %103, label %104, label %107

104:                                              ; preds = %100
  %105 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 67
  %106 = load ptr, ptr %105, align 8, !tbaa !21
  store ptr %106, ptr %12, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %104, %100
  %108 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 67
  %109 = load ptr, ptr %108, align 8, !tbaa !21
  store ptr %109, ptr %13, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %107, %83, %79, %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %111 = load i32, ptr %5, align 4, !tbaa !9
  %112 = and i32 %111, 8
  %113 = icmp ne i32 %112, 0
  %114 = zext i1 %113 to i64
  %115 = select i1 %113, i32 64, i32 0
  %116 = load i32, ptr %5, align 4, !tbaa !9
  %117 = and i32 %116, 7
  %118 = mul nsw i32 %117, 8
  %119 = add nsw i32 %115, %118
  store i32 %119, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %120 = load i32, ptr %10, align 4, !tbaa !9
  %121 = and i32 %120, 7
  %122 = mul nsw i32 %121, 8
  %123 = add nsw i32 %122, 128
  store i32 %123, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %124 = load i32, ptr %11, align 4, !tbaa !9
  %125 = and i32 %124, 7
  %126 = mul nsw i32 %125, 8
  %127 = add nsw i32 %126, 128
  store i32 %127, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %251, %110
  %129 = load i32, ptr %17, align 4, !tbaa !9
  %130 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 4
  %131 = load i32, ptr %130, align 8, !tbaa !22
  %132 = icmp slt i32 %129, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %254

134:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %135 = load i32, ptr %17, align 4, !tbaa !9
  %136 = ashr i32 %135, 3
  %137 = mul i32 %136, 4
  %138 = mul i32 %137, 64
  %139 = load i32, ptr %17, align 4, !tbaa !9
  %140 = and i32 %139, 7
  %141 = add i32 %138, %140
  store i32 %141, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = load i32, ptr %18, align 4, !tbaa !9
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = add nsw i32 %143, %144
  %146 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %31, i32 noundef %145)
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %142, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !23
  %150 = zext i8 %149 to i32
  store i32 %150, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %151 = load i32, ptr %18, align 4, !tbaa !9
  %152 = load i32, ptr %15, align 4, !tbaa !9
  %153 = add nsw i32 %151, %152
  store i32 %153, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = load i32, ptr %20, align 4, !tbaa !9
  %156 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %31, i32 noundef %155)
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %154, i64 %157
  %159 = load i8, ptr %158, align 1, !tbaa !23
  %160 = zext i8 %159 to i32
  store i32 %160, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = load i32, ptr %20, align 4, !tbaa !9
  %163 = add nsw i32 %162, 64
  %164 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %31, i32 noundef %163)
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i8, ptr %161, i64 %165
  %167 = load i8, ptr %166, align 1, !tbaa !23
  %168 = zext i8 %167 to i32
  store i32 %168, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %169 = load i32, ptr %18, align 4, !tbaa !9
  %170 = load i32, ptr %16, align 4, !tbaa !9
  %171 = add nsw i32 %169, %170
  store i32 %171, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %172 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 66
  %173 = load ptr, ptr %172, align 8, !tbaa !17
  %174 = load i32, ptr %23, align 4, !tbaa !9
  %175 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %31, i32 noundef %174)
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds i8, ptr %173, i64 %176
  %178 = load i8, ptr %177, align 1, !tbaa !23
  %179 = zext i8 %178 to i32
  store i32 %179, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %180 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 66
  %181 = load ptr, ptr %180, align 8, !tbaa !17
  %182 = load i32, ptr %23, align 4, !tbaa !9
  %183 = add nsw i32 %182, 64
  %184 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %31, i32 noundef %183)
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds i8, ptr %181, i64 %185
  %187 = load i8, ptr %186, align 1, !tbaa !23
  %188 = zext i8 %187 to i32
  store i32 %188, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  %189 = load i32, ptr %21, align 4, !tbaa !9
  %190 = load i32, ptr %8, align 4, !tbaa !9
  %191 = mul nsw i32 %189, %190
  %192 = load i32, ptr %24, align 4, !tbaa !9
  %193 = load i32, ptr %9, align 4, !tbaa !9
  %194 = mul nsw i32 %192, %193
  %195 = add nsw i32 %191, %194
  %196 = add nsw i32 %195, 2
  %197 = ashr i32 %196, 2
  store i32 %197, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  %198 = load i32, ptr %22, align 4, !tbaa !9
  %199 = load i32, ptr %8, align 4, !tbaa !9
  %200 = mul nsw i32 %198, %199
  %201 = load i32, ptr %25, align 4, !tbaa !9
  %202 = load i32, ptr %9, align 4, !tbaa !9
  %203 = mul nsw i32 %201, %202
  %204 = add nsw i32 %200, %203
  %205 = add nsw i32 %204, 2
  %206 = ashr i32 %205, 2
  store i32 %206, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  %207 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 68
  %208 = load i32, ptr %27, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [256 x i32], ptr %207, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !9
  store i32 %211, ptr %28, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %212 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 70
  %213 = load i32, ptr %27, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [256 x i32], ptr %212, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !9
  %217 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 71
  %218 = load i32, ptr %26, align 4, !tbaa !9
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [256 x i32], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !9
  %222 = add nsw i32 %216, %221
  %223 = ashr i32 %222, 16
  store i32 %223, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #4
  %224 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %31, i32 0, i32 69
  %225 = load i32, ptr %26, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [256 x i32], ptr %224, i64 0, i64 %226
  %228 = load i32, ptr %227, align 4, !tbaa !9
  store i32 %228, ptr %30, align 4, !tbaa !9
  %229 = load i32, ptr %19, align 4, !tbaa !9
  %230 = load i32, ptr %28, align 4, !tbaa !9
  %231 = add nsw i32 %229, %230
  %232 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %231)
  %233 = load ptr, ptr %7, align 8, !tbaa !5
  %234 = getelementptr inbounds i8, ptr %233, i64 0
  store i8 %232, ptr %234, align 1, !tbaa !23
  %235 = load i32, ptr %19, align 4, !tbaa !9
  %236 = load i32, ptr %29, align 4, !tbaa !9
  %237 = add nsw i32 %235, %236
  %238 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %237)
  %239 = load ptr, ptr %7, align 8, !tbaa !5
  %240 = getelementptr inbounds i8, ptr %239, i64 1
  store i8 %238, ptr %240, align 1, !tbaa !23
  %241 = load i32, ptr %19, align 4, !tbaa !9
  %242 = load i32, ptr %30, align 4, !tbaa !9
  %243 = add nsw i32 %241, %242
  %244 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %243)
  %245 = load ptr, ptr %7, align 8, !tbaa !5
  %246 = getelementptr inbounds i8, ptr %245, i64 2
  store i8 %244, ptr %246, align 1, !tbaa !23
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = getelementptr inbounds i8, ptr %247, i64 3
  store i8 -1, ptr %248, align 1, !tbaa !23
  %249 = load ptr, ptr %7, align 8, !tbaa !5
  %250 = getelementptr inbounds i8, ptr %249, i64 4
  store ptr %250, ptr %7, align 8, !tbaa !5
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %251

251:                                              ; preds = %134
  %252 = load i32, ptr %17, align 4, !tbaa !9
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %17, align 4, !tbaa !9
  br label %128, !llvm.loop !24

254:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 220}
!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 644}
!16 = !{!12, !6, i64 13496}
!17 = !{!12, !6, i64 9384}
!18 = !{!12, !14, i64 13522}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!12, !6, i64 9392}
!22 = !{!12, !10, i64 216}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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

@.str.1 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv = external hidden unnamed_addr constant [47 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) local_unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 220
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 644
  %5 = load i32, ptr %4, align 4, !tbaa !13
  %6 = sub nsw i32 %3, %5
  %7 = and i32 %6, 15
  %8 = ashr i32 %3, 1
  %9 = add nsw i32 %8, -1
  %10 = getelementptr inbounds i8, ptr %0, i64 13496
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = and i32 %6, 1
  %.not = icmp eq i32 %12, 0
  %13 = select i1 %.not, i32 1, i32 3
  %14 = select i1 %.not, i32 3, i32 1
  %15 = add nsw i32 %6, -1
  %16 = ashr i32 %15, 1
  %17 = add nsw i32 %16, 1
  %18 = tail call i32 @llvm.smin.i32(i32 %17, i32 %9)
  %19 = getelementptr inbounds i8, ptr %0, i64 9384
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = icmp sgt i32 %16, -1
  br i1 %21, label %22, label %37

22:                                               ; preds = %1
  switch i32 %7, label %37 [
    i32 0, label %23
    i32 15, label %23
  ]

23:                                               ; preds = %22, %22
  %24 = icmp sgt i32 %5, 1
  br i1 %24, label %25, label %37

25:                                               ; preds = %23
  %26 = icmp sgt i32 %6, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 1737, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv) #4
  unreachable

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %0, i64 13522
  %30 = load i8, ptr %29, align 2, !tbaa !16, !range !17, !noundef !18
  %31 = trunc nuw i8 %30 to i1
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 1738, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv) #4
  unreachable

33:                                               ; preds = %28
  %34 = icmp eq i32 %7, 15
  %35 = getelementptr inbounds i8, ptr %0, i64 9392
  %36 = load ptr, ptr %35, align 8
  %.057 = select i1 %34, ptr %36, ptr %20
  br label %37

37:                                               ; preds = %22, %33, %23, %1
  %.058 = phi ptr [ %36, %33 ], [ %20, %23 ], [ %20, %1 ], [ %20, %22 ]
  %.1 = phi ptr [ %.057, %33 ], [ %20, %23 ], [ %20, %1 ], [ %20, %22 ]
  %38 = shl i32 %6, 3
  %39 = and i32 %38, 120
  %40 = shl i32 %16, 3
  %41 = and i32 %40, 56
  %42 = shl i32 %18, 3
  %43 = and i32 %42, 56
  %44 = getelementptr inbounds i8, ptr %0, i64 216
  %45 = load i32, ptr %44, align 8, !tbaa !19
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %37
  %47 = getelementptr inbounds i8, ptr %0, i64 9400
  %48 = getelementptr inbounds i8, ptr %0, i64 11448
  %49 = getelementptr inbounds i8, ptr %0, i64 12472
  %50 = getelementptr inbounds i8, ptr %0, i64 10424
  br label %51

._crit_edge:                                      ; preds = %51, %37
  ret void

51:                                               ; preds = %.lr.ph, %51
  %.063 = phi ptr [ %11, %.lr.ph ], [ %121, %51 ]
  %.05962 = phi i32 [ 0, %.lr.ph ], [ %122, %51 ]
  %52 = shl i32 %.05962, 5
  %53 = and i32 %52, -256
  %54 = and i32 %.05962, 7
  %55 = or disjoint i32 %53, %54
  %56 = or disjoint i32 %55, %39
  %57 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %56)
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %.1, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !20
  %61 = zext i8 %60 to i32
  %62 = or disjoint i32 %41, %55
  %63 = or disjoint i32 %62, 128
  %64 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %63)
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i8, ptr %.058, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !20
  %68 = zext i8 %67 to i32
  %69 = or disjoint i32 %62, 192
  %70 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %69)
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i8, ptr %.058, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !20
  %74 = zext i8 %73 to i32
  %75 = or disjoint i32 %43, %55
  %76 = or disjoint i32 %75, 128
  %77 = load ptr, ptr %19, align 8, !tbaa !15
  %78 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %76)
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %77, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !20
  %82 = zext i8 %81 to i32
  %83 = load ptr, ptr %19, align 8, !tbaa !15
  %84 = or disjoint i32 %75, 192
  %85 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %84)
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %83, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !20
  %89 = zext i8 %88 to i32
  %90 = mul nuw nsw i32 %13, %68
  %91 = mul nuw nsw i32 %14, %82
  %92 = add nuw nsw i32 %90, 2
  %93 = add nuw nsw i32 %92, %91
  %94 = lshr i32 %93, 2
  %95 = mul nuw nsw i32 %13, %74
  %96 = mul nuw nsw i32 %14, %89
  %97 = add nuw nsw i32 %95, 2
  %98 = add nuw nsw i32 %97, %96
  %99 = lshr i32 %98, 2
  %100 = zext nneg i32 %99 to i64
  %101 = getelementptr inbounds [256 x i32], ptr %47, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !21
  %103 = getelementptr inbounds [256 x i32], ptr %48, i64 0, i64 %100
  %104 = load i32, ptr %103, align 4, !tbaa !21
  %105 = zext nneg i32 %94 to i64
  %106 = getelementptr inbounds [256 x i32], ptr %49, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !21
  %108 = add nsw i32 %107, %104
  %109 = ashr i32 %108, 16
  %110 = getelementptr inbounds [256 x i32], ptr %50, i64 0, i64 %105
  %111 = load i32, ptr %110, align 4, !tbaa !21
  %112 = add nsw i32 %102, %61
  %113 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %112)
  store i8 %113, ptr %.063, align 1, !tbaa !20
  %114 = add nsw i32 %109, %61
  %115 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %114)
  %116 = getelementptr inbounds i8, ptr %.063, i64 1
  store i8 %115, ptr %116, align 1, !tbaa !20
  %117 = add nsw i32 %111, %61
  %118 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %117)
  %119 = getelementptr inbounds i8, ptr %.063, i64 2
  store i8 %118, ptr %119, align 1, !tbaa !20
  %120 = getelementptr inbounds i8, ptr %.063, i64 3
  store i8 -1, ptr %120, align 1, !tbaa !20
  %121 = getelementptr inbounds i8, ptr %.063, i64 4
  %122 = add nuw nsw i32 %.05962, 1
  %123 = load i32, ptr %44, align 8, !tbaa !19
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %51, label %._crit_edge, !llvm.loop !22
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { noreturn 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, !9, i64 220}
!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 = !{!6, !9, i64 644}
!14 = !{!6, !10, i64 13496}
!15 = !{!6, !10, i64 9384}
!16 = !{!6, !12, i64 13522}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!6, !9, i64 216}
!20 = !{!7, !7, i64 0}
!21 = !{!9, !9, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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