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

; 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 uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder11H1V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523)) #1 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13523) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  %14 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 74
  %15 = load i32, ptr %14, align 8, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %21, label %17

17:                                               ; preds = %3
  %18 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 76
  %19 = load i8, ptr %18, align 8, !tbaa !14, !range !15, !noundef !16
  %20 = trunc i8 %19 to i1
  br i1 %20, label %22, label %21

21:                                               ; preds = %17, %3
  store i32 -1, ptr %4, align 4
  br label %185

22:                                               ; preds = %17
  %23 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 36
  %24 = load i32, ptr %23, align 4, !tbaa !17
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  store i32 1, ptr %4, align 4
  br label %185

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %28 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !18
  %30 = and i32 %29, 1
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %42

32:                                               ; preds = %27
  %33 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 13
  %34 = load i32, ptr %33, align 8, !tbaa !19
  %35 = icmp eq i32 %34, 4
  br i1 %35, label %40, label %36

36:                                               ; preds = %32
  %37 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 13
  %38 = load i32, ptr %37, align 8, !tbaa !19
  %39 = icmp eq i32 %38, 3
  br label %40

40:                                               ; preds = %36, %32
  %41 = phi i1 [ true, %32 ], [ %39, %36 ]
  br label %42

42:                                               ; preds = %40, %27
  %43 = phi i1 [ false, %27 ], [ %41, %40 ]
  %44 = zext i1 %43 to i8
  store i8 %44, ptr %8, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  store i8 0, ptr %9, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  store i8 0, ptr %10, align 1, !tbaa !20
  %45 = load i8, ptr %8, align 1, !tbaa !20, !range !15, !noundef !16
  %46 = trunc i8 %45 to i1
  br i1 %46, label %47, label %65

47:                                               ; preds = %42
  %48 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 36
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %50 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 5
  %51 = load i32, ptr %50, align 4, !tbaa !21
  %52 = icmp eq i32 %49, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  store i8 1, ptr %9, align 1, !tbaa !20
  br label %64

54:                                               ; preds = %47
  %55 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 37
  %56 = load i32, ptr %55, align 8, !tbaa !22
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %63

58:                                               ; preds = %54
  %59 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 36
  %60 = load i32, ptr %59, align 4, !tbaa !17
  %61 = icmp sgt i32 %60, 1
  br i1 %61, label %62, label %63

62:                                               ; preds = %58
  store i8 1, ptr %9, align 1, !tbaa !20
  store i8 1, ptr %10, align 1, !tbaa !20
  br label %63

63:                                               ; preds = %62, %58, %54
  br label %64

64:                                               ; preds = %63, %53
  br label %70

65:                                               ; preds = %42
  %66 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 37
  %67 = load i32, ptr %66, align 8, !tbaa !22
  %68 = icmp eq i32 %67, 0
  %69 = zext i1 %68 to i8
  store i8 %69, ptr %9, align 1, !tbaa !20
  br label %70

70:                                               ; preds = %65, %64
  %71 = load i8, ptr %9, align 1, !tbaa !20, !range !15, !noundef !16
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %83

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %74 = call noundef i32 @_ZN4jpgd12jpeg_decoder19decode_next_mcu_rowEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  store i32 %74, ptr %11, align 4, !tbaa !23
  %75 = load i32, ptr %11, align 4, !tbaa !23
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %73
  %78 = load i32, ptr %11, align 4, !tbaa !23
  store i32 %78, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %80

79:                                               ; preds = %73
  store i32 0, ptr %12, align 4
  br label %80

80:                                               ; preds = %79, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %81 = load i32, ptr %12, align 4
  switch i32 %81, label %184 [
    i32 0, label %82
  ]

82:                                               ; preds = %80
  br label %83

83:                                               ; preds = %82, %70
  %84 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 13
  %85 = load i32, ptr %84, align 8, !tbaa !19
  switch i32 %85, label %170 [
    i32 4, label %86
    i32 2, label %129
    i32 3, label %140
    i32 1, label %162
    i32 0, label %166
  ]

86:                                               ; preds = %83
  %87 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 1
  %88 = load i32, ptr %87, align 8, !tbaa !18
  %89 = and i32 %88, 1
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %114

91:                                               ; preds = %86
  %92 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 38
  %93 = load i32, ptr %92, align 4, !tbaa !24
  %94 = icmp eq i32 %93, 1
  br i1 %94, label %95, label %99

95:                                               ; preds = %91
  %96 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 73
  %97 = load ptr, ptr %96, align 8, !tbaa !25
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %97, ptr %98, align 8, !tbaa !5
  br label %110

99:                                               ; preds = %91
  %100 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 38
  %101 = load i32, ptr %100, align 4, !tbaa !24
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %109

103:                                              ; preds = %99
  %104 = call noundef i32 @_ZN4jpgd12jpeg_decoder19H2V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %105 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 38
  store i32 %104, ptr %105, align 4, !tbaa !24
  %106 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %107 = load ptr, ptr %106, align 8, !tbaa !26
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %107, ptr %108, align 8, !tbaa !5
  br label %109

109:                                              ; preds = %103, %99
  br label %110

110:                                              ; preds = %109, %95
  %111 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 38
  %112 = load i32, ptr %111, align 4, !tbaa !24
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %111, align 4, !tbaa !24
  br label %128

114:                                              ; preds = %86
  %115 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 37
  %116 = load i32, ptr %115, align 8, !tbaa !22
  %117 = and i32 %116, 1
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %123

119:                                              ; preds = %114
  call void @_ZN4jpgd12jpeg_decoder11H2V2ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %120 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %121 = load ptr, ptr %120, align 8, !tbaa !26
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %121, ptr %122, align 8, !tbaa !5
  br label %127

123:                                              ; preds = %114
  %124 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 73
  %125 = load ptr, ptr %124, align 8, !tbaa !25
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %125, ptr %126, align 8, !tbaa !5
  br label %127

127:                                              ; preds = %123, %119
  br label %128

128:                                              ; preds = %127, %110
  br label %170

129:                                              ; preds = %83
  %130 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 1
  %131 = load i32, ptr %130, align 8, !tbaa !18
  %132 = and i32 %131, 1
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %129
  call void @_ZN4jpgd12jpeg_decoder19H2V1ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  br label %136

135:                                              ; preds = %129
  call void @_ZN4jpgd12jpeg_decoder11H2V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  br label %136

136:                                              ; preds = %135, %134
  %137 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %138 = load ptr, ptr %137, align 8, !tbaa !26
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %138, ptr %139, align 8, !tbaa !5
  br label %170

140:                                              ; preds = %83
  %141 = load i8, ptr %8, align 1, !tbaa !20, !range !15, !noundef !16
  %142 = trunc i8 %141 to i1
  br i1 %142, label %143, label %147

143:                                              ; preds = %140
  call void @_ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %144 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %145 = load ptr, ptr %144, align 8, !tbaa !26
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %145, ptr %146, align 8, !tbaa !5
  br label %161

147:                                              ; preds = %140
  %148 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 37
  %149 = load i32, ptr %148, align 8, !tbaa !22
  %150 = and i32 %149, 1
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %152, label %156

152:                                              ; preds = %147
  call void @_ZN4jpgd12jpeg_decoder11H1V2ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %153 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %154 = load ptr, ptr %153, align 8, !tbaa !26
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %154, ptr %155, align 8, !tbaa !5
  br label %160

156:                                              ; preds = %147
  %157 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 73
  %158 = load ptr, ptr %157, align 8, !tbaa !25
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %158, ptr %159, align 8, !tbaa !5
  br label %160

160:                                              ; preds = %156, %152
  br label %161

161:                                              ; preds = %160, %143
  br label %170

162:                                              ; preds = %83
  call void @_ZN4jpgd12jpeg_decoder11H1V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %163 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %164 = load ptr, ptr %163, align 8, !tbaa !26
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %164, ptr %165, align 8, !tbaa !5
  br label %170

166:                                              ; preds = %83
  call void @_ZN4jpgd12jpeg_decoder12gray_convertEv(ptr noundef nonnull align 8 dereferenceable(13523) %13)
  %167 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 72
  %168 = load ptr, ptr %167, align 8, !tbaa !26
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %168, ptr %169, align 8, !tbaa !5
  br label %170

170:                                              ; preds = %166, %162, %161, %136, %128, %83
  %171 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 39
  %172 = load i32, ptr %171, align 8, !tbaa !27
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %172, ptr %173, align 4, !tbaa !23
  %174 = load i8, ptr %10, align 1, !tbaa !20, !range !15, !noundef !16
  %175 = trunc i8 %174 to i1
  br i1 %175, label %180, label %176

176:                                              ; preds = %170
  %177 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 37
  %178 = load i32, ptr %177, align 8, !tbaa !22
  %179 = add nsw i32 %178, -1
  store i32 %179, ptr %177, align 8, !tbaa !22
  br label %180

180:                                              ; preds = %176, %170
  %181 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %13, i32 0, i32 36
  %182 = load i32, ptr %181, align 4, !tbaa !17
  %183 = add nsw i32 %182, -1
  store i32 %183, ptr %181, align 4, !tbaa !17
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %184

184:                                              ; preds = %180, %80
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  br label %185

185:                                              ; preds = %184, %26, %21
  %186 = load i32, ptr %4, align 4
  ret i32 %186
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !12, i64 13512}
!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, !13, i64 13520}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!10, !11, i64 644}
!18 = !{!10, !11, i64 200}
!19 = !{!10, !11, i64 408}
!20 = !{!13, !13, i64 0}
!21 = !{!10, !11, i64 220}
!22 = !{!10, !11, i64 648}
!23 = !{!11, !11, i64 0}
!24 = !{!10, !11, i64 652}
!25 = !{!10, !6, i64 13504}
!26 = !{!10, !6, i64 13496}
!27 = !{!10, !11, i64 656}


; 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 uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder11H1V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4jpgd12jpeg_decoder12gray_convertEv(ptr noundef nonnull align 8 dereferenceable(13523)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4jpgd12jpeg_decoder6decodeEPPKvPj(ptr noundef nonnull align 8 dereferenceable(13523) %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 13512
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %102

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 13520
  %8 = load i8, ptr %7, align 8, !tbaa !13, !range !14, !noundef !15
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %10, label %102

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 644
  %12 = load i32, ptr %11, align 4, !tbaa !16
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %102, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 200
  %16 = load i32, ptr %15, align 8, !tbaa !17
  %17 = and i32 %16, 1
  %.not25 = icmp eq i32 %17, 0
  br i1 %.not25, label %.thread, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 408
  %20 = load i32, ptr %19, align 8, !tbaa !18
  %.off = add i32 %20, -3
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %21, label %.thread

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 220
  %23 = load i32, ptr %22, align 4, !tbaa !19
  %24 = icmp eq i32 %12, %23
  br i1 %24, label %.thread31, label %28

.thread:                                          ; preds = %18, %14
  %25 = getelementptr inbounds i8, ptr %0, i64 648
  %26 = load i32, ptr %25, align 8, !tbaa !20
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %.thread31, label %35

28:                                               ; preds = %21
  %29 = getelementptr inbounds i8, ptr %0, i64 648
  %30 = load i32, ptr %29, align 8, !tbaa !20
  %31 = icmp eq i32 %30, 1
  %32 = icmp sgt i32 %12, 1
  %or.cond = and i1 %32, %31
  br i1 %or.cond, label %.thread31, label %35

.thread31:                                        ; preds = %21, %.thread, %28
  %.02035 = phi i1 [ true, %28 ], [ false, %.thread ], [ false, %21 ]
  %33 = phi i1 [ true, %28 ], [ false, %.thread ], [ true, %21 ]
  %34 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19decode_next_mcu_rowEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %.not26 = icmp eq i32 %34, 0
  br i1 %.not26, label %35, label %102

35:                                               ; preds = %.thread, %.thread31, %28
  %.02034 = phi i1 [ %.02035, %.thread31 ], [ false, %28 ], [ false, %.thread ]
  %36 = phi i1 [ %33, %.thread31 ], [ true, %28 ], [ false, %.thread ]
  %37 = getelementptr inbounds i8, ptr %0, i64 408
  %38 = load i32, ptr %37, align 8, !tbaa !18
  switch i32 %38, label %92 [
    i32 4, label %39
    i32 2, label %63
    i32 3, label %71
    i32 1, label %86
    i32 0, label %89
  ]

39:                                               ; preds = %35
  %40 = load i32, ptr %15, align 8, !tbaa !17
  %41 = and i32 %40, 1
  %.not28 = icmp eq i32 %41, 0
  br i1 %.not28, label %52, label %42

42:                                               ; preds = %39
  %43 = getelementptr inbounds i8, ptr %0, i64 652
  %44 = load i32, ptr %43, align 4, !tbaa !21
  switch i32 %44, label %49 [
    i32 1, label %.sink.split
    i32 0, label %45
  ]

45:                                               ; preds = %42
  %46 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder19H2V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  br label %.sink.split

.sink.split:                                      ; preds = %42, %45
  %.sink = phi i64 [ 13496, %45 ], [ 13504, %42 ]
  %.ph = phi i32 [ %46, %45 ], [ %44, %42 ]
  %47 = getelementptr inbounds i8, ptr %0, i64 %.sink
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  store ptr %48, ptr %1, align 8, !tbaa !22
  br label %49

49:                                               ; preds = %.sink.split, %42
  %50 = phi i32 [ %44, %42 ], [ %.ph, %.sink.split ]
  %51 = add nsw i32 %50, -1
  store i32 %51, ptr %43, align 4, !tbaa !21
  br label %92

52:                                               ; preds = %39
  %53 = getelementptr inbounds i8, ptr %0, i64 648
  %54 = load i32, ptr %53, align 8, !tbaa !20
  %55 = and i32 %54, 1
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %60

57:                                               ; preds = %52
  tail call void @_ZN4jpgd12jpeg_decoder11H2V2ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %58 = getelementptr inbounds i8, ptr %0, i64 13496
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  store ptr %59, ptr %1, align 8, !tbaa !22
  br label %92

60:                                               ; preds = %52
  %61 = getelementptr inbounds i8, ptr %0, i64 13504
  %62 = load ptr, ptr %61, align 8, !tbaa !24
  store ptr %62, ptr %1, align 8, !tbaa !22
  br label %92

63:                                               ; preds = %35
  %64 = load i32, ptr %15, align 8, !tbaa !17
  %65 = and i32 %64, 1
  %.not27 = icmp eq i32 %65, 0
  br i1 %.not27, label %67, label %66

66:                                               ; preds = %63
  tail call void @_ZN4jpgd12jpeg_decoder19H2V1ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  br label %68

67:                                               ; preds = %63
  tail call void @_ZN4jpgd12jpeg_decoder11H2V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  br label %68

68:                                               ; preds = %67, %66
  %69 = getelementptr inbounds i8, ptr %0, i64 13496
  %70 = load ptr, ptr %69, align 8, !tbaa !23
  store ptr %70, ptr %1, align 8, !tbaa !22
  br label %92

71:                                               ; preds = %35
  br i1 %36, label %72, label %75

72:                                               ; preds = %71
  tail call void @_ZN4jpgd12jpeg_decoder19H1V2ConvertFilteredEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %73 = getelementptr inbounds i8, ptr %0, i64 13496
  %74 = load ptr, ptr %73, align 8, !tbaa !23
  store ptr %74, ptr %1, align 8, !tbaa !22
  br label %92

75:                                               ; preds = %71
  %76 = getelementptr inbounds i8, ptr %0, i64 648
  %77 = load i32, ptr %76, align 8, !tbaa !20
  %78 = and i32 %77, 1
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %83

80:                                               ; preds = %75
  tail call void @_ZN4jpgd12jpeg_decoder11H1V2ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %81 = getelementptr inbounds i8, ptr %0, i64 13496
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  store ptr %82, ptr %1, align 8, !tbaa !22
  br label %92

83:                                               ; preds = %75
  %84 = getelementptr inbounds i8, ptr %0, i64 13504
  %85 = load ptr, ptr %84, align 8, !tbaa !24
  store ptr %85, ptr %1, align 8, !tbaa !22
  br label %92

86:                                               ; preds = %35
  tail call void @_ZN4jpgd12jpeg_decoder11H1V1ConvertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %87 = getelementptr inbounds i8, ptr %0, i64 13496
  %88 = load ptr, ptr %87, align 8, !tbaa !23
  store ptr %88, ptr %1, align 8, !tbaa !22
  br label %92

89:                                               ; preds = %35
  tail call void @_ZN4jpgd12jpeg_decoder12gray_convertEv(ptr noundef nonnull align 8 dereferenceable(13523) %0)
  %90 = getelementptr inbounds i8, ptr %0, i64 13496
  %91 = load ptr, ptr %90, align 8, !tbaa !23
  store ptr %91, ptr %1, align 8, !tbaa !22
  br label %92

92:                                               ; preds = %72, %83, %80, %49, %60, %57, %89, %86, %68, %35
  %93 = getelementptr inbounds i8, ptr %0, i64 656
  %94 = load i32, ptr %93, align 8, !tbaa !25
  store i32 %94, ptr %2, align 4, !tbaa !26
  br i1 %.02034, label %99, label %95

95:                                               ; preds = %92
  %96 = getelementptr inbounds i8, ptr %0, i64 648
  %97 = load i32, ptr %96, align 8, !tbaa !20
  %98 = add nsw i32 %97, -1
  store i32 %98, ptr %96, align 8, !tbaa !20
  br label %99

99:                                               ; preds = %95, %92
  %100 = load i32, ptr %11, align 4, !tbaa !16
  %101 = add nsw i32 %100, -1
  store i32 %101, ptr %11, align 4, !tbaa !16
  br label %102

102:                                              ; preds = %99, %.thread31, %10, %3, %6
  %.2 = phi i32 [ -1, %6 ], [ -1, %3 ], [ 1, %10 ], [ 0, %99 ], [ %34, %.thread31 ]
  ret i32 %.2
}

attributes #0 = { 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 #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, !11, i64 13512}
!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, !12, i64 13520}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!6, !9, i64 644}
!17 = !{!6, !9, i64 200}
!18 = !{!6, !9, i64 408}
!19 = !{!6, !9, i64 220}
!20 = !{!6, !9, i64 648}
!21 = !{!6, !9, i64 652}
!22 = !{!10, !10, i64 0}
!23 = !{!6, !10, i64 13496}
!24 = !{!6, !10, i64 13504}
!25 = !{!6, !9, i64 656}
!26 = !{!9, !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass