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

; 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_comp_master = type { %struct.jpeg_comp_master, i32, i32, i32, i32 }
%struct.jpeg_comp_master = type { ptr, ptr, ptr, i8, i8 }

; Function Attrs: nounwind uwtable
define dso_local void @jinit_c_master_control(ptr noundef %0, i8 noundef zeroext %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %6, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !10
  %9 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call ptr %10(ptr noundef %11, i32 noundef 1, i64 noundef 48)
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %14, i32 0, i32 54
  store ptr %13, ptr %15, align 8, !tbaa !18
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.my_comp_master, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.jpeg_comp_master, ptr %17, i32 0, i32 0
  store ptr @prepare_for_pass, ptr %18, align 8, !tbaa !19
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.my_comp_master, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.jpeg_comp_master, ptr %20, i32 0, i32 1
  store ptr @pass_startup, ptr %21, align 8, !tbaa !22
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.my_comp_master, ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.jpeg_comp_master, ptr %23, i32 0, i32 2
  store ptr @finish_pass_master, ptr %24, align 8, !tbaa !23
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.my_comp_master, ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.jpeg_comp_master, ptr %26, i32 0, i32 4
  store i8 0, ptr %27, align 1, !tbaa !24
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  call void @initial_setup(ptr noundef %28)
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %29, i32 0, i32 23
  %31 = load ptr, ptr %30, align 8, !tbaa !25
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %35

33:                                               ; preds = %2
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  call void @validate_script(ptr noundef %34)
  br label %40

35:                                               ; preds = %2
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %36, i32 0, i32 40
  store i8 0, ptr %37, align 4, !tbaa !26
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %38, i32 0, i32 22
  store i32 1, ptr %39, align 8, !tbaa !27
  br label %40

40:                                               ; preds = %35, %33
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %41, i32 0, i32 40
  %43 = load i8, ptr %42, align 4, !tbaa !26
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %40
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %46, i32 0, i32 26
  store i8 1, ptr %47, align 2, !tbaa !28
  br label %48

48:                                               ; preds = %45, %40
  %49 = load i8, ptr %4, align 1, !tbaa !9
  %50 = icmp ne i8 %49, 0
  br i1 %50, label %51, label %63

51:                                               ; preds = %48
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %52, i32 0, i32 26
  %54 = load i8, ptr %53, align 2, !tbaa !28
  %55 = icmp ne i8 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %51
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.my_comp_master, ptr %57, i32 0, i32 1
  store i32 1, ptr %58, align 8, !tbaa !29
  br label %62

59:                                               ; preds = %51
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.my_comp_master, ptr %60, i32 0, i32 1
  store i32 2, ptr %61, align 8, !tbaa !29
  br label %62

62:                                               ; preds = %59, %56
  br label %66

63:                                               ; preds = %48
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.my_comp_master, ptr %64, i32 0, i32 1
  store i32 0, ptr %65, align 8, !tbaa !29
  br label %66

66:                                               ; preds = %63, %62
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.my_comp_master, ptr %67, i32 0, i32 4
  store i32 0, ptr %68, align 4, !tbaa !30
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.my_comp_master, ptr %69, i32 0, i32 2
  store i32 0, ptr %70, align 4, !tbaa !31
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %71, i32 0, i32 26
  %73 = load i8, ptr %72, align 2, !tbaa !28
  %74 = icmp ne i8 %73, 0
  br i1 %74, label %75, label %82

75:                                               ; preds = %66
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %76, i32 0, i32 22
  %78 = load i32, ptr %77, align 8, !tbaa !27
  %79 = mul nsw i32 %78, 2
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.my_comp_master, ptr %80, i32 0, i32 3
  store i32 %79, ptr %81, align 8, !tbaa !32
  br label %88

82:                                               ; preds = %66
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.jpeg_compress_struct, ptr %83, i32 0, i32 22
  %85 = load i32, ptr %84, align 8, !tbaa !27
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.my_comp_master, ptr %86, i32 0, i32 3
  store i32 %85, ptr %87, align 8, !tbaa !32
  br label %88

88:                                               ; preds = %82, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #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 @prepare_for_pass(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @validate_script(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 416}
!19 = !{!20, !6, i64 0}
!20 = !{!"", !21, i64 0, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44}
!21 = !{!"jpeg_comp_master", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 25}
!22 = !{!20, !6, i64 8}
!23 = !{!20, !6, i64 16}
!24 = !{!20, !7, i64 25}
!25 = !{!11, !6, i64 248}
!26 = !{!11, !7, i64 292}
!27 = !{!11, !12, i64 240}
!28 = !{!11, !7, i64 258}
!29 = !{!20, !12, i64 32}
!30 = !{!20, !12, i64 44}
!31 = !{!20, !12, i64 36}
!32 = !{!20, !12, i64 40}


; 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_c_master_control(ptr noundef %0, i8 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !13
  %6 = tail call ptr %5(ptr noundef %0, i32 noundef 1, i64 noundef 48) #1
  %7 = getelementptr inbounds i8, ptr %0, i64 416
  store ptr %6, ptr %7, align 8, !tbaa !16
  store ptr @prepare_for_pass, ptr %6, align 8, !tbaa !17
  %8 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr @pass_startup, ptr %8, align 8, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr @finish_pass_master, ptr %9, align 8, !tbaa !21
  %10 = getelementptr inbounds i8, ptr %6, i64 25
  store i8 0, ptr %10, align 1, !tbaa !22
  tail call void @initial_setup(ptr noundef %0)
  %11 = getelementptr inbounds i8, ptr %0, i64 248
  %12 = load ptr, ptr %11, align 8, !tbaa !23
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %.thread, label %15

.thread:                                          ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 292
  store i8 0, ptr %13, align 4, !tbaa !24
  %14 = getelementptr inbounds i8, ptr %0, i64 240
  store i32 1, ptr %14, align 8, !tbaa !25
  br label %19

15:                                               ; preds = %2
  tail call void @validate_script(ptr noundef nonnull %0)
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 292
  %.pre = load i8, ptr %.phi.trans.insert, align 4, !tbaa !24
  %16 = icmp eq i8 %.pre, 0
  br i1 %16, label %19, label %17

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 258
  store i8 1, ptr %18, align 2, !tbaa !26
  br label %19

19:                                               ; preds = %.thread, %17, %15
  %.not27 = icmp eq i8 %1, 0
  br i1 %.not27, label %26, label %20

20:                                               ; preds = %19
  %21 = getelementptr inbounds i8, ptr %0, i64 258
  %22 = load i8, ptr %21, align 2, !tbaa !26
  %.not28 = icmp eq i8 %22, 0
  %23 = getelementptr inbounds i8, ptr %6, i64 32
  %24 = getelementptr inbounds i8, ptr %6, i64 44
  %25 = getelementptr inbounds i8, ptr %6, i64 36
  br i1 %.not28, label %.thread33, label %.thread35

.thread35:                                        ; preds = %20
  store i32 1, ptr %23, align 8, !tbaa !27
  store i32 0, ptr %24, align 4, !tbaa !28
  store i32 0, ptr %25, align 4, !tbaa !29
  br label %31

.thread33:                                        ; preds = %20
  store i32 2, ptr %23, align 8, !tbaa !27
  store i32 0, ptr %24, align 4, !tbaa !28
  store i32 0, ptr %25, align 4, !tbaa !29
  br label %35

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %6, i64 32
  store i32 0, ptr %27, align 8, !tbaa !27
  %.phi.trans.insert30 = getelementptr inbounds i8, ptr %0, i64 258
  %.pre31 = load i8, ptr %.phi.trans.insert30, align 2, !tbaa !26
  %28 = icmp eq i8 %.pre31, 0
  %29 = getelementptr inbounds i8, ptr %6, i64 44
  store i32 0, ptr %29, align 4, !tbaa !28
  %30 = getelementptr inbounds i8, ptr %6, i64 36
  store i32 0, ptr %30, align 4, !tbaa !29
  br i1 %28, label %35, label %31

31:                                               ; preds = %.thread35, %26
  %32 = getelementptr inbounds i8, ptr %0, i64 240
  %33 = load i32, ptr %32, align 8, !tbaa !25
  %34 = shl nsw i32 %33, 1
  br label %38

35:                                               ; preds = %.thread33, %26
  %36 = getelementptr inbounds i8, ptr %0, i64 240
  %37 = load i32, ptr %36, align 8, !tbaa !25
  br label %38

38:                                               ; preds = %35, %31
  %.sink = phi i32 [ %37, %35 ], [ %34, %31 ]
  %39 = getelementptr inbounds i8, ptr %6, i64 40
  store i32 %.sink, ptr %39, align 8
  ret void
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @validate_script(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_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 416}
!17 = !{!18, !7, i64 0}
!18 = !{!"", !19, i64 0, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!19 = !{!"jpeg_comp_master", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !8, i64 25}
!20 = !{!18, !7, i64 8}
!21 = !{!18, !7, i64 16}
!22 = !{!18, !8, i64 25}
!23 = !{!6, !7, i64 248}
!24 = !{!6, !8, i64 292}
!25 = !{!6, !10, i64 240}
!26 = !{!6, !8, i64 258}
!27 = !{!18, !10, i64 32}
!28 = !{!18, !10, i64 44}
!29 = !{!18, !10, i64 36}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass,TailCallElimPass