; 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::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZN4juce16ClipboardHelpersL21localClipboardContentE = external hidden global %"class.juce::String", align 8
@_ZN4juce7displayE = external global ptr, align 8
@_ZN4juce24juce_messageWindowHandleE = external global i64, align 8
@_ZN4juce16ClipboardHelpersL14atom_CLIPBOARDE = external hidden global i64, align 8
@_ZN4juce16ClipboardHelpersL16atom_UTF8_STRINGE = external hidden global i64, align 8

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce6StringaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #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 uwtable
define dso_local void @_ZN4juce15SystemClipboard20getTextFromClipboardEv(ptr dead_on_unwind noalias writable sret(%"class.juce::String") align 8 %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  store ptr %0, ptr %2, align 8
  store i1 false, ptr %3, align 1
  call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  %9 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %62

11:                                               ; preds = %1
  invoke void @_ZN4juce16ClipboardHelpersL18initSelectionAtomsEv()
          to label %12 unwind label %24

12:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 1, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  %13 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %14 = load i64, ptr %6, align 8, !tbaa !9
  %15 = invoke i64 @XGetSelectionOwner(ptr noundef %13, i64 noundef %14)
          to label %16 unwind label %28

16:                                               ; preds = %12
  store i64 %15, ptr %7, align 8, !tbaa !9
  %17 = icmp eq i64 %15, 0
  br i1 %17, label %18, label %32

18:                                               ; preds = %16
  %19 = load i64, ptr @_ZN4juce16ClipboardHelpersL14atom_CLIPBOARDE, align 8, !tbaa !9
  store i64 %19, ptr %6, align 8, !tbaa !9
  %20 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = invoke i64 @XGetSelectionOwner(ptr noundef %20, i64 noundef %21)
          to label %23 unwind label %28

23:                                               ; preds = %18
  store i64 %22, ptr %7, align 8, !tbaa !9
  br label %32

24:                                               ; preds = %11
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %4, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %5, align 4
  br label %66

28:                                               ; preds = %18, %12
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %4, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %5, align 4
  br label %61

32:                                               ; preds = %23, %16
  %33 = load i64, ptr %7, align 8, !tbaa !9
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %35, label %60

35:                                               ; preds = %32
  %36 = load i64, ptr %7, align 8, !tbaa !9
  %37 = load i64, ptr @_ZN4juce24juce_messageWindowHandleE, align 8, !tbaa !9
  %38 = icmp eq i64 %36, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %35
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce6StringaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) @_ZN4juce16ClipboardHelpersL21localClipboardContentE) #4
  br label %59

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = load i64, ptr @_ZN4juce16ClipboardHelpersL16atom_UTF8_STRINGE, align 8, !tbaa !9
  %44 = invoke noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %42, i64 noundef %43)
          to label %45 unwind label %54

45:                                               ; preds = %41
  %46 = zext i1 %44 to i8
  store i8 %46, ptr %8, align 1, !tbaa !11
  %47 = load i8, ptr %8, align 1, !tbaa !11, !range !13, !noundef !14
  %48 = trunc i8 %47 to i1
  br i1 %48, label %58, label %49

49:                                               ; preds = %45
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = invoke noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %50, i64 noundef 31)
          to label %52 unwind label %54

52:                                               ; preds = %49
  %53 = zext i1 %51 to i8
  store i8 %53, ptr %8, align 1, !tbaa !11
  br label %58

54:                                               ; preds = %49, %41
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %4, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %61

58:                                               ; preds = %52, %45
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %59

59:                                               ; preds = %58, %39
  br label %60

60:                                               ; preds = %59, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %62

61:                                               ; preds = %54, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %66

62:                                               ; preds = %60, %1
  store i1 true, ptr %3, align 1
  %63 = load i1, ptr %3, align 1
  br i1 %63, label %65, label %64

64:                                               ; preds = %62
  call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %65

65:                                               ; preds = %64, %62
  ret void

66:                                               ; preds = %61, %24
  call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %4, align 8
  %69 = load i32, ptr %5, align 4
  %70 = insertvalue { ptr, i32 } poison, ptr %68, 0
  %71 = insertvalue { ptr, i32 } %70, i32 %69, 1
  resume { ptr, i32 } %71
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4juce16ClipboardHelpersL18initSelectionAtomsEv() #2

declare i64 @XGetSelectionOwner(ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) #2

attributes #0 = { nounwind "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 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 = { "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 #4 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; 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::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZN4juce16ClipboardHelpersL21localClipboardContentE = external hidden global %"class.juce::String", align 8
@_ZN4juce7displayE = external local_unnamed_addr global ptr, align 8
@_ZN4juce24juce_messageWindowHandleE = external local_unnamed_addr global i64, align 8
@_ZN4juce16ClipboardHelpersL14atom_CLIPBOARDE = external hidden local_unnamed_addr global i64, align 8
@_ZN4juce16ClipboardHelpersL16atom_UTF8_STRINGE = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce6StringaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce15SystemClipboard20getTextFromClipboardEv(ptr dead_on_unwind noalias nonnull writable sret(%"class.juce::String") align 8 %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  %2 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %30, label %3

3:                                                ; preds = %1
  invoke void @_ZN4juce16ClipboardHelpersL18initSelectionAtomsEv()
          to label %4 unwind label %13

4:                                                ; preds = %3
  %5 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %6 = invoke i64 @XGetSelectionOwner(ptr noundef %5, i64 noundef 1)
          to label %7 unwind label %15

7:                                                ; preds = %4
  %8 = icmp eq i64 %6, 0
  br i1 %8, label %9, label %.thread

9:                                                ; preds = %7
  %10 = load i64, ptr @_ZN4juce16ClipboardHelpersL14atom_CLIPBOARDE, align 8, !tbaa !9
  %11 = load ptr, ptr @_ZN4juce7displayE, align 8, !tbaa !5
  %12 = invoke i64 @XGetSelectionOwner(ptr noundef %11, i64 noundef %10)
          to label %17 unwind label %15

13:                                               ; preds = %3
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %31

15:                                               ; preds = %9, %4
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %31

17:                                               ; preds = %9
  %.not14 = icmp eq i64 %12, 0
  br i1 %.not14, label %30, label %.thread

.thread:                                          ; preds = %7, %17
  %.021 = phi i64 [ %12, %17 ], [ %6, %7 ]
  %.0920 = phi i64 [ %10, %17 ], [ 1, %7 ]
  %18 = load i64, ptr @_ZN4juce24juce_messageWindowHandleE, align 8, !tbaa !9
  %19 = icmp eq i64 %.021, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %.thread
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce6StringaSERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) @_ZN4juce16ClipboardHelpersL21localClipboardContentE) #3
  br label %30

22:                                               ; preds = %.thread
  %23 = load i64, ptr @_ZN4juce16ClipboardHelpersL16atom_UTF8_STRINGE, align 8, !tbaa !9
  %24 = invoke noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %.0920, i64 noundef %23)
          to label %25 unwind label %28

25:                                               ; preds = %22
  br i1 %24, label %30, label %26

26:                                               ; preds = %25
  %27 = invoke noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %.0920, i64 noundef 31)
          to label %30 unwind label %28

28:                                               ; preds = %26, %22
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %31

30:                                               ; preds = %1, %25, %26, %20, %17
  ret void

31:                                               ; preds = %15, %28, %13
  %.pn.pn = phi { ptr, i32 } [ %14, %13 ], [ %29, %28 ], [ %16, %15 ]
  tail call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4juce16ClipboardHelpersL18initSelectionAtomsEv() local_unnamed_addr #1

declare i64 @XGetSelectionOwner(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN4juce16ClipboardHelpersL23requestSelectionContentERNS_6StringEmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { nounwind "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 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 = { "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 }

!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 = !{!"long", !7, i64 0}


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