; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_gui_basics)

; 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.juce::MouseCursor" = type { ptr }
%"class.juce::ResizableBorderComponent::Zone" = type { i32 }

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce24ResizableBorderComponent4Zone14getMouseCursorEv(ptr dead_on_unwind noalias writable sret(%"class.juce::MouseCursor") align 8 %0, ptr noundef nonnull align 4 dereferenceable(4) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 2, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.juce::ResizableBorderComponent::Zone", ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 4, !tbaa !11
  switch i32 %8, label %17 [
    i32 3, label %9
    i32 2, label %10
    i32 6, label %11
    i32 1, label %12
    i32 4, label %13
    i32 9, label %14
    i32 8, label %15
    i32 12, label %16
  ]

9:                                                ; preds = %2
  store i32 16, ptr %5, align 4, !tbaa !9
  br label %18

10:                                               ; preds = %2
  store i32 12, ptr %5, align 4, !tbaa !9
  br label %18

11:                                               ; preds = %2
  store i32 17, ptr %5, align 4, !tbaa !9
  br label %18

12:                                               ; preds = %2
  store i32 14, ptr %5, align 4, !tbaa !9
  br label %18

13:                                               ; preds = %2
  store i32 15, ptr %5, align 4, !tbaa !9
  br label %18

14:                                               ; preds = %2
  store i32 18, ptr %5, align 4, !tbaa !9
  br label %18

15:                                               ; preds = %2
  store i32 13, ptr %5, align 4, !tbaa !9
  br label %18

16:                                               ; preds = %2
  store i32 19, ptr %5, align 4, !tbaa !9
  br label %18

17:                                               ; preds = %2
  br label %18

18:                                               ; preds = %17, %16, %15, %14, %13, %12, %11, %10, %9
  %19 = load i32, ptr %5, align 4, !tbaa !9
  invoke void @_ZN4juce11MouseCursorC1ENS0_18StandardCursorTypeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %19)
          to label %20 unwind label %21

20:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          catch ptr null
  %23 = extractvalue { ptr, i32 } %22, 0
  call void @__clang_call_terminate(ptr %23) #4
  unreachable
}

declare void @_ZN4juce11MouseCursorC1ENS0_18StandardCursorTypeE(ptr, i32)

attributes #0 = { noinline noreturn nounwind uwtable "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 = { mustprogress 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 #3 = { nounwind }
attributes #4 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN4juce11MouseCursor18StandardCursorTypeE", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN4juce24ResizableBorderComponent4ZoneE", !13, i64 0}
!13 = !{!"int", !7, i64 0}


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

%"class.juce::MouseCursor" = type { ptr }

@switch.table._ZNK4juce24ResizableBorderComponent4Zone14getMouseCursorEv = private unnamed_addr constant [12 x i32] [i32 14, i32 12, i32 16, i32 15, i32 2, i32 17, i32 2, i32 13, i32 18, i32 2, i32 2, i32 19], align 4

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce24ResizableBorderComponent4Zone14getMouseCursorEv(ptr dead_on_unwind noalias writable sret(%"class.juce::MouseCursor") align 8 %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(4) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %switch.tableidx = add i32 %3, -1
  %4 = icmp ult i32 %switch.tableidx, 12
  br i1 %4, label %switch.lookup, label %6

switch.lookup:                                    ; preds = %2
  %5 = zext nneg i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [12 x i32], ptr @switch.table._ZNK4juce24ResizableBorderComponent4Zone14getMouseCursorEv, i64 0, i64 %5
  %switch.load = load i32, ptr %switch.gep, align 4
  br label %6

6:                                                ; preds = %switch.lookup, %2
  %.0 = phi i32 [ 2, %2 ], [ %switch.load, %switch.lookup ]
  invoke void @_ZN4juce11MouseCursorC1ENS0_18StandardCursorTypeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %.0)
          to label %7 unwind label %8

7:                                                ; preds = %6
  ret void

8:                                                ; preds = %6
  %9 = landingpad { ptr, i32 }
          catch ptr null
  %10 = extractvalue { ptr, i32 } %9, 0
  tail call void @__clang_call_terminate(ptr %10) #2
  unreachable
}

declare void @_ZN4juce11MouseCursorC1ENS0_18StandardCursorTypeE(ptr, i32) local_unnamed_addr

attributes #0 = { noinline noreturn nounwind uwtable "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 = { mustprogress 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 #2 = { noreturn 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 0}
!6 = !{!"_ZTSN4juce24ResizableBorderComponent4ZoneE", !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass