; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/modules/juce_graphics/image_formats/jpglib (jquant2)

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

%struct.jpeg_decompress_struct = type { ptr, ptr, ptr, ptr, i8, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i8, i8, i32, i8, i8, i8, i32, i8, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i8, i8, [16 x i8], [16 x i8], [16 x i8], i32, i8, i8, i8, i8, i16, i16, i8, i8, i8, ptr, i32, i32, i32, i32, ptr, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.jpeg_memory_mgr = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }
%struct.my_cquantizer2 = type { %struct.jpeg_color_quantizer, ptr, i32, ptr, i8, ptr, i8, ptr }
%struct.jpeg_color_quantizer = type { ptr, ptr, ptr, ptr }
%struct.jpeg_error_mgr = type { ptr, ptr, ptr, ptr, ptr, i32, %union.anon, i32, i64, ptr, i32, ptr, i32, i32 }
%union.anon = type { [8 x i32], [48 x i8] }

; Function Attrs: nounwind uwtable
define dso_local void @jinit_2pass_quantizer(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call ptr %10(ptr noundef %11, i32 noundef 1, i64 noundef 88)
  store ptr %12, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %14, i32 0, i32 87
  store ptr %13, ptr %15, align 8, !tbaa !17
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.my_cquantizer2, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.jpeg_color_quantizer, ptr %17, i32 0, i32 0
  store ptr @start_pass_2_quant, ptr %18, align 8, !tbaa !18
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.my_cquantizer2, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.jpeg_color_quantizer, ptr %20, i32 0, i32 3
  store ptr @new_color_map_2_quant, ptr %21, align 8, !tbaa !21
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.my_cquantizer2, ptr %22, i32 0, i32 5
  store ptr null, ptr %23, align 8, !tbaa !22
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.my_cquantizer2, ptr %24, i32 0, i32 7
  store ptr null, ptr %25, align 8, !tbaa !23
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %26, i32 0, i32 29
  %28 = load i32, ptr %27, align 4, !tbaa !24
  %29 = icmp ne i32 %28, 3
  br i1 %29, label %30, label %41

30:                                               ; preds = %1
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !25
  %34 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %33, i32 0, i32 5
  store i32 47, ptr %34, align 8, !tbaa !26
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !28
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  call void %39(ptr noundef %40)
  br label %41

41:                                               ; preds = %30, %1
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = call ptr %46(ptr noundef %47, i32 noundef 1, i64 noundef 256)
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.my_cquantizer2, ptr %49, i32 0, i32 3
  store ptr %48, ptr %50, align 8, !tbaa !29
  store i32 0, ptr %4, align 4, !tbaa !30
  br label %51

51:                                               ; preds = %68, %41
  %52 = load i32, ptr %4, align 4, !tbaa !30
  %53 = icmp slt i32 %52, 32
  br i1 %53, label %54, label %71

54:                                               ; preds = %51
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !31
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = call ptr %59(ptr noundef %60, i32 noundef 1, i64 noundef 4096)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.my_cquantizer2, ptr %62, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !29
  %65 = load i32, ptr %4, align 4, !tbaa !30
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds ptr, ptr %64, i64 %66
  store ptr %61, ptr %67, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %54
  %69 = load i32, ptr %4, align 4, !tbaa !30
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %4, align 4, !tbaa !30
  br label %51, !llvm.loop !32

71:                                               ; preds = %51
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.my_cquantizer2, ptr %72, i32 0, i32 4
  store i8 1, ptr %73, align 8, !tbaa !34
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %74, i32 0, i32 26
  %76 = load i8, ptr %75, align 2, !tbaa !35
  %77 = icmp ne i8 %76, 0
  br i1 %77, label %78, label %133

78:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %79, i32 0, i32 23
  %81 = load i32, ptr %80, align 4, !tbaa !36
  store i32 %81, ptr %5, align 4, !tbaa !30
  %82 = load i32, ptr %5, align 4, !tbaa !30
  %83 = icmp slt i32 %82, 8
  br i1 %83, label %84, label %100

84:                                               ; preds = %78
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !25
  %88 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %87, i32 0, i32 5
  store i32 56, ptr %88, align 8, !tbaa !26
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !25
  %92 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %91, i32 0, i32 6
  %93 = getelementptr inbounds [8 x i32], ptr %92, i64 0, i64 0
  store i32 8, ptr %93, align 4, !tbaa !37
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !25
  %97 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !28
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  call void %98(ptr noundef %99)
  br label %100

100:                                              ; preds = %84, %78
  %101 = load i32, ptr %5, align 4, !tbaa !30
  %102 = icmp sgt i32 %101, 256
  br i1 %102, label %103, label %119

103:                                              ; preds = %100
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !25
  %107 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %106, i32 0, i32 5
  store i32 57, ptr %107, align 8, !tbaa !26
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !25
  %111 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %110, i32 0, i32 6
  %112 = getelementptr inbounds [8 x i32], ptr %111, i64 0, i64 0
  store i32 256, ptr %112, align 4, !tbaa !37
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !25
  %116 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %115, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !28
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  call void %117(ptr noundef %118)
  br label %119

119:                                              ; preds = %103, %100
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %122, i32 0, i32 2
  %124 = load ptr, ptr %123, align 8, !tbaa !38
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = load i32, ptr %5, align 4, !tbaa !30
  %127 = call ptr %124(ptr noundef %125, i32 noundef 1, i32 noundef %126, i32 noundef 3)
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.my_cquantizer2, ptr %128, i32 0, i32 1
  store ptr %127, ptr %129, align 8, !tbaa !39
  %130 = load i32, ptr %5, align 4, !tbaa !30
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.my_cquantizer2, ptr %131, i32 0, i32 2
  store i32 %130, ptr %132, align 8, !tbaa !40
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %136

133:                                              ; preds = %71
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.my_cquantizer2, ptr %134, i32 0, i32 1
  store ptr null, ptr %135, align 8, !tbaa !39
  br label %136

136:                                              ; preds = %133, %119
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %137, i32 0, i32 21
  %139 = load i32, ptr %138, align 4, !tbaa !41
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %144

141:                                              ; preds = %136
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %142, i32 0, i32 21
  store i32 2, ptr %143, align 4, !tbaa !41
  br label %144

144:                                              ; preds = %141, %136
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %145, i32 0, i32 21
  %147 = load i32, ptr %146, align 4, !tbaa !41
  %148 = icmp eq i32 %147, 2
  br i1 %148, label %149, label %166

149:                                              ; preds = %144
  %150 = load ptr, ptr %2, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %150, i32 0, i32 1
  %152 = load ptr, ptr %151, align 8, !tbaa !9
  %153 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %152, i32 0, i32 1
  %154 = load ptr, ptr %153, align 8, !tbaa !31
  %155 = load ptr, ptr %2, align 8, !tbaa !5
  %156 = load ptr, ptr %2, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %156, i32 0, i32 27
  %158 = load i32, ptr %157, align 4, !tbaa !42
  %159 = add i32 %158, 2
  %160 = zext i32 %159 to i64
  %161 = mul i64 %160, 6
  %162 = call ptr %154(ptr noundef %155, i32 noundef 1, i64 noundef %161)
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.my_cquantizer2, ptr %163, i32 0, i32 5
  store ptr %162, ptr %164, align 8, !tbaa !22
  %165 = load ptr, ptr %2, align 8, !tbaa !5
  call void @init_error_limit(ptr noundef %165)
  br label %166

166:                                              ; preds = %149, %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare hidden void @start_pass_2_quant(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare hidden void @new_color_map_2_quant(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare hidden void @init_error_limit(ptr noundef) #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"jpeg_decompress_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !11, i64 36, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !12, i64 80, !7, i64 88, !7, i64 89, !11, i64 92, !7, i64 96, !7, i64 97, !7, i64 98, !11, i64 100, !7, i64 104, !11, i64 108, !7, i64 112, !7, i64 113, !7, i64 114, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !6, i64 144, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !6, i64 176, !7, i64 184, !7, i64 216, !7, i64 248, !11, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !7, i64 298, !7, i64 314, !7, i64 330, !11, i64 348, !7, i64 352, !7, i64 353, !7, i64 354, !7, i64 355, !13, i64 356, !13, i64 358, !7, i64 360, !7, i64 361, !7, i64 362, !6, i64 368, !11, i64 376, !11, i64 380, !11, i64 384, !11, i64 388, !6, i64 392, !11, i64 400, !7, i64 408, !11, i64 440, !11, i64 444, !11, i64 448, !7, i64 452, !11, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !11, i64 508, !6, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"jpeg_memory_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !16, i64 88, !16, i64 96}
!16 = !{!"long", !7, i64 0}
!17 = !{!10, !6, i64 592}
!18 = !{!19, !6, i64 0}
!19 = !{!"", !20, i64 0, !6, i64 32, !11, i64 40, !6, i64 48, !7, i64 56, !6, i64 64, !7, i64 72, !6, i64 80}
!20 = !{!"jpeg_color_quantizer", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!21 = !{!19, !6, i64 24}
!22 = !{!19, !6, i64 64}
!23 = !{!19, !6, i64 80}
!24 = !{!10, !11, i64 124}
!25 = !{!10, !6, i64 0}
!26 = !{!27, !11, i64 40}
!27 = !{!"jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !7, i64 44, !11, i64 124, !16, i64 128, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 164}
!28 = !{!27, !6, i64 0}
!29 = !{!19, !6, i64 48}
!30 = !{!11, !11, i64 0}
!31 = !{!15, !6, i64 8}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!19, !7, i64 56}
!35 = !{!10, !7, i64 114}
!36 = !{!10, !11, i64 108}
!37 = !{!7, !7, i64 0}
!38 = !{!15, !6, i64 16}
!39 = !{!19, !6, i64 32}
!40 = !{!19, !11, i64 40}
!41 = !{!10, !11, i64 100}
!42 = !{!10, !11, i64 116}


; 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: nounwind uwtable
define dso_local void @jinit_2pass_quantizer(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !13
  %5 = tail call ptr %4(ptr noundef %0, i32 noundef 1, i64 noundef 88) #1
  %6 = getelementptr inbounds i8, ptr %0, i64 592
  store ptr %5, ptr %6, align 8, !tbaa !16
  store ptr @start_pass_2_quant, ptr %5, align 8, !tbaa !17
  %7 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr @new_color_map_2_quant, ptr %7, align 8, !tbaa !20
  %8 = getelementptr inbounds i8, ptr %5, i64 64
  store ptr null, ptr %8, align 8, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %5, i64 80
  store ptr null, ptr %9, align 8, !tbaa !22
  %10 = getelementptr inbounds i8, ptr %0, i64 124
  %11 = load i32, ptr %10, align 4, !tbaa !23
  %.not = icmp eq i32 %11, 3
  br i1 %.not, label %16, label %12

12:                                               ; preds = %1
  %13 = load ptr, ptr %0, align 8, !tbaa !24
  %14 = getelementptr inbounds i8, ptr %13, i64 40
  store i32 47, ptr %14, align 8, !tbaa !25
  %15 = load ptr, ptr %13, align 8, !tbaa !27
  tail call void %15(ptr noundef nonnull %0) #1
  br label %16

16:                                               ; preds = %12, %1
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = tail call ptr %18(ptr noundef nonnull %0, i32 noundef 1, i64 noundef 256) #1
  %20 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %19, ptr %20, align 8, !tbaa !28
  br label %21

21:                                               ; preds = %16, %21
  %indvars.iv = phi i64 [ 0, %16 ], [ %indvars.iv.next, %21 ]
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !29
  %25 = tail call ptr %24(ptr noundef nonnull %0, i32 noundef 1, i64 noundef 4096) #1
  %26 = load ptr, ptr %20, align 8, !tbaa !28
  %27 = getelementptr inbounds ptr, ptr %26, i64 %indvars.iv
  store ptr %25, ptr %27, align 8, !tbaa !30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32
  br i1 %exitcond.not, label %28, label %21, !llvm.loop !31

28:                                               ; preds = %21
  %29 = getelementptr inbounds i8, ptr %5, i64 56
  store i8 1, ptr %29, align 8, !tbaa !33
  %30 = getelementptr inbounds i8, ptr %0, i64 114
  %31 = load i8, ptr %30, align 2, !tbaa !34
  %.not48 = icmp eq i8 %31, 0
  br i1 %.not48, label %50, label %32

32:                                               ; preds = %28
  %33 = getelementptr inbounds i8, ptr %0, i64 108
  %34 = load i32, ptr %33, align 4, !tbaa !35
  %35 = icmp slt i32 %34, 8
  br i1 %35, label %.sink.split, label %36

36:                                               ; preds = %32
  %37 = icmp ugt i32 %34, 256
  br i1 %37, label %.sink.split, label %43

.sink.split:                                      ; preds = %36, %32
  %38 = phi <2 x i32> [ <i32 56, i32 8>, %32 ], [ <i32 57, i32 256>, %36 ]
  %39 = load ptr, ptr %0, align 8, !tbaa !24
  %40 = getelementptr inbounds i8, ptr %39, i64 40
  store <2 x i32> %38, ptr %40, align 8, !tbaa !36
  %41 = load ptr, ptr %0, align 8, !tbaa !24
  %42 = load ptr, ptr %41, align 8, !tbaa !27
  tail call void %42(ptr noundef nonnull %0) #1
  br label %43

43:                                               ; preds = %.sink.split, %36
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !37
  %47 = tail call ptr %46(ptr noundef nonnull %0, i32 noundef 1, i32 noundef %34, i32 noundef 3) #1
  %48 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %47, ptr %48, align 8, !tbaa !38
  %49 = getelementptr inbounds i8, ptr %5, i64 40
  store i32 %34, ptr %49, align 8, !tbaa !39
  br label %52

50:                                               ; preds = %28
  %51 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr null, ptr %51, align 8, !tbaa !38
  br label %52

52:                                               ; preds = %50, %43
  %53 = getelementptr inbounds i8, ptr %0, i64 100
  %54 = load i32, ptr %53, align 4, !tbaa !40
  %.not49 = icmp eq i32 %54, 0
  br i1 %.not49, label %65, label %55

55:                                               ; preds = %52
  store i32 2, ptr %53, align 4, !tbaa !40
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !29
  %59 = getelementptr inbounds i8, ptr %0, i64 116
  %60 = load i32, ptr %59, align 4, !tbaa !41
  %61 = add i32 %60, 2
  %62 = zext i32 %61 to i64
  %63 = mul nuw nsw i64 %62, 6
  %64 = tail call ptr %58(ptr noundef nonnull %0, i32 noundef 1, i64 noundef %63) #1
  store ptr %64, ptr %8, align 8, !tbaa !21
  tail call void @init_error_limit(ptr noundef nonnull %0)
  br label %65

65:                                               ; preds = %52, %55
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @start_pass_2_quant(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare hidden void @new_color_map_2_quant(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @init_error_limit(ptr noundef) local_unnamed_addr #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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, !7, i64 8}
!6 = !{!"jpeg_decompress_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !8, i64 32, !10, i64 36, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !11, i64 80, !8, i64 88, !8, i64 89, !10, i64 92, !8, i64 96, !8, i64 97, !8, i64 98, !10, i64 100, !8, i64 104, !10, i64 108, !8, i64 112, !8, i64 113, !8, i64 114, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !7, i64 144, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !7, i64 176, !8, i64 184, !8, i64 216, !8, i64 248, !10, i64 280, !7, i64 288, !8, i64 296, !8, i64 297, !8, i64 298, !8, i64 314, !8, i64 330, !10, i64 348, !8, i64 352, !8, i64 353, !8, i64 354, !8, i64 355, !12, i64 356, !12, i64 358, !8, i64 360, !8, i64 361, !8, i64 362, !7, i64 368, !10, i64 376, !10, i64 380, !10, i64 384, !10, i64 388, !7, i64 392, !10, i64 400, !8, i64 408, !10, i64 440, !10, i64 444, !10, i64 448, !8, i64 452, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !7, i64 512, !7, i64 520, !7, i64 528, !7, i64 536, !7, i64 544, !7, i64 552, !7, i64 560, !7, i64 568, !7, i64 576, !7, i64 584, !7, i64 592}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"jpeg_memory_mgr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !15, i64 88, !15, i64 96}
!15 = !{!"long", !8, i64 0}
!16 = !{!6, !7, i64 592}
!17 = !{!18, !7, i64 0}
!18 = !{!"", !19, i64 0, !7, i64 32, !10, i64 40, !7, i64 48, !8, i64 56, !7, i64 64, !8, i64 72, !7, i64 80}
!19 = !{!"jpeg_color_quantizer", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!20 = !{!18, !7, i64 24}
!21 = !{!18, !7, i64 64}
!22 = !{!18, !7, i64 80}
!23 = !{!6, !10, i64 124}
!24 = !{!6, !7, i64 0}
!25 = !{!26, !10, i64 40}
!26 = !{!"jpeg_error_mgr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !8, i64 44, !10, i64 124, !15, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 164}
!27 = !{!26, !7, i64 0}
!28 = !{!18, !7, i64 48}
!29 = !{!14, !7, i64 8}
!30 = !{!7, !7, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!18, !8, i64 56}
!34 = !{!6, !8, i64 114}
!35 = !{!6, !10, i64 108}
!36 = !{!8, !8, i64 0}
!37 = !{!14, !7, i64 16}
!38 = !{!18, !7, i64 32}
!39 = !{!18, !10, i64 40}
!40 = !{!6, !10, i64 100}
!41 = !{!6, !10, i64 116}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass