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

; 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: 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_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4jpgd12jpeg_decoder20calc_mcu_block_orderEv(ptr noundef nonnull align 8 dereferenceable(13523)) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder11decode_scanEPFvPS0_iiiE(ptr noundef nonnull align 8 dereferenceable(13523), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder16init_progressiveEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) #4 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 i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %11 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 14
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = icmp eq i32 %12, 4
  br i1 %13, label %14, label %15

14:                                               ; preds = %1
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -232) #6
  unreachable

15:                                               ; preds = %1
  store i32 0, ptr %3, align 4, !tbaa !14
  br label %16

16:                                               ; preds = %64, %15
  %17 = load i32, ptr %3, align 4, !tbaa !14
  %18 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 14
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %21, label %67

21:                                               ; preds = %16
  %22 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 60
  %23 = load i32, ptr %22, align 4, !tbaa !15
  %24 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 15
  %25 = load i32, ptr %3, align 4, !tbaa !14
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [4 x i32], ptr %24, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = mul nsw i32 %23, %28
  %30 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 62
  %31 = load i32, ptr %30, align 4, !tbaa !16
  %32 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 16
  %33 = load i32, ptr %3, align 4, !tbaa !14
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [4 x i32], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !14
  %37 = mul nsw i32 %31, %36
  %38 = call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_openEiiii(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef %29, i32 noundef %37, i32 noundef 1, i32 noundef 1)
  %39 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 44
  %40 = load i32, ptr %3, align 4, !tbaa !14
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [4 x ptr], ptr %39, i64 0, i64 %41
  store ptr %38, ptr %42, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 60
  %44 = load i32, ptr %43, align 4, !tbaa !15
  %45 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 15
  %46 = load i32, ptr %3, align 4, !tbaa !14
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [4 x i32], ptr %45, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !14
  %50 = mul nsw i32 %44, %49
  %51 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 62
  %52 = load i32, ptr %51, align 4, !tbaa !16
  %53 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 16
  %54 = load i32, ptr %3, align 4, !tbaa !14
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !14
  %58 = mul nsw i32 %52, %57
  %59 = call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_openEiiii(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef %50, i32 noundef %58, i32 noundef 8, i32 noundef 8)
  %60 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 45
  %61 = load i32, ptr %3, align 4, !tbaa !14
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [4 x ptr], ptr %60, i64 0, i64 %62
  store ptr %59, ptr %63, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %21
  %65 = load i32, ptr %3, align 4, !tbaa !14
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !14
  br label %16, !llvm.loop !17

67:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1000, ptr %5, align 4, !tbaa !14
  br label %68

68:                                               ; preds = %145, %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %69 = call noundef i32 @_ZN4jpgd12jpeg_decoder9init_scanEv(ptr noundef nonnull align 8 dereferenceable(13523) %10)
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  store i32 5, ptr %9, align 4
  br label %143

72:                                               ; preds = %68
  %73 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 25
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = icmp eq i32 %74, 0
  %76 = zext i1 %75 to i32
  store i32 %76, ptr %6, align 4, !tbaa !14
  %77 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 28
  %78 = load i32, ptr %77, align 8, !tbaa !20
  %79 = icmp ne i32 %78, 0
  %80 = zext i1 %79 to i32
  store i32 %80, ptr %7, align 4, !tbaa !14
  %81 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 25
  %82 = load i32, ptr %81, align 4, !tbaa !19
  %83 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 26
  %84 = load i32, ptr %83, align 8, !tbaa !21
  %85 = icmp sgt i32 %82, %84
  br i1 %85, label %90, label %86

86:                                               ; preds = %72
  %87 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 26
  %88 = load i32, ptr %87, align 8, !tbaa !21
  %89 = icmp sgt i32 %88, 63
  br i1 %89, label %90, label %91

90:                                               ; preds = %86, %72
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -228) #6
  unreachable

91:                                               ; preds = %86
  %92 = load i32, ptr %6, align 4, !tbaa !14
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %100

94:                                               ; preds = %91
  %95 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 26
  %96 = load i32, ptr %95, align 8, !tbaa !21
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %94
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -228) #6
  unreachable

99:                                               ; preds = %94
  br label %106

100:                                              ; preds = %91
  %101 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 21
  %102 = load i32, ptr %101, align 8, !tbaa !22
  %103 = icmp ne i32 %102, 1
  br i1 %103, label %104, label %105

104:                                              ; preds = %100
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -228) #6
  unreachable

105:                                              ; preds = %100
  br label %106

106:                                              ; preds = %105, %99
  %107 = load i32, ptr %7, align 4, !tbaa !14
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %117

109:                                              ; preds = %106
  %110 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 27
  %111 = load i32, ptr %110, align 4, !tbaa !23
  %112 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 28
  %113 = load i32, ptr %112, align 8, !tbaa !20
  %114 = sub nsw i32 %113, 1
  %115 = icmp ne i32 %111, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -227) #6
  unreachable

117:                                              ; preds = %109, %106
  %118 = load i32, ptr %6, align 4, !tbaa !14
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %126

120:                                              ; preds = %117
  %121 = load i32, ptr %7, align 4, !tbaa !14
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %124

123:                                              ; preds = %120
  store ptr @_ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii, ptr %8, align 8, !tbaa !5
  br label %125

124:                                              ; preds = %120
  store ptr @_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii, ptr %8, align 8, !tbaa !5
  br label %125

125:                                              ; preds = %124, %123
  br label %132

126:                                              ; preds = %117
  %127 = load i32, ptr %7, align 4, !tbaa !14
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %126
  store ptr @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii, ptr %8, align 8, !tbaa !5
  br label %131

130:                                              ; preds = %126
  store ptr @_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii, ptr %8, align 8, !tbaa !5
  br label %131

131:                                              ; preds = %130, %129
  br label %132

132:                                              ; preds = %131, %125
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN4jpgd12jpeg_decoder11decode_scanEPFvPS0_iiiE(ptr noundef nonnull align 8 dereferenceable(13523) %10, ptr noundef %133)
  %134 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 55
  store i32 16, ptr %134, align 8, !tbaa !24
  %135 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef 16)
  %136 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef 16)
  %137 = load i32, ptr %4, align 4, !tbaa !14
  %138 = add i32 %137, 1
  store i32 %138, ptr %4, align 4, !tbaa !14
  %139 = load i32, ptr %4, align 4, !tbaa !14
  %140 = icmp ugt i32 %139, 1000
  br i1 %140, label %141, label %142

141:                                              ; preds = %132
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -224) #6
  unreachable

142:                                              ; preds = %132
  store i32 0, ptr %9, align 4
  br label %143

143:                                              ; preds = %142, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %144 = load i32, ptr %9, align 4
  switch i32 %144, label %168 [
    i32 0, label %145
    i32 5, label %146
  ]

145:                                              ; preds = %143
  br label %68, !llvm.loop !25

146:                                              ; preds = %143
  %147 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 14
  %148 = load i32, ptr %147, align 4, !tbaa !9
  %149 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 21
  store i32 %148, ptr %149, align 8, !tbaa !22
  store i32 0, ptr %3, align 4, !tbaa !14
  br label %150

150:                                              ; preds = %161, %146
  %151 = load i32, ptr %3, align 4, !tbaa !14
  %152 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 14
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = icmp slt i32 %151, %153
  br i1 %154, label %155, label %164

155:                                              ; preds = %150
  %156 = load i32, ptr %3, align 4, !tbaa !14
  %157 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %10, i32 0, i32 22
  %158 = load i32, ptr %3, align 4, !tbaa !14
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [4 x i32], ptr %157, i64 0, i64 %159
  store i32 %156, ptr %160, align 4, !tbaa !14
  br label %161

161:                                              ; preds = %155
  %162 = load i32, ptr %3, align 4, !tbaa !14
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %3, align 4, !tbaa !14
  br label %150, !llvm.loop !26

164:                                              ; preds = %150
  %165 = call noundef zeroext i1 @_ZN4jpgd12jpeg_decoder20calc_mcu_block_orderEv(ptr noundef nonnull align 8 dereferenceable(13523) %10)
  br i1 %165, label %167, label %166

166:                                              ; preds = %164
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %10, i32 noundef -230) #6
  unreachable

167:                                              ; preds = %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret void

168:                                              ; preds = %143
  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 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !11, i64 412}
!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 = !{!11, !11, i64 0}
!15 = !{!10, !11, i64 9308}
!16 = !{!10, !11, i64 9316}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !11, i64 564}
!20 = !{!10, !11, i64 576}
!21 = !{!10, !11, i64 568}
!22 = !{!10, !11, i64 512}
!23 = !{!10, !11, i64 572}
!24 = !{!10, !11, i64 9288}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}


; 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: 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_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4jpgd12jpeg_decoder20calc_mcu_block_orderEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4jpgd12jpeg_decoder9init_scanEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder11decode_scanEPFvPS0_iiiE(ptr noundef nonnull align 8 dereferenceable(13523), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder16init_progressiveEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) local_unnamed_addr #3 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 412
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 4
  br i1 %4, label %12, label %.preheader34

.preheader34:                                     ; preds = %1
  %5 = icmp sgt i32 %3, 0
  br i1 %5, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %.preheader34
  %6 = getelementptr inbounds i8, ptr %0, i64 9308
  %7 = getelementptr inbounds i8, ptr %0, i64 416
  %8 = getelementptr inbounds i8, ptr %0, i64 9316
  %9 = getelementptr inbounds i8, ptr %0, i64 432
  %10 = getelementptr inbounds i8, ptr %0, i64 736
  %11 = getelementptr inbounds i8, ptr %0, i64 768
  br label %19

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

.preheader:                                       ; preds = %19, %.preheader34
  %13 = getelementptr inbounds i8, ptr %0, i64 564
  %14 = getelementptr inbounds i8, ptr %0, i64 576
  %15 = getelementptr inbounds i8, ptr %0, i64 568
  %16 = getelementptr inbounds i8, ptr %0, i64 512
  %17 = getelementptr inbounds i8, ptr %0, i64 572
  %18 = getelementptr inbounds i8, ptr %0, i64 9288
  br label %41

19:                                               ; preds = %.lr.ph, %19
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %19 ]
  %20 = load i32, ptr %6, align 4, !tbaa !13
  %21 = getelementptr inbounds [4 x i32], ptr %7, i64 0, i64 %indvars.iv
  %22 = load i32, ptr %21, align 4, !tbaa !14
  %23 = mul nsw i32 %22, %20
  %24 = load i32, ptr %8, align 4, !tbaa !15
  %25 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 %indvars.iv
  %26 = load i32, ptr %25, align 4, !tbaa !14
  %27 = mul nsw i32 %26, %24
  %28 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_openEiiii(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %23, i32 noundef %27, i32 noundef 1, i32 noundef 1)
  %29 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 %indvars.iv
  store ptr %28, ptr %29, align 8, !tbaa !16
  %30 = load i32, ptr %6, align 4, !tbaa !13
  %31 = load i32, ptr %21, align 4, !tbaa !14
  %32 = mul nsw i32 %31, %30
  %33 = load i32, ptr %8, align 4, !tbaa !15
  %34 = load i32, ptr %25, align 4, !tbaa !14
  %35 = mul nsw i32 %34, %33
  %36 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder14coeff_buf_openEiiii(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef %32, i32 noundef %35, i32 noundef 8, i32 noundef 8)
  %37 = getelementptr inbounds [4 x ptr], ptr %11, i64 0, i64 %indvars.iv
  store ptr %36, ptr %37, align 8, !tbaa !16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next, %39
  br i1 %40, label %19, label %.preheader, !llvm.loop !17

41:                                               ; preds = %.preheader, %62
  %.023 = phi i32 [ %65, %62 ], [ 0, %.preheader ]
  %42 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder9init_scanEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %.not = icmp eq i32 %42, 0
  br i1 %.not, label %67, label %43

43:                                               ; preds = %41
  %44 = load i32, ptr %13, align 4, !tbaa !19
  %45 = icmp eq i32 %44, 0
  %46 = load i32, ptr %14, align 8, !tbaa !20
  %.not27 = icmp eq i32 %46, 0
  %47 = load i32, ptr %15, align 8, !tbaa !21
  %48 = icmp sgt i32 %44, %47
  %49 = icmp sgt i32 %47, 63
  %or.cond = or i1 %48, %49
  br i1 %or.cond, label %50, label %51

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

51:                                               ; preds = %43
  br i1 %45, label %52, label %54

52:                                               ; preds = %51
  %.not29 = icmp eq i32 %47, 0
  br i1 %.not29, label %57, label %53

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

54:                                               ; preds = %51
  %55 = load i32, ptr %16, align 8, !tbaa !22
  %.not28 = icmp eq i32 %55, 1
  br i1 %.not28, label %57, label %56

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

57:                                               ; preds = %54, %52
  br i1 %.not27, label %62, label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %17, align 4, !tbaa !23
  %60 = add nsw i32 %46, -1
  %.not30 = icmp eq i32 %59, %60
  br i1 %.not30, label %62, label %61

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

62:                                               ; preds = %58, %57
  %_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii._ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii = phi ptr [ @_ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii, %58 ], [ @_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii, %57 ]
  %_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii._ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii = phi ptr [ @_ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii, %58 ], [ @_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii, %57 ]
  %.021 = select i1 %45, ptr %_ZN4jpgd12jpeg_decoder21decode_block_dc_firstEPS0_iii._ZN4jpgd12jpeg_decoder22decode_block_dc_refineEPS0_iii, ptr %_ZN4jpgd12jpeg_decoder21decode_block_ac_firstEPS0_iii._ZN4jpgd12jpeg_decoder22decode_block_ac_refineEPS0_iii
  tail call void @_ZN4jpgd12jpeg_decoder11decode_scanEPFvPS0_iiiE(ptr noundef nonnull align 8 dereferenceable(13523) %0, ptr noundef nonnull %.021)
  store i32 16, ptr %18, align 8, !tbaa !24
  %63 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 16)
  %64 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 16)
  %65 = add nuw nsw i32 %.023, 1
  %exitcond = icmp eq i32 %65, 1001
  br i1 %exitcond, label %66, label %41

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

67:                                               ; preds = %41
  %68 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %68, ptr %16, align 8, !tbaa !22
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %.lr.ph37, label %._crit_edge

.lr.ph37:                                         ; preds = %67
  %70 = getelementptr inbounds i8, ptr %0, i64 516
  %wide.trip.count = zext nneg i32 %68 to i64
  %min.iters.check = icmp ult i32 %68, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph37
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %71 = getelementptr inbounds [4 x i32], ptr %70, i64 0, i64 %index
  %72 = getelementptr inbounds i8, ptr %71, i64 16
  store <4 x i32> %vec.ind, ptr %71, align 4, !tbaa !14
  store <4 x i32> %step.add, ptr %72, align 4, !tbaa !14
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %73 = icmp eq i64 %index.next, %n.vec
  br i1 %73, label %middle.block, label %vector.body, !llvm.loop !25

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph37
  %indvars.iv39.ph = phi i64 [ 0, %.lr.ph37 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv39 = phi i64 [ %indvars.iv.next40, %scalar.ph ], [ %indvars.iv39.ph, %scalar.ph.preheader ]
  %74 = getelementptr inbounds [4 x i32], ptr %70, i64 0, i64 %indvars.iv39
  %75 = trunc nuw nsw i64 %indvars.iv39 to i32
  store i32 %75, ptr %74, align 4, !tbaa !14
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count
  br i1 %exitcond42.not, label %._crit_edge, label %scalar.ph, !llvm.loop !28

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %67
  %76 = tail call noundef zeroext i1 @_ZN4jpgd12jpeg_decoder20calc_mcu_block_orderEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %._crit_edge
  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 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 = { 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 412}
!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 9308}
!14 = !{!9, !9, i64 0}
!15 = !{!6, !9, i64 9316}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !9, i64 564}
!20 = !{!6, !9, i64 576}
!21 = !{!6, !9, i64 568}
!22 = !{!6, !9, i64 512}
!23 = !{!6, !9, i64 572}
!24 = !{!6, !9, i64 9288}
!25 = distinct !{!25, !18, !26, !27}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !18, !27, !26}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass