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

; 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_compress_struct = type { ptr, ptr, ptr, ptr, i8, i32, ptr, i32, i32, i32, i32, double, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], [16 x i8], [16 x i8], [16 x i8], i32, ptr, i8, i8, i8, i8, i32, i32, i32, i32, i8, i8, i8, i8, i16, i16, i8, i32, i8, i32, i32, i32, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.jpeg_memory_mgr = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }
%struct.my_downsampler = type { %struct.jpeg_downsampler, [10 x ptr] }
%struct.jpeg_downsampler = type { ptr, ptr, i8 }
%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] }
%struct.jpeg_component_info = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @jinit_downsampler(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  store i8 1, ptr %6, align 1, !tbaa !9
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %8, align 8, !tbaa !10
  %10 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call ptr %11(ptr noundef %12, i32 noundef 1, i64 noundef 104)
  store ptr %13, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %15, i32 0, i32 60
  store ptr %14, ptr %16, align 8, !tbaa !18
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.my_downsampler, ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %struct.jpeg_downsampler, ptr %18, i32 0, i32 0
  store ptr @start_pass_downsample, ptr %19, align 8, !tbaa !19
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.my_downsampler, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %struct.jpeg_downsampler, ptr %21, i32 0, i32 1
  store ptr @sep_downsample, ptr %22, align 8, !tbaa !22
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.my_downsampler, ptr %23, i32 0, i32 0
  %25 = getelementptr inbounds %struct.jpeg_downsampler, ptr %24, i32 0, i32 2
  store i8 0, ptr %25, align 8, !tbaa !23
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %26, i32 0, i32 27
  %28 = load i8, ptr %27, align 1, !tbaa !24
  %29 = icmp ne i8 %28, 0
  br i1 %29, label %30, label %41

30:                                               ; preds = %1
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.jpeg_compress_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 25, ptr %34, align 8, !tbaa !26
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.jpeg_compress_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
  store i32 0, ptr %4, align 4, !tbaa !29
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %42, i32 0, i32 15
  %44 = load ptr, ptr %43, align 8, !tbaa !30
  store ptr %44, ptr %5, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %189, %41
  %46 = load i32, ptr %4, align 4, !tbaa !29
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %47, i32 0, i32 13
  %49 = load i32, ptr %48, align 4, !tbaa !31
  %50 = icmp slt i32 %46, %49
  br i1 %50, label %51, label %194

51:                                               ; preds = %45
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.jpeg_component_info, ptr %52, i32 0, i32 2
  %54 = load i32, ptr %53, align 8, !tbaa !32
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %55, i32 0, i32 41
  %57 = load i32, ptr %56, align 8, !tbaa !34
  %58 = icmp eq i32 %54, %57
  br i1 %58, label %59, label %88

59:                                               ; preds = %51
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.jpeg_component_info, ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 4, !tbaa !35
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %63, i32 0, i32 42
  %65 = load i32, ptr %64, align 4, !tbaa !36
  %66 = icmp eq i32 %62, %65
  br i1 %66, label %67, label %88

67:                                               ; preds = %59
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %68, i32 0, i32 28
  %70 = load i32, ptr %69, align 4, !tbaa !37
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %81

72:                                               ; preds = %67
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.my_downsampler, ptr %73, i32 0, i32 1
  %75 = load i32, ptr %4, align 4, !tbaa !29
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [10 x ptr], ptr %74, i64 0, i64 %76
  store ptr @fullsize_smooth_downsample, ptr %77, align 8, !tbaa !5
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.my_downsampler, ptr %78, i32 0, i32 0
  %80 = getelementptr inbounds %struct.jpeg_downsampler, ptr %79, i32 0, i32 2
  store i8 1, ptr %80, align 8, !tbaa !23
  br label %87

81:                                               ; preds = %67
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.my_downsampler, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %4, align 4, !tbaa !29
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10 x ptr], ptr %83, i64 0, i64 %85
  store ptr @fullsize_downsample, ptr %86, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %81, %72
  br label %188

88:                                               ; preds = %59, %51
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.jpeg_component_info, ptr %89, i32 0, i32 2
  %91 = load i32, ptr %90, align 8, !tbaa !32
  %92 = mul nsw i32 %91, 2
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %93, i32 0, i32 41
  %95 = load i32, ptr %94, align 8, !tbaa !34
  %96 = icmp eq i32 %92, %95
  br i1 %96, label %97, label %111

