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

; 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_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_memory_mgr = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }
%struct.jpeg_marker_writer = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @jinit_compress_master(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_c_master_control(ptr noundef %3, i8 noundef zeroext 0)
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %4, i32 0, i32 24
  %6 = load i8, ptr %5, align 8, !tbaa !9
  %7 = icmp ne i8 %6, 0
  br i1 %7, label %12, label %8

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_color_converter(ptr noundef %9)
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_downsampler(ptr noundef %10)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_c_prep_controller(ptr noundef %11, i8 noundef zeroext 0)
  br label %12

12:                                               ; preds = %8, %1
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_forward_dct(ptr noundef %13)
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %14, i32 0, i32 25
  %16 = load i8, ptr %15, align 1, !tbaa !14
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %18, label %29

18:                                               ; preds = %12
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !15
  %22 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %21, i32 0, i32 5
  store i32 1, ptr %22, align 8, !tbaa !16
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !19
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  call void %27(ptr noundef %28)
  br label %39

29:                                               ; preds = %12
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %30, i32 0, i32 40
  %32 = load i8, ptr %31, align 4, !tbaa !20
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %36

34:                                               ; preds = %29
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_phuff_encoder(ptr noundef %35)
  br label %38

36:                                               ; preds = %29
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_huff_encoder(ptr noundef %37)
  br label %38

38:                                               ; preds = %36, %34
  br label %39

39:                                               ; preds = %38, %18
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %41, i32 0, i32 22
  %43 = load i32, ptr %42, align 8, !tbaa !21
  %44 = icmp sgt i32 %43, 1
  br i1 %44, label %51, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %46, i32 0, i32 26
  %48 = load i8, ptr %47, align 2, !tbaa !22
  %49 = zext i8 %48 to i32
  %50 = icmp ne i32 %49, 0
  br label %51

51:                                               ; preds = %45, %39
  %52 = phi i1 [ true, %39 ], [ %50, %45 ]
  %53 = zext i1 %52 to i32
  %54 = trunc i32 %53 to i8
  call void @jinit_c_coef_controller(ptr noundef %40, i8 noundef zeroext %54)
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_c_main_controller(ptr noundef %55, i8 noundef zeroext 0)
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jinit_marker_writer(ptr noundef %56)
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !24
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  call void %61(ptr noundef %62)
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %63, i32 0, i32 58
  %65 = load ptr, ptr %64, align 8, !tbaa !26
  %66 = getelementptr inbounds %struct.jpeg_marker_writer, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !27
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  call void %67(ptr noundef %68)
  ret void
}

declare void @jinit_c_master_control(ptr noundef, i8 noundef zeroext) #1

declare void @jinit_color_converter(ptr noundef) #1

declare void @jinit_downsampler(ptr noundef) #1

declare void @jinit_c_prep_controller(ptr noundef, i8 noundef zeroext) #1

declare void @jinit_forward_dct(ptr noundef) #1

declare void @jinit_phuff_encoder(ptr noundef) #1

declare void @jinit_huff_encoder(ptr noundef) #1

declare void @jinit_c_coef_controller(ptr noundef, i8 noundef zeroext) #1

declare void @jinit_c_main_controller(ptr noundef, i8 noundef zeroext) #1

declare void @jinit_marker_writer(ptr noundef) #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 256}
!10 = !{!"jpeg_compress_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, !12, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !6, i64 88, !7, i64 96, !7, i64 128, !7, i64 160, !7, i64 192, !7, i64 208, !7, i64 224, !11, i64 240, !6, i64 248, !7, i64 256, !7, i64 257, !7, i64 258, !7, i64 259, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !7, i64 276, !7, i64 277, !7, i64 278, !7, i64 279, !13, i64 280, !13, i64 282, !7, i64 284, !11, i64 288, !7, i64 292, !11, i64 296, !11, i64 300, !11, i64 304, !11, i64 308, !7, i64 312, !11, i64 344, !11, i64 348, !11, i64 352, !7, i64 356, !11, i64 396, !11, i64 400, !11, i64 404, !11, 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, !11, i64 496}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !7, i64 257}
!15 = !{!10, !6, i64 0}
!16 = !{!17, !11, i64 40}
!17 = !{!"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, !18, i64 128, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 164}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !6, i64 0}
!20 = !{!10, !7, i64 292}
!21 = !{!10, !11, i64 240}
!22 = !{!10, !7, i64 258}
!23 = !{!10, !6, i64 8}
!24 = !{!25, !6, i64 48}
!25 = !{!"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, !18, i64 88, !18, i64 96}
!26 = !{!10, !6, i64 448}
!27 = !{!28, !6, i64 0}
!28 = !{!"jpeg_marker_writer", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}


; 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_compress_master(ptr noundef %0) local_unnamed_addr #0 {
  tail call void @jinit_c_master_control(ptr noundef %0, i8 noundef zeroext 0) #2
  %2 = getelementptr inbounds i8, ptr %0, i64 256
  %3 = load i8, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %4, label %5

4:                                                ; preds = %1
  tail call void @jinit_color_converter(ptr noundef nonnull %0) #2
  tail call void @jinit_downsampler(ptr noundef nonnull %0) #2
  tail call void @jinit_c_prep_controller(ptr noundef nonnull %0, i8 noundef zeroext 0) #2
  br label %5

5:                                                ; preds = %4, %1
  tail call void @jinit_forward_dct(ptr noundef nonnull %0) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 257
  %7 = load i8, ptr %6, align 1, !tbaa !13
  %.not22 = icmp eq i8 %7, 0
  br i1 %.not22, label %12, label %8

8:                                                ; preds = %5
  %9 = load ptr, ptr %0, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %9, i64 40
  store i32 1, ptr %10, align 8, !tbaa !15
  %11 = load ptr, ptr %9, align 8, !tbaa !18
  tail call void %11(ptr noundef nonnull %0) #2
  br label %17

12:                                               ; preds = %5
  %13 = getelementptr inbounds i8, ptr %0, i64 292
  %14 = load i8, ptr %13, align 4, !tbaa !19
  %.not23 = icmp eq i8 %14, 0
  br i1 %.not23, label %16, label %15

15:                                               ; preds = %12
  tail call void @jinit_phuff_encoder(ptr noundef nonnull %0) #2
  br label %17

16:                                               ; preds = %12
  tail call void @jinit_huff_encoder(ptr noundef nonnull %0) #2
  br label %17

17:                                               ; preds = %15, %16, %8
  %18 = getelementptr inbounds i8, ptr %0, i64 240
  %19 = load i32, ptr %18, align 8, !tbaa !20
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %26, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 258
  %23 = load i8, ptr %22, align 2, !tbaa !21
  %24 = icmp ne i8 %23, 0
  %25 = zext i1 %24 to i8
  br label %26

26:                                               ; preds = %21, %17
  %27 = phi i8 [ 1, %17 ], [ %25, %21 ]
  tail call void @jinit_c_coef_controller(ptr noundef nonnull %0, i8 noundef zeroext %27) #2
  tail call void @jinit_c_main_controller(ptr noundef nonnull %0, i8 noundef zeroext 0) #2
  tail call void @jinit_marker_writer(ptr noundef nonnull %0) #2
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %29, i64 48
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  tail call void %31(ptr noundef nonnull %0) #2
  %32 = getelementptr inbounds i8, ptr %0, i64 448
  %33 = load ptr, ptr %32, align 8, !tbaa !25
  %34 = load ptr, ptr %33, align 8, !tbaa !26
  tail call void %34(ptr noundef nonnull %0) #2
  ret void
}

declare void @jinit_c_master_control(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @jinit_color_converter(ptr noundef) local_unnamed_addr #1

declare void @jinit_downsampler(ptr noundef) local_unnamed_addr #1

declare void @jinit_c_prep_controller(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @jinit_forward_dct(ptr noundef) local_unnamed_addr #1

declare void @jinit_phuff_encoder(ptr noundef) local_unnamed_addr #1

declare void @jinit_huff_encoder(ptr noundef) local_unnamed_addr #1

declare void @jinit_c_coef_controller(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @jinit_c_main_controller(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @jinit_marker_writer(ptr noundef) local_unnamed_addr #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 = { "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 = { 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, !8, i64 256}
!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 = !{!6, !8, i64 257}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !10, i64 40}
!16 = !{!"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, !17, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 164}
!17 = !{!"long", !8, i64 0}
!18 = !{!16, !7, i64 0}
!19 = !{!6, !8, i64 292}
!20 = !{!6, !10, i64 240}
!21 = !{!6, !8, i64 258}
!22 = !{!6, !7, i64 8}
!23 = !{!24, !7, i64 48}
!24 = !{!"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, !17, i64 88, !17, i64 96}
!25 = !{!6, !7, i64 448}
!26 = !{!27, !7, i64 0}
!27 = !{!"jpeg_marker_writer", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass