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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

; Function Attrs: 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 dso_local noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder19H2V1ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %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 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
  store ptr %0, ptr %2, align 8, !tbaa !5
  %25 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 4, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %26 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 30
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 37
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = sub nsw i32 %27, %29
  store i32 %30, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %31 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 72
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  store ptr %32, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %33 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 4
  %34 = load i32, ptr %33, align 8, !tbaa !17
  %35 = ashr i32 %34, 1
  %36 = sub nsw i32 %35, 1
  store i32 %36, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = mul nsw i32 %37, 8
  store i32 %38, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %215, %1
  %40 = load i32, ptr %8, align 4, !tbaa !9
  %41 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !17
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %218

45:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %46 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 66
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = ashr i32 %48, 4
  %50 = mul i32 %49, 4
  %51 = mul i32 %50, 64
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = and i32 %52, 8
  %54 = icmp ne i32 %53, 0
  %55 = zext i1 %54 to i64
  %56 = select i1 %54, i32 64, i32 0
  %57 = add i32 %51, %56
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = and i32 %58, 7
  %60 = add i32 %57, %59
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = add i32 %60, %61
  %63 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %25, i32 noundef %62)
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %47, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !19
  %67 = zext i8 %66 to i32
  store i32 %67, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = sub nsw i32 %68, 1
  %70 = ashr i32 %69, 1
  store i32 %70, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %75, label %78

75:                                               ; preds = %45
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  br label %80

78:                                               ; preds = %45
  %79 = load i32, ptr %6, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %78, %75
  %81 = phi i32 [ %77, %75 ], [ %79, %78 ]
  store i32 %81, ptr %11, align 4, !tbaa !9
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %84, label %86

84:                                               ; preds = %80
  %85 = load i32, ptr %10, align 4, !tbaa !9
  br label %87

86:                                               ; preds = %80
  br label %87

87:                                               ; preds = %86, %84
  %88 = phi i32 [ %85, %84 ], [ 0, %86 ]
  store i32 %88, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = ashr i32 %89, 3
  %91 = mul i32 %90, 4
  %92 = mul i32 %91, 64
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = and i32 %93, 7
  %95 = add i32 %92, %94
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = add i32 %95, %96
  %98 = add i32 %97, 128
  store i32 %98, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %99 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 66
  %100 = load ptr, ptr %99, align 8, !tbaa !18
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %25, i32 noundef %101)
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i8, ptr %100, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !19
  %106 = zext i8 %105 to i32
  store i32 %106, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %107 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 66
  %108 = load ptr, ptr %107, align 8, !tbaa !18
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = add nsw i32 %109, 64
  %111 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %25, i32 noundef %110)
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds i8, ptr %108, i64 %112
  %114 = load i8, ptr %113, align 1, !tbaa !19
  %115 = zext i8 %114 to i32
  store i32 %115, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = ashr i32 %116, 3
  %118 = mul i32 %117, 4
  %119 = mul i32 %118, 64
  %120 = load i32, ptr %11, align 4, !tbaa !9
  %121 = and i32 %120, 7
  %122 = add i32 %119, %121
  %123 = load i32, ptr %7, align 4, !tbaa !9
  %124 = add i32 %122, %123
  %125 = add i32 %124, 128
  store i32 %125, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %126 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 66
  %127 = load ptr, ptr %126, align 8, !tbaa !18
  %128 = load i32, ptr %15, align 4, !tbaa !9
  %129 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %25, i32 noundef %128)
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i8, ptr %127, i64 %130
  %132 = load i8, ptr %131, align 1, !tbaa !19
  %133 = zext i8 %132 to i32
  store i32 %133, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %134 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 66
  %135 = load ptr, ptr %134, align 8, !tbaa !18
  %136 = load i32, ptr %15, align 4, !tbaa !9
  %137 = add nsw i32 %136, 64
  %138 = call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %25, i32 noundef %137)
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds i8, ptr %135, i64 %139
  %141 = load i8, ptr %140, align 1, !tbaa !19
  %142 = zext i8 %141 to i32
  store i32 %142, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %143 = load i32, ptr %8, align 4, !tbaa !9
  %144 = and i32 %143, 1
  %145 = icmp ne i32 %144, 0
  %146 = zext i1 %145 to i64
  %147 = select i1 %145, i32 3, i32 1
  store i32 %147, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %148 = load i32, ptr %8, align 4, !tbaa !9
  %149 = and i32 %148, 1
  %150 = icmp ne i32 %149, 0
  %151 = zext i1 %150 to i64
  %152 = select i1 %150, i32 1, i32 3
  store i32 %152, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %153 = load i32, ptr %13, align 4, !tbaa !9
  %154 = load i32, ptr %18, align 4, !tbaa !9
  %155 = mul nsw i32 %153, %154
  %156 = load i32, ptr %16, align 4, !tbaa !9
  %157 = load i32, ptr %19, align 4, !tbaa !9
  %158 = mul nsw i32 %156, %157
  %159 = add nsw i32 %155, %158
  %160 = add nsw i32 %159, 2
  %161 = ashr i32 %160, 2
  store i32 %161, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %162 = load i32, ptr %14, align 4, !tbaa !9
  %163 = load i32, ptr %18, align 4, !tbaa !9
  %164 = mul nsw i32 %162, %163
  %165 = load i32, ptr %17, align 4, !tbaa !9
  %166 = load i32, ptr %19, align 4, !tbaa !9
  %167 = mul nsw i32 %165, %166
  %168 = add nsw i32 %164, %167
  %169 = add nsw i32 %168, 2
  %170 = ashr i32 %169, 2
  store i32 %170, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %171 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 68
  %172 = load i32, ptr %21, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [256 x i32], ptr %171, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !9
  store i32 %175, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %176 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 70
  %177 = load i32, ptr %21, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [256 x i32], ptr %176, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !9
  %181 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 71
  %182 = load i32, ptr %20, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [256 x i32], ptr %181, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !9
  %186 = add nsw i32 %180, %185
  %187 = ashr i32 %186, 16
  store i32 %187, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %188 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %25, i32 0, i32 69
  %189 = load i32, ptr %20, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [256 x i32], ptr %188, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !9
  store i32 %192, ptr %24, align 4, !tbaa !9
  %193 = load i32, ptr %9, align 4, !tbaa !9
  %194 = load i32, ptr %22, align 4, !tbaa !9
  %195 = add nsw i32 %193, %194
  %196 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %195)
  %197 = load ptr, ptr %5, align 8, !tbaa !5
  %198 = getelementptr inbounds i8, ptr %197, i64 0
  store i8 %196, ptr %198, align 1, !tbaa !19
  %199 = load i32, ptr %9, align 4, !tbaa !9
  %200 = load i32, ptr %23, align 4, !tbaa !9
  %201 = add nsw i32 %199, %200
  %202 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %201)
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = getelementptr inbounds i8, ptr %203, i64 1
  store i8 %202, ptr %204, align 1, !tbaa !19
  %205 = load i32, ptr %9, align 4, !tbaa !9
  %206 = load i32, ptr %24, align 4, !tbaa !9
  %207 = add nsw i32 %205, %206
  %208 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %207)
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  %210 = getelementptr inbounds i8, ptr %209, i64 2
  store i8 %208, ptr %210, align 1, !tbaa !19
  %211 = load ptr, ptr %5, align 8, !tbaa !5
  %212 = getelementptr inbounds i8, ptr %211, i64 3
  store i8 -1, ptr %212, align 1, !tbaa !19
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds i8, ptr %213, i64 4
  store ptr %214, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %215

215:                                              ; preds = %87
  %216 = load i32, ptr %8, align 4, !tbaa !9
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %8, align 4, !tbaa !9
  br label %39, !llvm.loop !20

218:                                              ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

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 = { 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 = { 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 584}
!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 648}
!16 = !{!12, !6, i64 13496}
!17 = !{!12, !10, i64 216}
!18 = !{!12, !6, i64 9384}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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"

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder19H2V1ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 584
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 648
  %5 = load i32, ptr %4, align 8, !tbaa !13
  %6 = sub nsw i32 %3, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 216
  %8 = load i32, ptr %7, align 8, !tbaa !14
  %9 = ashr i32 %8, 1
  %10 = add nsw i32 %9, -1
  %11 = shl nsw i32 %6, 3
  %12 = icmp sgt i32 %8, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %13 = getelementptr inbounds i8, ptr %0, i64 13496
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 9384
  %16 = getelementptr inbounds i8, ptr %0, i64 9400
  %17 = getelementptr inbounds i8, ptr %0, i64 11448
  %18 = getelementptr inbounds i8, ptr %0, i64 12472
  %19 = getelementptr inbounds i8, ptr %0, i64 10424
  br label %20

._crit_edge:                                      ; preds = %20, %1
  ret void

20:                                               ; preds = %.lr.ph, %20
  %.051 = phi ptr [ %14, %.lr.ph ], [ %112, %20 ]
  %.04950 = phi i32 [ 0, %.lr.ph ], [ %113, %20 ]
  %21 = load ptr, ptr %15, align 8, !tbaa !16
  %22 = shl i32 %.04950, 4
  %23 = and i32 %22, -256
  %24 = shl i32 %.04950, 3
  %25 = and i32 %24, 64
  %26 = or disjoint i32 %23, %25
  %27 = and i32 %.04950, 7
  %28 = or disjoint i32 %27, %11
  %29 = add i32 %28, %26
  %30 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %29)
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %21, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !17
  %34 = zext i8 %33 to i32
  %35 = add nsw i32 %.04950, -1
  %36 = ashr i32 %35, 1
  %37 = add nsw i32 %36, 1
  %38 = tail call i32 @llvm.smin.i32(i32 %37, i32 %10)
  %39 = tail call i32 @llvm.smax.i32(i32 %36, i32 0)
  %40 = shl i32 %39, 5
  %41 = and i32 %40, -256
  %42 = and i32 %39, 7
  %43 = or disjoint i32 %41, %42
  %44 = add i32 %43, %11
  %45 = add i32 %44, 128
  %46 = load ptr, ptr %15, align 8, !tbaa !16
  %47 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %45)
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %46, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !17
  %51 = zext i8 %50 to i32
  %52 = load ptr, ptr %15, align 8, !tbaa !16
  %53 = add i32 %44, 192
  %54 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %53)
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %52, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !17
  %58 = zext i8 %57 to i32
  %59 = shl i32 %38, 5
  %60 = and i32 %59, -256
  %61 = and i32 %38, 7
  %62 = or disjoint i32 %60, %61
  %63 = add i32 %62, %11
  %64 = add i32 %63, 128
  %65 = load ptr, ptr %15, align 8, !tbaa !16
  %66 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %64)
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %65, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !17
  %70 = zext i8 %69 to i32
  %71 = load ptr, ptr %15, align 8, !tbaa !16
  %72 = add i32 %63, 192
  %73 = tail call noundef i32 @_ZNK4jpgd12jpeg_decoder20check_sample_buf_ofsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %72)
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i8, ptr %71, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !17
  %77 = zext i8 %76 to i32
  %78 = and i32 %.04950, 1
  %.not = icmp eq i32 %78, 0
  %79 = select i1 %.not, i32 1, i32 3
  %80 = select i1 %.not, i32 3, i32 1
  %81 = mul nuw nsw i32 %79, %51
  %82 = mul nuw nsw i32 %80, %70
  %83 = add nuw nsw i32 %81, 2
  %84 = add nuw nsw i32 %83, %82
  %85 = lshr i32 %84, 2
  %86 = mul nuw nsw i32 %79, %58
  %87 = mul nuw nsw i32 %80, %77
  %88 = add nuw nsw i32 %86, 2
  %89 = add nuw nsw i32 %88, %87
  %90 = lshr i32 %89, 2
  %91 = zext nneg i32 %90 to i64
  %92 = getelementptr inbounds [256 x i32], ptr %16, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !18
  %94 = getelementptr inbounds [256 x i32], ptr %17, i64 0, i64 %91
  %95 = load i32, ptr %94, align 4, !tbaa !18
  %96 = zext nneg i32 %85 to i64
  %97 = getelementptr inbounds [256 x i32], ptr %18, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !18
  %99 = add nsw i32 %98, %95
  %100 = ashr i32 %99, 16
  %101 = getelementptr inbounds [256 x i32], ptr %19, i64 0, i64 %96
  %102 = load i32, ptr %101, align 4, !tbaa !18
  %103 = add nsw i32 %93, %34
  %104 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %103)
  store i8 %104, ptr %.051, align 1, !tbaa !17
  %105 = add nsw i32 %100, %34
  %106 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %105)
  %107 = getelementptr inbounds i8, ptr %.051, i64 1
  store i8 %106, ptr %107, align 1, !tbaa !17
  %108 = add nsw i32 %102, %34
  %109 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %108)
  %110 = getelementptr inbounds i8, ptr %.051, i64 2
  store i8 %109, ptr %110, align 1, !tbaa !17
  %111 = getelementptr inbounds i8, ptr %.051, i64 3
  store i8 -1, ptr %111, align 1, !tbaa !17
  %112 = getelementptr inbounds i8, ptr %.051, i64 4
  %113 = add nuw nsw i32 %.04950, 1
  %114 = load i32, ptr %7, align 8, !tbaa !14
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %20, label %._crit_edge, !llvm.loop !19
}

; 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 #0 align 2

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

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

attributes #0 = { 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 #1 = { 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 nosync nounwind speculatable willreturn memory(none) }

!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 584}
!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 648}
!14 = !{!6, !9, i64 216}
!15 = !{!6, !10, i64 13496}
!16 = !{!6, !10, i64 9384}
!17 = !{!7, !7, i64 0}
!18 = !{!9, !9, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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