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

; 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_decoder11H1V2ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %18 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 30
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 37
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = sub nsw i32 %19, %21
  store i32 %22, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %23 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 72
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  store ptr %24, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %25 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 73
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  store ptr %26, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %27 = load i32, ptr %3, align 4, !tbaa !15
  %28 = icmp slt i32 %27, 8
  br i1 %28, label %29, label %36

29:                                               ; preds = %1
  %30 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 66
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = load i32, ptr %3, align 4, !tbaa !15
  %33 = mul nsw i32 %32, 8
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %31, i64 %34
  store ptr %35, ptr %6, align 8, !tbaa !5
  br label %45

36:                                               ; preds = %1
  %37 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 66
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %38, i64 64
  %40 = load i32, ptr %3, align 4, !tbaa !15
  %41 = and i32 %40, 7
  %42 = mul nsw i32 %41, 8
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i8, ptr %39, i64 %43
  store ptr %44, ptr %6, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %36, %29
  %46 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 66
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = getelementptr inbounds i8, ptr %47, i64 128
  %49 = load i32, ptr %3, align 4, !tbaa !15
  %50 = ashr i32 %49, 1
  %51 = mul nsw i32 %50, 8
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %48, i64 %52
  store ptr %53, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %54 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 60
  %55 = load i32, ptr %54, align 4, !tbaa !19
  store i32 %55, ptr %8, align 4, !tbaa !15
  br label %56

56:                                               ; preds = %167, %45
  %57 = load i32, ptr %8, align 4, !tbaa !15
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %170

60:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !15
  br label %61

61:                                               ; preds = %159, %60
  %62 = load i32, ptr %10, align 4, !tbaa !15
  %63 = icmp slt i32 %62, 8
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %162

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = load i32, ptr %10, align 4, !tbaa !15
  %68 = add nsw i32 0, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i8, ptr %66, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !20
  %72 = zext i8 %71 to i32
  store i32 %72, ptr %11, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load i32, ptr %10, align 4, !tbaa !15
  %75 = add nsw i32 64, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %73, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !20
  %79 = zext i8 %78 to i32
  store i32 %79, ptr %12, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %80 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 68
  %81 = load i32, ptr %12, align 4, !tbaa !15
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [256 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !15
  store i32 %84, ptr %13, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %85 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 70
  %86 = load i32, ptr %12, align 4, !tbaa !15
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [256 x i32], ptr %85, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !15
  %90 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 71
  %91 = load i32, ptr %11, align 4, !tbaa !15
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [256 x i32], ptr %90, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !15
  %95 = add nsw i32 %89, %94
  %96 = ashr i32 %95, 16
  store i32 %96, ptr %14, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %97 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %17, i32 0, i32 69
  %98 = load i32, ptr %11, align 4, !tbaa !15
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [256 x i32], ptr %97, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !15
  store i32 %101, ptr %15, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %10, align 4, !tbaa !15
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i8, ptr %102, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !20
  %107 = zext i8 %106 to i32
  store i32 %107, ptr %16, align 4, !tbaa !15
  %108 = load i32, ptr %16, align 4, !tbaa !15
  %109 = load i32, ptr %13, align 4, !tbaa !15
  %110 = add nsw i32 %108, %109
  %111 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %110)
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %112, i64 0
  store i8 %111, ptr %113, align 1, !tbaa !20
  %114 = load i32, ptr %16, align 4, !tbaa !15
  %115 = load i32, ptr %14, align 4, !tbaa !15
  %116 = add nsw i32 %114, %115
  %117 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %116)
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds i8, ptr %118, i64 1
  store i8 %117, ptr %119, align 1, !tbaa !20
  %120 = load i32, ptr %16, align 4, !tbaa !15
  %121 = load i32, ptr %15, align 4, !tbaa !15
  %122 = add nsw i32 %120, %121
  %123 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %122)
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i64 2
  store i8 %123, ptr %125, align 1, !tbaa !20
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds i8, ptr %126, i64 3
  store i8 -1, ptr %127, align 1, !tbaa !20
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = load i32, ptr %10, align 4, !tbaa !15
  %130 = add nsw i32 8, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i8, ptr %128, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !20
  %134 = zext i8 %133 to i32
  store i32 %134, ptr %16, align 4, !tbaa !15
  %135 = load i32, ptr %16, align 4, !tbaa !15
  %136 = load i32, ptr %13, align 4, !tbaa !15
  %137 = add nsw i32 %135, %136
  %138 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %137)
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds i8, ptr %139, i64 0
  store i8 %138, ptr %140, align 1, !tbaa !20
  %141 = load i32, ptr %16, align 4, !tbaa !15
  %142 = load i32, ptr %14, align 4, !tbaa !15
  %143 = add nsw i32 %141, %142
  %144 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %143)
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = getelementptr inbounds i8, ptr %145, i64 1
  store i8 %144, ptr %146, align 1, !tbaa !20
  %147 = load i32, ptr %16, align 4, !tbaa !15
  %148 = load i32, ptr %15, align 4, !tbaa !15
  %149 = add nsw i32 %147, %148
  %150 = call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %149)
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds i8, ptr %151, i64 2
  store i8 %150, ptr %152, align 1, !tbaa !20
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds i8, ptr %153, i64 3
  store i8 -1, ptr %154, align 1, !tbaa !20
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 4
  store ptr %156, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds i8, ptr %157, i64 4
  store ptr %158, ptr %5, align 8, !tbaa !5
  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
  br label %159

159:                                              ; preds = %65
  %160 = load i32, ptr %10, align 4, !tbaa !15
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %10, align 4, !tbaa !15
  br label %61, !llvm.loop !21

162:                                              ; preds = %64
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i64 256
  store ptr %164, ptr %6, align 8, !tbaa !5
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = getelementptr inbounds i8, ptr %165, i64 256
  store ptr %166, ptr %7, align 8, !tbaa !5
  br label %167

167:                                              ; preds = %162
  %168 = load i32, ptr %8, align 4, !tbaa !15
  %169 = add nsw i32 %168, -1
  store i32 %169, ptr %8, align 4, !tbaa !15
  br label %56, !llvm.loop !23

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

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


; 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_decoder11H1V2ConvertEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(13523) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 9308
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader.lr.ph, label %._crit_edge

.preheader.lr.ph:                                 ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 584
  %6 = load i32, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 648
  %8 = load i32, ptr %7, align 8, !tbaa !14
  %9 = sub nsw i32 %6, %8
  %10 = icmp slt i32 %9, 8
  %11 = getelementptr inbounds i8, ptr %0, i64 9384
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = shl nsw i32 %9, 3
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i8, ptr %12, i64 %14
  %16 = getelementptr inbounds i8, ptr %12, i64 64
  %17 = shl i32 %9, 3
  %18 = and i32 %17, 56
  %19 = zext nneg i32 %18 to i64
  %20 = getelementptr inbounds i8, ptr %16, i64 %19
  %.046 = select i1 %10, ptr %15, ptr %20
  %21 = getelementptr inbounds i8, ptr %0, i64 13504
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 13496
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = getelementptr inbounds i8, ptr %12, i64 128
  %26 = shl nsw i32 %9, 2
  %27 = and i32 %26, -8
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %25, i64 %28
  %30 = getelementptr inbounds i8, ptr %0, i64 9400
  %31 = getelementptr inbounds i8, ptr %0, i64 11448
  %32 = getelementptr inbounds i8, ptr %0, i64 12472
  %33 = getelementptr inbounds i8, ptr %0, i64 10424
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %34
  %.060 = phi ptr [ %24, %.preheader.lr.ph ], [ %82, %34 ]
  %.04459 = phi ptr [ %22, %.preheader.lr.ph ], [ %83, %34 ]
  %.14758 = phi ptr [ %.046, %.preheader.lr.ph ], [ %35, %34 ]
  %.04857 = phi ptr [ %29, %.preheader.lr.ph ], [ %36, %34 ]
  %.04956 = phi i32 [ %3, %.preheader.lr.ph ], [ %37, %34 ]
  br label %39

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

34:                                               ; preds = %39
  %35 = getelementptr inbounds i8, ptr %.14758, i64 256
  %36 = getelementptr inbounds i8, ptr %.04857, i64 256
  %37 = add nsw i32 %.04956, -1
  %38 = icmp sgt i32 %.04956, 1
  br i1 %38, label %.preheader, label %._crit_edge, !llvm.loop !18

39:                                               ; preds = %.preheader, %39
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %39 ]
  %.155 = phi ptr [ %.060, %.preheader ], [ %82, %39 ]
  %.14554 = phi ptr [ %.04459, %.preheader ], [ %83, %39 ]
  %40 = getelementptr inbounds i8, ptr %.04857, i64 %indvars.iv
  %41 = load i8, ptr %40, align 1, !tbaa !20
  %42 = or disjoint i64 %indvars.iv, 64
  %43 = getelementptr inbounds i8, ptr %.04857, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !20
  %45 = zext i8 %44 to i64
  %46 = getelementptr inbounds [256 x i32], ptr %30, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !21
  %48 = getelementptr inbounds [256 x i32], ptr %31, i64 0, i64 %45
  %49 = load i32, ptr %48, align 4, !tbaa !21
  %50 = zext i8 %41 to i64
  %51 = getelementptr inbounds [256 x i32], ptr %32, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = add nsw i32 %52, %49
  %54 = ashr i32 %53, 16
  %55 = getelementptr inbounds [256 x i32], ptr %33, i64 0, i64 %50
  %56 = load i32, ptr %55, align 4, !tbaa !21
  %57 = getelementptr inbounds i8, ptr %.14758, i64 %indvars.iv
  %58 = load i8, ptr %57, align 1, !tbaa !20
  %59 = zext i8 %58 to i32
  %60 = add nsw i32 %47, %59
  %61 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %60)
  store i8 %61, ptr %.155, align 1, !tbaa !20
  %62 = add nsw i32 %54, %59
  %63 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %62)
  %64 = getelementptr inbounds i8, ptr %.155, i64 1
  store i8 %63, ptr %64, align 1, !tbaa !20
  %65 = add nsw i32 %56, %59
  %66 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %65)
  %67 = getelementptr inbounds i8, ptr %.155, i64 2
  store i8 %66, ptr %67, align 1, !tbaa !20
  %68 = getelementptr inbounds i8, ptr %.155, i64 3
  store i8 -1, ptr %68, align 1, !tbaa !20
  %69 = or disjoint i64 %indvars.iv, 8
  %70 = getelementptr inbounds i8, ptr %.14758, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !20
  %72 = zext i8 %71 to i32
  %73 = add nsw i32 %47, %72
  %74 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %73)
  store i8 %74, ptr %.14554, align 1, !tbaa !20
  %75 = add nsw i32 %54, %72
  %76 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %75)
  %77 = getelementptr inbounds i8, ptr %.14554, i64 1
  store i8 %76, ptr %77, align 1, !tbaa !20
  %78 = add nsw i32 %56, %72
  %79 = tail call noundef zeroext i8 @_ZN4jpgd12jpeg_decoder5clampEi(i32 noundef %78)
  %80 = getelementptr inbounds i8, ptr %.14554, i64 2
  store i8 %79, ptr %80, align 1, !tbaa !20
  %81 = getelementptr inbounds i8, ptr %.14554, i64 3
  store i8 -1, ptr %81, align 1, !tbaa !20
  %82 = getelementptr inbounds i8, ptr %.155, i64 4
  %83 = getelementptr inbounds i8, ptr %.14554, i64 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond.not, label %34, label %39, !llvm.loop !22
}

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

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


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