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

; 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: mustprogress uwtable
declare dso_local noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13523), i64 noundef, i1 noundef zeroext) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder15read_dht_markerEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [17 x i8], align 16
  %7 = alloca [256 x i8], align 16
  %8 = alloca i32, align 4
  %9 = alloca [256 x i8], align 16
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 17, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %12 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef 16)
  store i32 %12, ptr %8, align 4, !tbaa !9
  %13 = load i32, ptr %8, align 4, !tbaa !9
  %14 = icmp ult i32 %13, 2
  br i1 %14, label %15, label %16

15:                                               ; preds = %1
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -254) #7
  unreachable

16:                                               ; preds = %1
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = sub i32 %17, 2
  store i32 %18, ptr %8, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %126, %16
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %147

22:                                               ; preds = %19
  %23 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef 8)
  store i32 %23, ptr %4, align 4, !tbaa !9
  %24 = getelementptr inbounds [17 x i8], ptr %6, i64 0, i64 0
  store i8 0, ptr %24, align 16, !tbaa !11
  store i32 0, ptr %5, align 4, !tbaa !9
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %41, %22
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = icmp sle i32 %26, 16
  br i1 %27, label %28, label %44

28:                                               ; preds = %25
  %29 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef 8)
  %30 = trunc i32 %29 to i8
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [17 x i8], ptr %6, i64 0, i64 %32
  store i8 %30, ptr %33, align 1, !tbaa !11
  %34 = load i32, ptr %3, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [17 x i8], ptr %6, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = add nsw i32 %39, %38
  store i32 %40, ptr %5, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %28
  %42 = load i32, ptr %3, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !9
  br label %25, !llvm.loop !12

44:                                               ; preds = %25
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = icmp sgt i32 %45, 255
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -256) #7
  unreachable

48:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 256, ptr %9) #6
  %49 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %49, i8 0, i64 256, i1 false)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %71, %48
  %51 = load i32, ptr %3, align 4, !tbaa !9
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %74

54:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %55 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef 8)
  store i32 %55, ptr %10, align 4, !tbaa !9
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !14, !range !16, !noundef !17
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %62

61:                                               ; preds = %54
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -256) #7
  unreachable

62:                                               ; preds = %54
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = trunc i32 %63 to i8
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [256 x i8], ptr %7, i64 0, i64 %66
  store i8 %64, ptr %67, align 1, !tbaa !11
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %69
  store i8 1, ptr %70, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %71

71:                                               ; preds = %62
  %72 = load i32, ptr %3, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !9
  br label %50, !llvm.loop !18

74:                                               ; preds = %50
  %75 = load i32, ptr %5, align 4, !tbaa !9
  %76 = add nsw i32 17, %75
  store i32 %76, ptr %3, align 4, !tbaa !9
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = load i32, ptr %3, align 4, !tbaa !9
  %79 = icmp ult i32 %77, %78
  br i1 %79, label %80, label %81

80:                                               ; preds = %74
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -254) #7
  unreachable

81:                                               ; preds = %74
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = sub i32 %83, %82
  store i32 %84, ptr %8, align 4, !tbaa !9
  %85 = load i32, ptr %4, align 4, !tbaa !9
  %86 = and i32 %85, 16
  %87 = icmp sgt i32 %86, 16
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -255) #7
  unreachable

89:                                               ; preds = %81
  %90 = load i32, ptr %4, align 4, !tbaa !9
  %91 = and i32 %90, 15
  %92 = load i32, ptr %4, align 4, !tbaa !9
  %93 = and i32 %92, 16
  %94 = ashr i32 %93, 4
  %95 = mul nsw i32 %94, 4
  %96 = add nsw i32 %91, %95
  store i32 %96, ptr %4, align 4, !tbaa !9
  %97 = load i32, ptr %4, align 4, !tbaa !9
  %98 = icmp sge i32 %97, 8
  br i1 %98, label %99, label %100

99:                                               ; preds = %89
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %11, i32 noundef -255) #7
  unreachable

100:                                              ; preds = %89
  %101 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 10
  %102 = load i32, ptr %4, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [8 x ptr], ptr %101, i64 0, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  br i1 %106, label %113, label %107

107:                                              ; preds = %100
  %108 = call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13523) %11, i64 noundef 17, i1 noundef zeroext false)
  %109 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 10
  %110 = load i32, ptr %4, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [8 x ptr], ptr %109, i64 0, i64 %111
  store ptr %108, ptr %112, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %107, %100
  %114 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 11
  %115 = load i32, ptr %4, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [8 x ptr], ptr %114, i64 0, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = icmp ne ptr %118, null
  br i1 %119, label %126, label %120

120:                                              ; preds = %113
  %121 = call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13523) %11, i64 noundef 256, i1 noundef zeroext false)
  %122 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 11
  %123 = load i32, ptr %4, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [8 x ptr], ptr %122, i64 0, i64 %124
  store ptr %121, ptr %125, align 8, !tbaa !5
  br label %126

126:                                              ; preds = %120, %113
  %127 = load i32, ptr %4, align 4, !tbaa !9
  %128 = and i32 %127, 16
  %129 = icmp ne i32 %128, 0
  %130 = zext i1 %129 to i8
  %131 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 8
  %132 = load i32, ptr %4, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [8 x i8], ptr %131, i64 0, i64 %133
  store i8 %130, ptr %134, align 1, !tbaa !11
  %135 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 10
  %136 = load i32, ptr %4, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [8 x ptr], ptr %135, i64 0, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  %140 = getelementptr inbounds [17 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %139, ptr align 16 %140, i64 17, i1 false)
  %141 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %11, i32 0, i32 11
  %142 = load i32, ptr %4, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [8 x ptr], ptr %141, i64 0, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  %146 = getelementptr inbounds [256 x i8], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %145, ptr align 16 %146, i64 256, i1 false)
  call void @llvm.lifetime.end.p0(i64 256, ptr %9) #6
  br label %19, !llvm.loop !19

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder15read_dht_markerEv(ptr noundef nonnull align 8 dereferenceable(13523) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca [256 x i8], align 16
  %3 = alloca [256 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %2) #6
  %4 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 16)
  %5 = icmp ult i32 %4, 2
  br i1 %5, label %6, label %7

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

7:                                                ; preds = %1
  %8 = add i32 %4, -2
  %.not43 = icmp eq i32 %8, 0
  br i1 %.not43, label %._crit_edge47, label %.lr.ph46

.lr.ph46:                                         ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 248
  %10 = getelementptr inbounds i8, ptr %0, i64 312
  %11 = getelementptr inbounds i8, ptr %0, i64 236
  br label %12

12:                                               ; preds = %.lr.ph46, %114
  %.03344 = phi i32 [ %8, %.lr.ph46 ], [ %95, %114 ]
  %13 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %14 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %15 = trunc i32 %14 to i8
  %16 = and i32 %14, 255
  %17 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %18 = trunc i32 %17 to i8
  %19 = and i32 %17, 255
  %20 = add nuw nsw i32 %19, %16
  %21 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %22 = trunc i32 %21 to i8
  %23 = and i32 %21, 255
  %24 = add nuw nsw i32 %23, %20
  %25 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %26 = trunc i32 %25 to i8
  %27 = and i32 %25, 255
  %28 = add nuw nsw i32 %27, %24
  %29 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %30 = trunc i32 %29 to i8
  %31 = and i32 %29, 255
  %32 = add nuw nsw i32 %31, %28
  %33 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %34 = trunc i32 %33 to i8
  %35 = and i32 %33, 255
  %36 = add nuw nsw i32 %35, %32
  %37 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %38 = trunc i32 %37 to i8
  %39 = and i32 %37, 255
  %40 = add nuw nsw i32 %39, %36
  %41 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %42 = trunc i32 %41 to i8
  %43 = and i32 %41, 255
  %44 = add nuw nsw i32 %43, %40
  %45 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %46 = trunc i32 %45 to i8
  %47 = and i32 %45, 255
  %48 = add nuw nsw i32 %47, %44
  %49 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %50 = trunc i32 %49 to i8
  %51 = and i32 %49, 255
  %52 = add nuw nsw i32 %51, %48
  %53 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %54 = trunc i32 %53 to i8
  %55 = and i32 %53, 255
  %56 = add nuw nsw i32 %55, %52
  %57 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %58 = trunc i32 %57 to i8
  %59 = and i32 %57, 255
  %60 = add nuw nsw i32 %59, %56
  %61 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %62 = trunc i32 %61 to i8
  %63 = and i32 %61, 255
  %64 = add nuw nsw i32 %63, %60
  %65 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %66 = trunc i32 %65 to i8
  %67 = and i32 %65, 255
  %68 = add nuw nsw i32 %67, %64
  %69 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %70 = trunc i32 %69 to i8
  %71 = and i32 %69, 255
  %72 = add nuw nsw i32 %71, %68
  %73 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %74 = trunc i32 %73 to i8
  %75 = and i32 %73, 255
  %76 = add nuw nsw i32 %75, %72
  %77 = icmp ugt i32 %76, 255
  br i1 %77, label %78, label %79

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

79:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) %3, i8 0, i64 256, i1 false)
  %.not48 = icmp eq i32 %76, 0
  br i1 %.not48, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %79
  %80 = zext nneg i32 %76 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %87
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %87 ]
  %81 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef 8)
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [256 x i8], ptr %3, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !5, !range !9, !noundef !10
  %85 = trunc nuw i8 %84 to i1
  br i1 %85, label %86, label %87

86:                                               ; preds = %.lr.ph
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef -256) #7
  unreachable

87:                                               ; preds = %.lr.ph
  %88 = trunc i32 %81 to i8
  %89 = getelementptr inbounds [256 x i8], ptr %2, i64 0, i64 %indvars.iv
  store i8 %88, ptr %89, align 1, !tbaa !11
  store i8 1, ptr %83, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %90 = icmp ult i64 %indvars.iv.next, %80
  br i1 %90, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %87, %79
  %91 = add nuw nsw i32 %76, 17
  %92 = icmp ult i32 %.03344, %91
  br i1 %92, label %93, label %94

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

94:                                               ; preds = %._crit_edge
  %95 = sub i32 %.03344, %91
  %96 = and i32 %13, 15
  %97 = lshr i32 %13, 2
  %98 = and i32 %97, 4
  %99 = add nuw nsw i32 %98, %96
  %100 = icmp ugt i32 %99, 7
  br i1 %100, label %101, label %102

101:                                              ; preds = %94
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13523) %0, i32 noundef -255) #7
  unreachable

102:                                              ; preds = %94
  %103 = zext nneg i32 %99 to i64
  %104 = getelementptr inbounds [8 x ptr], ptr %9, i64 0, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !14
  %.not38 = icmp eq ptr %105, null
  br i1 %.not38, label %106, label %108

106:                                              ; preds = %102
  %107 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13523) %0, i64 noundef 17, i1 noundef zeroext false)
  store ptr %107, ptr %104, align 8, !tbaa !14
  br label %108

108:                                              ; preds = %106, %102
  %109 = phi ptr [ %107, %106 ], [ %105, %102 ]
  %110 = getelementptr inbounds [8 x ptr], ptr %10, i64 0, i64 %103
  %111 = load ptr, ptr %110, align 8, !tbaa !14
  %.not39 = icmp eq ptr %111, null
  br i1 %.not39, label %112, label %114

112:                                              ; preds = %108
  %113 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13523) %0, i64 noundef 256, i1 noundef zeroext false)
  store ptr %113, ptr %110, align 8, !tbaa !14
  %.pre = load ptr, ptr %104, align 8, !tbaa !14
  br label %114

114:                                              ; preds = %112, %108
  %115 = phi ptr [ %.pre, %112 ], [ %109, %108 ]
  %116 = getelementptr inbounds [8 x i8], ptr %11, i64 0, i64 %103
  store i8 0, ptr %116, align 1, !tbaa !11
  store i8 0, ptr %115, align 1
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 1
  store i8 %15, ptr %.sroa.4.0..sroa_idx, align 1
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 2
  store i8 %18, ptr %.sroa.5.0..sroa_idx, align 1
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 3
  store i8 %22, ptr %.sroa.6.0..sroa_idx, align 1
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 4
  store i8 %26, ptr %.sroa.7.0..sroa_idx, align 1
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 5
  store i8 %30, ptr %.sroa.8.0..sroa_idx, align 1
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 6
  store i8 %34, ptr %.sroa.9.0..sroa_idx, align 1
  %.sroa.10.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 7
  store i8 %38, ptr %.sroa.10.0..sroa_idx, align 1
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 8
  store i8 %42, ptr %.sroa.11.0..sroa_idx, align 1
  %.sroa.12.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 9
  store i8 %46, ptr %.sroa.12.0..sroa_idx, align 1
  %.sroa.13.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 10
  store i8 %50, ptr %.sroa.13.0..sroa_idx, align 1
  %.sroa.14.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 11
  store i8 %54, ptr %.sroa.14.0..sroa_idx, align 1
  %.sroa.15.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 12
  store i8 %58, ptr %.sroa.15.0..sroa_idx, align 1
  %.sroa.16.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 13
  store i8 %62, ptr %.sroa.16.0..sroa_idx, align 1
  %.sroa.17.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 14
  store i8 %66, ptr %.sroa.17.0..sroa_idx, align 1
  %.sroa.18.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 15
  store i8 %70, ptr %.sroa.18.0..sroa_idx, align 1
  %.sroa.19.0..sroa_idx = getelementptr inbounds i8, ptr %115, i64 16
  store i8 %74, ptr %.sroa.19.0..sroa_idx, align 1
  %117 = load ptr, ptr %110, align 8, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(256) %117, ptr noundef nonnull align 16 dereferenceable(256) %2, i64 256, i1 false)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #6
  %.not = icmp eq i32 %95, 0
  br i1 %.not, label %._crit_edge47, label %12, !llvm.loop !16

._crit_edge47:                                    ; preds = %114, %7
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %2) #6
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

attributes #0 = { mustprogress 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 = { 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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !13}


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