; LLVM IR from drohmer/cgp :: library/third_party/src/jpeg/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], 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, [8 x ptr], [4 x ptr], [4 x ptr], i32, [4 x i32], [4 x i8], ptr, i32, i32, i8, [128 x i8], [8320 x i8], [128 x i8], [3 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8], i32, [4 x i32], [4 x i8], ptr, [10 x i32], ptr, [256 x i32], [256 x i32], [256 x i32], [256 x i32], ptr, ptr, i32, i8, [3 x i8], i32, [4 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(13652), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4jpgd12jpeg_decoder15read_dht_markerEv(ptr noundef nonnull align 8 dereferenceable(13652) %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
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 17, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 256, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %10 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef 16)
  store i32 %10, ptr %8, align 4, !tbaa !9
  %11 = load i32, ptr %8, align 4, !tbaa !9
  %12 = icmp ult i32 %11, 2
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef -254) #6
  unreachable

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

17:                                               ; preds = %112, %14
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %133

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

23:                                               ; preds = %39, %20
  %24 = load i32, ptr %3, align 4, !tbaa !9
  %25 = icmp sle i32 %24, 16
  br i1 %25, label %26, label %42

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

39:                                               ; preds = %26
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !9
  br label %23, !llvm.loop !12

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

45:                                               ; preds = %42
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef -256) #6
  unreachable

46:                                               ; preds = %42
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %57, %46
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %51, label %60

51:                                               ; preds = %47
  %52 = call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef 8)
  %53 = trunc i32 %52 to i8
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [256 x i8], ptr %7, i64 0, i64 %55
  store i8 %53, ptr %56, align 1, !tbaa !11
  br label %57

57:                                               ; preds = %51
  %58 = load i32, ptr %3, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %3, align 4, !tbaa !9
  br label %47, !llvm.loop !14

60:                                               ; preds = %47
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = add nsw i32 17, %61
  store i32 %62, ptr %3, align 4, !tbaa !9
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = load i32, ptr %3, align 4, !tbaa !9
  %65 = icmp ult i32 %63, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %60
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef -254) #6
  unreachable

67:                                               ; preds = %60
  %68 = load i32, ptr %3, align 4, !tbaa !9
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = sub i32 %69, %68
  store i32 %70, ptr %8, align 4, !tbaa !9
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = and i32 %71, 16
  %73 = icmp sgt i32 %72, 16
  br i1 %73, label %74, label %75

74:                                               ; preds = %67
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef -255) #6
  unreachable

75:                                               ; preds = %67
  %76 = load i32, ptr %4, align 4, !tbaa !9
  %77 = and i32 %76, 15
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = and i32 %78, 16
  %80 = ashr i32 %79, 4
  %81 = mul nsw i32 %80, 4
  %82 = add nsw i32 %77, %81
  store i32 %82, ptr %4, align 4, !tbaa !9
  %83 = load i32, ptr %4, align 4, !tbaa !9
  %84 = icmp sge i32 %83, 8
  br i1 %84, label %85, label %86

85:                                               ; preds = %75
  call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %9, i32 noundef -255) #6
  unreachable

86:                                               ; preds = %75
  %87 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %9, i32 0, i32 8
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [8 x ptr], ptr %87, i64 0, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %99, label %93

93:                                               ; preds = %86
  %94 = call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13652) %9, i64 noundef 17, i1 noundef zeroext false)
  %95 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %9, i32 0, i32 8
  %96 = load i32, ptr %4, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [8 x ptr], ptr %95, i64 0, i64 %97
  store ptr %94, ptr %98, align 8, !tbaa !5
  br label %99

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

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

112:                                              ; preds = %106, %99
  %113 = load i32, ptr %4, align 4, !tbaa !9
  %114 = and i32 %113, 16
  %115 = icmp ne i32 %114, 0
  %116 = zext i1 %115 to i8
  %117 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %9, i32 0, i32 6
  %118 = load i32, ptr %4, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [8 x i8], ptr %117, i64 0, i64 %119
  store i8 %116, ptr %120, align 1, !tbaa !11
  %121 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %9, i32 0, i32 8
  %122 = load i32, ptr %4, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [8 x ptr], ptr %121, i64 0, i64 %123
  %125 = load ptr, ptr %124, align 8, !tbaa !5
  %126 = getelementptr inbounds [17 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %125, ptr align 16 %126, i64 17, i1 false)
  %127 = getelementptr inbounds %"class.jpgd::jpeg_decoder", ptr %9, i32 0, i32 9
  %128 = load i32, ptr %4, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [8 x ptr], ptr %127, i64 0, i64 %129
  %131 = load ptr, ptr %130, align 8, !tbaa !5
  %132 = getelementptr inbounds [256 x i8], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %131, ptr align 16 %132, i64 256, i1 false)
  br label %17, !llvm.loop !15

133:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 17, ptr %6) #5
  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
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13652), i32 noundef) #3 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) #4

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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !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(13652), 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(13652), i64 noundef, i1 noundef zeroext) local_unnamed_addr #2 align 2

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

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

6:                                                ; preds = %1
  %7 = add i32 %3, -2
  %.not40 = icmp eq i32 %7, 0
  br i1 %.not40, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %6
  %8 = getelementptr inbounds i8, ptr %0, i64 240
  %9 = getelementptr inbounds i8, ptr %0, i64 304
  %10 = getelementptr inbounds i8, ptr %0, i64 228
  br label %11

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

.preheader:                                       ; preds = %11
  %.not45 = icmp eq i32 %75, 0
  br i1 %.not45, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %77 = zext nneg i32 %75 to i64
  br label %.lr.ph

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %79 = tail call noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13652) %0, i32 noundef 8)
  %80 = trunc i32 %79 to i8
  %81 = getelementptr inbounds [256 x i8], ptr %2, i64 0, i64 %indvars.iv
  store i8 %80, ptr %81, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %82 = icmp ult i64 %indvars.iv.next, %77
  br i1 %82, label %.lr.ph, label %._crit_edge, !llvm.loop !8

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %83 = add nuw nsw i32 %75, 17
  %84 = icmp ult i32 %.041, %83
  br i1 %84, label %85, label %86

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

86:                                               ; preds = %._crit_edge
  %87 = sub i32 %.041, %83
  %88 = and i32 %12, 15
  %89 = lshr i32 %12, 2
  %90 = and i32 %89, 4
  %91 = add nuw nsw i32 %90, %88
  %92 = icmp ugt i32 %91, 7
  br i1 %92, label %93, label %94

93:                                               ; preds = %86
  tail call void @_ZN4jpgd12jpeg_decoder13stop_decodingENS_11jpgd_statusE(ptr noundef nonnull align 8 dereferenceable(13652) %0, i32 noundef -255) #6
  unreachable

94:                                               ; preds = %86
  %95 = zext nneg i32 %91 to i64
  %96 = getelementptr inbounds [8 x ptr], ptr %8, i64 0, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !10
  %.not35 = icmp eq ptr %97, null
  br i1 %.not35, label %98, label %100

98:                                               ; preds = %94
  %99 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13652) %0, i64 noundef 17, i1 noundef zeroext false)
  store ptr %99, ptr %96, align 8, !tbaa !10
  br label %100

100:                                              ; preds = %98, %94
  %101 = phi ptr [ %99, %98 ], [ %97, %94 ]
  %102 = getelementptr inbounds [8 x ptr], ptr %9, i64 0, i64 %95
  %103 = load ptr, ptr %102, align 8, !tbaa !10
  %.not36 = icmp eq ptr %103, null
  br i1 %.not36, label %104, label %106

104:                                              ; preds = %100
  %105 = tail call noundef ptr @_ZN4jpgd12jpeg_decoder5allocEmb(ptr noundef nonnull align 8 dereferenceable(13652) %0, i64 noundef 256, i1 noundef zeroext false)
  store ptr %105, ptr %102, align 8, !tbaa !10
  %.pre = load ptr, ptr %96, align 8, !tbaa !10
  br label %106

106:                                              ; preds = %104, %100
  %107 = phi ptr [ %.pre, %104 ], [ %101, %100 ]
  %108 = getelementptr inbounds [8 x i8], ptr %10, i64 0, i64 %95
  store i8 0, ptr %108, align 1, !tbaa !5
  store i8 0, ptr %107, align 1
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 1
  store i8 %14, ptr %.sroa.4.0..sroa_idx, align 1
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 2
  store i8 %17, ptr %.sroa.5.0..sroa_idx, align 1
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 3
  store i8 %21, ptr %.sroa.6.0..sroa_idx, align 1
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 4
  store i8 %25, ptr %.sroa.7.0..sroa_idx, align 1
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 5
  store i8 %29, ptr %.sroa.8.0..sroa_idx, align 1
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 6
  store i8 %33, ptr %.sroa.9.0..sroa_idx, align 1
  %.sroa.10.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 7
  store i8 %37, ptr %.sroa.10.0..sroa_idx, align 1
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 8
  store i8 %41, ptr %.sroa.11.0..sroa_idx, align 1
  %.sroa.12.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 9
  store i8 %45, ptr %.sroa.12.0..sroa_idx, align 1
  %.sroa.13.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 10
  store i8 %49, ptr %.sroa.13.0..sroa_idx, align 1
  %.sroa.14.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 11
  store i8 %53, ptr %.sroa.14.0..sroa_idx, align 1
  %.sroa.15.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 12
  store i8 %57, ptr %.sroa.15.0..sroa_idx, align 1
  %.sroa.16.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 13
  store i8 %61, ptr %.sroa.16.0..sroa_idx, align 1
  %.sroa.17.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 14
  store i8 %65, ptr %.sroa.17.0..sroa_idx, align 1
  %.sroa.18.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 15
  store i8 %69, ptr %.sroa.18.0..sroa_idx, align 1
  %.sroa.19.0..sroa_idx = getelementptr inbounds i8, ptr %107, i64 16
  store i8 %73, ptr %.sroa.19.0..sroa_idx, align 1
  %109 = load ptr, ptr %102, align 8, !tbaa !10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(256) %109, ptr noundef nonnull align 16 dereferenceable(256) %2, i64 256, i1 false)
  %.not = icmp eq i32 %87, 0
  br i1 %.not, label %._crit_edge44, label %11, !llvm.loop !12

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN4jpgd12jpeg_decoder8get_bitsEi(ptr noundef nonnull align 8 dereferenceable(13652), i32 noundef) local_unnamed_addr #3 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) #4

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


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