; 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::ThreadWithProgressWindow" = type <{ %"class.juce::Thread.base", [3 x i8], %"class.juce::Timer", double, %"class.juce::ScopedPointer.523", %"class.juce::String", %"class.juce::CriticalSection", i32, i8, [3 x i8] }>
%"class.juce::Thread.base" = type <{ ptr, %"class.juce::String", ptr, ptr, %"class.juce::CriticalSection", %"class.juce::WaitableEvent", %"class.juce::WaitableEvent", i32, [4 x i8], i64, i32, i8 }>
%"class.juce::WaitableEvent" = type <{ %union.pthread_cond_t, %union.pthread_mutex_t, i8, i8, [6 x i8] }>
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.juce::Timer" = type { ptr, i32, i32, ptr, ptr }
%"class.juce::ScopedPointer.523" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::CriticalSection" = type { %union.pthread_mutex_t }

declare noundef ptr @_ZN4juce14MessageManager11getInstanceEv() #0

declare noundef zeroext i1 @_ZN4juce14MessageManager20runDispatchLoopUntilEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce5Timer14isTimerRunningEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce24ThreadWithProgressWindow12launchThreadEi(ptr noundef nonnull align 8 dereferenceable(389), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce24ThreadWithProgressWindow9runThreadEi(ptr noundef nonnull align 8 dereferenceable(389) %0, i32 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN4juce24ThreadWithProgressWindow12launchThreadEi(ptr noundef nonnull align 8 dereferenceable(389) %5, i32 noundef %6)
  br label %7

7:                                                ; preds = %10, %2
  %8 = getelementptr inbounds i8, ptr %5, i64 288
  %9 = call noundef zeroext i1 @_ZNK4juce5Timer14isTimerRunningEv(ptr noundef nonnull align 8 dereferenceable(32) %8) #3
  br i1 %9, label %10, label %13

10:                                               ; preds = %7
  %11 = call noundef ptr @_ZN4juce14MessageManager11getInstanceEv()
  %12 = call noundef zeroext i1 @_ZN4juce14MessageManager20runDispatchLoopUntilEi(ptr noundef nonnull align 8 dereferenceable(72) %11, i32 noundef 5)
  br label %7, !llvm.loop !11

13:                                               ; preds = %7
  %14 = getelementptr inbounds %"class.juce::ThreadWithProgressWindow", ptr %5, i32 0, i32 8
  %15 = load i8, ptr %14, align 4, !tbaa !13, !range !25, !noundef !26
  %16 = trunc i8 %15 to i1
  %17 = xor i1 %16, true
  ret i1 %17
}

attributes #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 = { 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !20, i64 388}
!14 = !{!"_ZTSN4juce24ThreadWithProgressWindowE", !15, i64 0, !22, i64 288, !23, i64 320, !24, i64 328, !16, i64 336, !18, i64 344, !10, i64 384, !20, i64 388}
!15 = !{!"_ZTSN4juce6ThreadE", !16, i64 8, !6, i64 16, !6, i64 24, !18, i64 32, !19, i64 72, !19, i64 168, !10, i64 264, !21, i64 272, !10, i64 280, !20, i64 284}
!16 = !{!"_ZTSN4juce6StringE", !17, i64 0}
!17 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!18 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!19 = !{!"_ZTSN4juce13WaitableEventE", !7, i64 0, !7, i64 48, !20, i64 88, !20, i64 89}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSN4juce5TimerE", !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24}
!23 = !{!"double", !7, i64 0}
!24 = !{!"_ZTSN4juce13ScopedPointerINS_11AlertWindowEEE", !6, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}


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

declare noundef ptr @_ZN4juce14MessageManager11getInstanceEv() local_unnamed_addr #0

declare noundef zeroext i1 @_ZN4juce14MessageManager20runDispatchLoopUntilEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce5Timer14isTimerRunningEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce24ThreadWithProgressWindow12launchThreadEi(ptr noundef nonnull align 8 dereferenceable(389), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce24ThreadWithProgressWindow9runThreadEi(ptr noundef nonnull align 8 dereferenceable(389) %0, i32 noundef %1) local_unnamed_addr #2 align 2 {
  tail call void @_ZN4juce24ThreadWithProgressWindow12launchThreadEi(ptr noundef nonnull align 8 dereferenceable(389) %0, i32 noundef %1)
  %3 = getelementptr inbounds i8, ptr %0, i64 288
  %4 = tail call noundef zeroext i1 @_ZNK4juce5Timer14isTimerRunningEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #3
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %5 = tail call noundef ptr @_ZN4juce14MessageManager11getInstanceEv()
  %6 = tail call noundef zeroext i1 @_ZN4juce14MessageManager20runDispatchLoopUntilEi(ptr noundef nonnull align 8 dereferenceable(72) %5, i32 noundef 5)
  %7 = tail call noundef zeroext i1 @_ZNK4juce5Timer14isTimerRunningEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #3
  br i1 %7, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %2
  %8 = getelementptr inbounds i8, ptr %0, i64 388
  %9 = load i8, ptr %8, align 4, !tbaa !7, !range !23, !noundef !24
  %10 = trunc nuw i8 %9 to i1
  %11 = xor i1 %10, true
  ret i1 %11
}

attributes #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 = { 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 = { 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !17, i64 388}
!8 = !{!"_ZTSN4juce24ThreadWithProgressWindowE", !9, i64 0, !20, i64 288, !21, i64 320, !22, i64 328, !10, i64 336, !15, i64 344, !18, i64 384, !17, i64 388}
!9 = !{!"_ZTSN4juce6ThreadE", !10, i64 8, !12, i64 16, !12, i64 24, !15, i64 32, !16, i64 72, !16, i64 168, !18, i64 264, !19, i64 272, !18, i64 280, !17, i64 284}
!10 = !{!"_ZTSN4juce6StringE", !11, i64 0}
!11 = !{!"_ZTSN4juce16CharPointer_UTF8E", !12, i64 0}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"_ZTSN4juce15CriticalSectionE", !13, i64 0}
!16 = !{!"_ZTSN4juce13WaitableEventE", !13, i64 0, !13, i64 48, !17, i64 88, !17, i64 89}
!17 = !{!"bool", !13, i64 0}
!18 = !{!"int", !13, i64 0}
!19 = !{!"long", !13, i64 0}
!20 = !{!"_ZTSN4juce5TimerE", !18, i64 8, !18, i64 12, !12, i64 16, !12, i64 24}
!21 = !{!"double", !13, i64 0}
!22 = !{!"_ZTSN4juce13ScopedPointerINS_11AlertWindowEEE", !12, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass