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

; 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::CodeDocument::Position" = type <{ ptr, i32, i32, i32, i8, [3 x i8] }>
%"class.juce::CodeDocument" = type { %"class.juce::OwnedArray", %"class.juce::Array.8", %"class.juce::UndoManager", i32, i32, i32, [4 x i8], %"class.juce::ListenerList.18", %"class.juce::String" }
%"class.juce::OwnedArray" = type { %"class.juce::ArrayAllocationBase.5", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.5" = type <{ %"class.juce::HeapBlock.6", i32, [4 x i8] }>
%"class.juce::HeapBlock.6" = type { ptr }
%"class.juce::Array.8" = type { %"class.juce::ArrayAllocationBase.9", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.9" = type <{ %"class.juce::HeapBlock.10", i32, [4 x i8] }>
%"class.juce::HeapBlock.10" = type { ptr }
%"class.juce::UndoManager" = type <{ %"class.juce::ChangeBroadcaster", %"class.juce::OwnedArray.13", %"class.juce::OwnedArray.13", %"class.juce::String", i32, i32, i32, i32, i8, i8, [6 x i8] }>
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%"class.juce::ListenerList" = type { %"class.juce::Array" }
%"class.juce::Array" = type { %"class.juce::ArrayAllocationBase", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase" = type <{ %"class.juce::HeapBlock", i32, [4 x i8] }>
%"class.juce::HeapBlock" = type { ptr }
%"class.juce::OwnedArray.13" = type { %"class.juce::ArrayAllocationBase.14", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.14" = type <{ %"class.juce::HeapBlock.15", i32, [4 x i8] }>
%"class.juce::HeapBlock.15" = type { ptr }
%"class.juce::ListenerList.18" = type { %"class.juce::Array.19" }
%"class.juce::Array.19" = type { %"class.juce::ArrayAllocationBase.20", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.20" = type <{ %"class.juce::HeapBlock.21", i32, [4 x i8] }>
%"class.juce::HeapBlock.21" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %0, i1 noundef zeroext %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = zext i1 %1 to i8
  store i8 %6, ptr %4, align 1, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  %8 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %9 = trunc i8 %8 to i1
  %10 = zext i1 %9 to i32
  %11 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %7, i32 0, i32 4
  %12 = load i8, ptr %11, align 4, !tbaa !13, !range !11, !noundef !12
  %13 = trunc i8 %12 to i1
  %14 = zext i1 %13 to i32
  %15 = icmp ne i32 %10, %14
  br i1 %15, label %16, label %41

16:                                               ; preds = %2
  %17 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %18 = trunc i8 %17 to i1
  %19 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %7, i32 0, i32 4
  %20 = zext i1 %18 to i8
  store i8 %20, ptr %19, align 4, !tbaa !13
  %21 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %7, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %40

24:                                               ; preds = %16
  %25 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %7, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = getelementptr inbounds %"class.juce::CodeDocument", ptr %31, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  store ptr %7, ptr %5, align 8, !tbaa !5
  call void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20) %32, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %39

33:                                               ; preds = %24
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  %36 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %7, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = getelementptr inbounds %"class.juce::CodeDocument", ptr %37, i32 0, i32 1
  call void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE24removeFirstMatchingValueES3_(ptr noundef nonnull align 8 dereferenceable(20) %38, ptr noundef %7)
  br label %39

39:                                               ; preds = %35, %29
  br label %40

40:                                               ; preds = %39, %16
  br label %41

41:                                               ; preds = %40, %2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE24removeFirstMatchingValueES3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !10, i64 20}
!14 = !{!"_ZTSN4juce12CodeDocument8PositionE", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !10, i64 20}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !6, 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"

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %0, i1 noundef zeroext %1) local_unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 20
  %5 = load i8, ptr %4, align 4, !tbaa !5, !range !12, !noundef !13
  %6 = zext i1 %1 to i8
  %.not = icmp eq i8 %5, %6
  br i1 %.not, label %13, label %7

7:                                                ; preds = %2
  store i8 %6, ptr %4, align 4, !tbaa !5
  %8 = load ptr, ptr %0, align 8, !tbaa !14
  %.not3 = icmp eq ptr %8, null
  br i1 %.not3, label %13, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %8, i64 24
  br i1 %1, label %11, label %12

11:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #2
  store ptr %0, ptr %3, align 8, !tbaa !15
  call void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20) %10, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #2
  br label %13

12:                                               ; preds = %9
  tail call void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE24removeFirstMatchingValueES3_(ptr noundef nonnull align 8 dereferenceable(20) %10, ptr noundef nonnull %0)
  br label %13

13:                                               ; preds = %7, %12, %11, %2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE3addEOS3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayIPNS_12CodeDocument8PositionENS_20DummyCriticalSectionELi0EE24removeFirstMatchingValueES3_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !11, i64 20}
!6 = !{!"_ZTSN4juce12CodeDocument8PositionE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!6, !7, i64 0}
!15 = !{!7, !7, i64 0}


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