97:                                               ; preds = %88
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.jpeg_component_info, ptr %98, i32 0, i32 3
  %100 = load i32, ptr %99, align 4, !tbaa !35
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %101, i32 0, i32 42
  %103 = load i32, ptr %102, align 4, !tbaa !36
  %104 = icmp eq i32 %100, %103
  br i1 %104, label %105, label %111

105:                                              ; preds = %97
  store i8 0, ptr %6, align 1, !tbaa !9
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.my_downsampler, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %4, align 4, !tbaa !29
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [10 x ptr], ptr %107, i64 0, i64 %109
  store ptr @h2v1_downsample, ptr %110, align 8, !tbaa !5
  br label %187

111:                                              ; preds = %97, %88
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.jpeg_component_info, ptr %112, i32 0, i32 2
  %114 = load i32, ptr %113, align 8, !tbaa !32
  %115 = mul nsw i32 %114, 2
  %116 = load ptr, ptr %2, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %116, i32 0, i32 41
  %118 = load i32, ptr %117, align 8, !tbaa !34
  %119 = icmp eq i32 %115, %118
  br i1 %119, label %120, label %150

120:                                              ; preds = %111
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.jpeg_component_info, ptr %121, i32 0, i32 3
  %123 = load i32, ptr %122, align 4, !tbaa !35
  %124 = mul nsw i32 %123, 2
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %125, i32 0, i32 42
  %127 = load i32, ptr %126, align 4, !tbaa !36
  %128 = icmp eq i32 %124, %127
  br i1 %128, label %129, label %150

129:                                              ; preds = %120
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %130, i32 0, i32 28
  %132 = load i32, ptr %131, align 4, !tbaa !37
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %143

134:                                              ; preds = %129
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.my_downsampler, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %4, align 4, !tbaa !29
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [10 x ptr], ptr %136, i64 0, i64 %138
  store ptr @h2v2_smooth_downsample, ptr %139, align 8, !tbaa !5
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.my_downsampler, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds %struct.jpeg_downsampler, ptr %141, i32 0, i32 2
  store i8 1, ptr %142, align 8, !tbaa !23
  br label %149

143:                                              ; preds = %129
  %144 = load ptr, ptr %3, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.my_downsampler, ptr %144, i32 0, i32 1
  %146 = load i32, ptr %4, align 4, !tbaa !29
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [10 x ptr], ptr %145, i64 0, i64 %147
  store ptr @h2v2_downsample, ptr %148, align 8, !tbaa !5
  br label %149

149:                                              ; preds = %143, %134
  br label %186

150:                                              ; preds = %120, %111
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %151, i32 0, i32 41
  %153 = load i32, ptr %152, align 8, !tbaa !34
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.jpeg_component_info, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %155, align 8, !tbaa !32
  %157 = srem i32 %153, %156
  %158 = icmp eq i32 %157, 0
  br i1 %158, label %159, label %174

159:                                              ; preds = %150
  %160 = load ptr, ptr %2, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %160, i32 0, i32 42
  %162 = load i32, ptr %161, align 4, !tbaa !36
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.jpeg_component_info, ptr %163, i32 0, i32 3
  %165 = load i32, ptr %164, align 4, !tbaa !35
  %166 = srem i32 %162, %165
  %167 = icmp eq i32 %166, 0
  br i1 %167, label %168, label %174

168:                                              ; preds = %159
  store i8 0, ptr %6, align 1, !tbaa !9
  %169 = load ptr, ptr %3, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.my_downsampler, ptr %169, i32 0, i32 1
  %171 = load i32, ptr %4, align 4, !tbaa !29
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [10 x ptr], ptr %170, i64 0, i64 %172
  store ptr @int_downsample, ptr %173, align 8, !tbaa !5
  br label %185

174:                                              ; preds = %159, %150
  %175 = load ptr, ptr %2, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %175, i32 0, i32 0
  %177 = load ptr, ptr %176, align 8, !tbaa !25
  %178 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %177, i32 0, i32 5
  store i32 38, ptr %178, align 8, !tbaa !26
  %179 = load ptr, ptr %2, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !25
  %182 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !28
  %184 = load ptr, ptr %2, align 8, !tbaa !5
  call void %183(ptr noundef %184)
  br label %185

185:                                              ; preds = %174, %168
  br label %186

186:                                              ; preds = %185, %149
  br label %187

187:                                              ; preds = %186, %105
  br label %188

188:                                              ; preds = %187, %87
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %4, align 4, !tbaa !29
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %4, align 4, !tbaa !29
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.jpeg_component_info, ptr %192, i32 1
  store ptr %193, ptr %5, align 8, !tbaa !5
  br label %45, !llvm.loop !38

194:                                              ; preds = %45
  %195 = load ptr, ptr %2, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %195, i32 0, i32 28
  %197 = load i32, ptr %196, align 4, !tbaa !37
  %198 = icmp ne i32 %197, 0
  br i1 %198, label %199, label %213

199:                                              ; preds = %194
  %200 = load i8, ptr %6, align 1, !tbaa !9
  %201 = icmp ne i8 %200, 0
  br i1 %201, label %213, label %202

202:                                              ; preds = %199
  %203 = load ptr, ptr %2, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %203, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8, !tbaa !25
  %206 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %205, i32 0, i32 5
  store i32 99, ptr %206, align 8, !tbaa !26
  %207 = load ptr, ptr %2, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !25
  %210 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %209, i32 0, i32 1
  %211 = load ptr, ptr %210, align 8, !tbaa !40
  %212 = load ptr, ptr %2, align 8, !tbaa !5
  call void %211(ptr noundef %212, i32 noundef 0)
  br label %213

213:                                              ; preds = %202, %199, %194
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  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_downsample(ptr noundef) #0

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

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

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

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

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

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

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

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

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 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 8}
!11 = !{!"jpeg_compress_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !12, i64 36, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !13, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !6, i64 88, !7, i64 96, !7, i64 128, !7, i64 160, !7, i64 192, !7, i64 208, !7, i64 224, !12, i64 240, !6, i64 248, !7, i64 256, !7, i64 257, !7, i64 258, !7, i64 259, !12, i64 260, !12, i64 264, !12, i64 268, !12, i64 272, !7, i64 276, !7, i64 277, !7, i64 278, !7, i64 279, !14, i64 280, !14, i64 282, !7, i64 284, !12, i64 288, !7, i64 292, !12, i64 296, !12, i64 300, !12, i64 304, !12, i64 308, !7, i64 312, !12, i64 344, !12, i64 348, !12, i64 352, !7, i64 356, !12, i64 396, !12, i64 400, !12, i64 404, !12, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !12, i64 496}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"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, !17, i64 88, !17, i64 96}
!17 = !{!"long", !7, i64 0}
!18 = !{!11, !6, i64 464}
!19 = !{!20, !6, i64 0}
!20 = !{!"", !21, i64 0, !7, i64 24}
!21 = !{!"jpeg_downsampler", !6, i64 0, !6, i64 8, !7, i64 16}
!22 = !{!20, !6, i64 8}
!23 = !{!20, !7, i64 16}
!24 = !{!11, !7, i64 259}
!25 = !{!11, !6, i64 0}
!26 = !{!27, !12, i64 40}
!27 = !{!"jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !7, i64 44, !12, i64 124, !17, i64 128, !6, i64 136, !12, i64 144, !6, i64 152, !12, i64 160, !12, i64 164}
!28 = !{!27, !6, i64 0}
!29 = !{!12, !12, i64 0}
!30 = !{!11, !6, i64 88}
!31 = !{!11, !12, i64 76}
!32 = !{!33, !12, i64 8}
!33 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !7, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !6, i64 80, !6, i64 88}
!34 = !{!11, !12, i64 296}
!35 = !{!33, !12, i64 12}
!36 = !{!11, !12, i64 300}
!37 = !{!11, !12, i64 260}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!27, !6, i64 8}


; 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_downsampler(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 104) #1
  %6 = getelementptr inbounds i8, ptr %0, i64 464
  store ptr %5, ptr %6, align 8, !tbaa !16
  store ptr @start_pass_downsample, ptr %5, align 8, !tbaa !17
  %7 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr @sep_downsample, ptr %7, align 8, !tbaa !20
  %8 = getelementptr inbounds i8, ptr %5, i64 16
  store i8 0, ptr %8, align 8, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %0, i64 259
  %10 = load i8, ptr %9, align 1, !tbaa !22
  %.not = icmp eq i8 %10, 0
  br i1 %.not, label %15, label %11

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

15:                                               ; preds = %11, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 76
  %17 = load i32, ptr %16, align 4, !tbaa !27
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 88
  %20 = load ptr, ptr %19, align 8, !tbaa !28
  %21 = getelementptr inbounds i8, ptr %0, i64 296
  %22 = getelementptr inbounds i8, ptr %0, i64 300
  %23 = getelementptr inbounds i8, ptr %5, i64 24
  %24 = getelementptr inbounds i8, ptr %0, i64 260
  br label %25

25:                                               ; preds = %.lr.ph, %74
  %26 = phi i32 [ %17, %.lr.ph ], [ %75, %74 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %74 ]
  %.063 = phi i8 [ 1, %.lr.ph ], [ %.1, %74 ]
  %.05662 = phi ptr [ %20, %.lr.ph ], [ %76, %74 ]
  %27 = getelementptr inbounds i8, ptr %.05662, i64 8
  %28 = load i32, ptr %27, align 8, !tbaa !29
  %29 = load i32, ptr %21, align 8, !tbaa !31
  %30 = icmp eq i32 %28, %29
  br i1 %30, label %31, label %41

31:                                               ; preds = %25
  %32 = getelementptr inbounds i8, ptr %.05662, i64 12
  %33 = load i32, ptr %32, align 4, !tbaa !32
  %34 = load i32, ptr %22, align 4, !tbaa !33
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %41

36:                                               ; preds = %31
  %37 = load i32, ptr %24, align 4, !tbaa !34
  %.not59 = icmp eq i32 %37, 0
  %38 = getelementptr inbounds [10 x ptr], ptr %23, i64 0, i64 %indvars.iv
  br i1 %.not59, label %40, label %39

39:                                               ; preds = %36
  store ptr @fullsize_smooth_downsample, ptr %38, align 8, !tbaa !35
  store i8 1, ptr %8, align 8, !tbaa !21
  br label %74

40:                                               ; preds = %36
  store ptr @fullsize_downsample, ptr %38, align 8, !tbaa !35
  br label %74

41:                                               ; preds = %31, %25
  %42 = shl nsw i32 %28, 1
  %43 = icmp eq i32 %42, %29
  br i1 %43, label %44, label %59

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %.05662, i64 12
  %46 = load i32, ptr %45, align 4, !tbaa !32
  %47 = load i32, ptr %22, align 4, !tbaa !33
  %48 = icmp eq i32 %46, %47
  br i1 %48, label %49, label %51

49:                                               ; preds = %44
  %50 = getelementptr inbounds [10 x ptr], ptr %23, i64 0, i64 %indvars.iv
  store ptr @h2v1_downsample, ptr %50, align 8, !tbaa !35
  br label %74

51:                                               ; preds = %44
  %52 = shl nsw i32 %46, 1
  %53 = icmp eq i32 %52, %47
  br i1 %53, label %54, label %59

54:                                               ; preds = %51
  %55 = load i32, ptr %24, align 4, !tbaa !34
  %.not58 = icmp eq i32 %55, 0
  %56 = getelementptr inbounds [10 x ptr], ptr %23, i64 0, i64 %indvars.iv
  br i1 %.not58, label %58, label %57

57:                                               ; preds = %54
  store ptr @h2v2_smooth_downsample, ptr %56, align 8, !tbaa !35
  store i8 1, ptr %8, align 8, !tbaa !21
  br label %74

58:                                               ; preds = %54
  store ptr @h2v2_downsample, ptr %56, align 8, !tbaa !35
  br label %74

59:                                               ; preds = %41, %51
  %60 = srem i32 %29, %28
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %70

62:                                               ; preds = %59
  %63 = load i32, ptr %22, align 4, !tbaa !33
  %64 = getelementptr inbounds i8, ptr %.05662, i64 12
  %65 = load i32, ptr %64, align 4, !tbaa !32
  %66 = srem i32 %63, %65
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %62
  %69 = getelementptr inbounds [10 x ptr], ptr %23, i64 0, i64 %indvars.iv
  store ptr @int_downsample, ptr %69, align 8, !tbaa !35
  br label %74

70:                                               ; preds = %62, %59
  %71 = load ptr, ptr %0, align 8, !tbaa !23
  %72 = getelementptr inbounds i8, ptr %71, i64 40
  store i32 38, ptr %72, align 8, !tbaa !24
  %73 = load ptr, ptr %71, align 8, !tbaa !26
  tail call void %73(ptr noundef nonnull %0) #1
  %.pre = load i32, ptr %16, align 4, !tbaa !27
  br label %74

74:                                               ; preds = %40, %39, %58, %57, %70, %68, %49
  %75 = phi i32 [ %26, %39 ], [ %26, %40 ], [ %26, %49 ], [ %26, %57 ], [ %26, %58 ], [ %26, %68 ], [ %.pre, %70 ]
  %.1 = phi i8 [ %.063, %39 ], [ %.063, %40 ], [ 0, %49 ], [ %.063, %57 ], [ %.063, %58 ], [ 0, %68 ], [ %.063, %70 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %76 = getelementptr inbounds i8, ptr %.05662, i64 96
  %77 = sext i32 %75 to i64
  %78 = icmp slt i64 %indvars.iv.next, %77
  br i1 %78, label %25, label %._crit_edge, !llvm.loop !36

._crit_edge:                                      ; preds = %74
  %79 = icmp ne i8 %.1, 0
  %80 = getelementptr inbounds i8, ptr %0, i64 260
  %81 = load i32, ptr %80, align 4, !tbaa !34
  %82 = icmp eq i32 %81, 0
  %or.cond = select i1 %82, i1 true, i1 %79
  br i1 %or.cond, label %._crit_edge.thread, label %83

83:                                               ; preds = %._crit_edge
  %84 = load ptr, ptr %0, align 8, !tbaa !23
  %85 = getelementptr inbounds i8, ptr %84, i64 40
  store i32 99, ptr %85, align 8, !tbaa !24
  %86 = getelementptr inbounds i8, ptr %84, i64 8
  %87 = load ptr, ptr %86, align 8, !tbaa !38
  tail call void %87(ptr noundef nonnull %0, i32 noundef 0) #1
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %15, %83, %._crit_edge
  ret void
}

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @int_downsample(ptr noundef, ptr noundef, ptr noundef, 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 = { 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_compress_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, !11, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !7, i64 88, !8, i64 96, !8, i64 128, !8, i64 160, !8, i64 192, !8, i64 208, !8, i64 224, !10, i64 240, !7, i64 248, !8, i64 256, !8, i64 257, !8, i64 258, !8, i64 259, !10, i64 260, !10, i64 264, !10, i64 268, !10, i64 272, !8, i64 276, !8, i64 277, !8, i64 278, !8, i64 279, !12, i64 280, !12, i64 282, !8, i64 284, !10, i64 288, !8, i64 292, !10, i64 296, !10, i64 300, !10, i64 304, !10, i64 308, !8, i64 312, !10, i64 344, !10, i64 348, !10, i64 352, !8, i64 356, !10, i64 396, !10, i64 400, !10, i64 404, !10, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !7, i64 448, !7, i64 456, !7, i64 464, !7, i64 472, !7, i64 480, !7, i64 488, !10, i64 496}
!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 464}
!17 = !{!18, !7, i64 0}
!18 = !{!"", !19, i64 0, !8, i64 24}
!19 = !{!"jpeg_downsampler", !7, i64 0, !7, i64 8, !8, i64 16}
!20 = !{!18, !7, i64 8}
!21 = !{!18, !8, i64 16}
!22 = !{!6, !8, i64 259}
!23 = !{!6, !7, i64 0}
!24 = !{!25, !10, i64 40}
!25 = !{!"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}
!26 = !{!25, !7, i64 0}
!27 = !{!6, !10, i64 76}
!28 = !{!6, !7, i64 88}
!29 = !{!30, !10, i64 8}
!30 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !8, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !7, i64 80, !7, i64 88}
!31 = !{!6, !10, i64 296}
!32 = !{!30, !10, i64 12}
!33 = !{!6, !10, i64 300}
!34 = !{!6, !10, i64 260}
!35 = !{!7, !7, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!25, !7, i64 8}


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