; LLVM IR from modlfo/AudioEngine :: AudioEngine/Source (Server)

; 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.ServerConnections = type { %"class.juce::Thread.base", ptr, ptr }
%"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::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::CriticalSection" = type { %union.pthread_mutex_t }
%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::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 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17ServerConnections5startEiRKN4juce6StringEPNS0_10OwnedArrayINS0_15StreamingSocketENS0_20DummyCriticalSectionEEE(ptr noundef nonnull align 8 dereferenceable(304) %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef %3) #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8
  %12 = load ptr, ptr %8, align 8, !tbaa !5
  %13 = getelementptr inbounds %class.ServerConnections, ptr %11, i32 0, i32 2
  store ptr %12, ptr %13, align 8, !tbaa !11
  %14 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #4
  invoke void @_ZN4juce15StreamingSocketC1Ev(ptr noundef nonnull align 8 dereferenceable(64) %14)
          to label %15 unwind label %23

15:                                               ; preds = %4
  %16 = getelementptr inbounds %class.ServerConnections, ptr %11, i32 0, i32 1
  store ptr %14, ptr %16, align 8, !tbaa !20
  %17 = getelementptr inbounds %class.ServerConnections, ptr %11, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !20
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZN4juce15StreamingSocket14createListenerEiRKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(64) %18, i32 noundef %19, ptr noundef nonnull align 8 dereferenceable(8) %20)
  br i1 %21, label %22, label %27

22:                                               ; preds = %15
  call void @_ZN4juce6Thread11startThreadEv(ptr noundef nonnull align 8 dereferenceable(285) %11)
  br label %27

23:                                               ; preds = %4
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %9, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %14, i64 noundef 64) #5
  br label %28

27:                                               ; preds = %22, %15
  ret void

28:                                               ; preds = %23
  %29 = load ptr, ptr %9, align 8
  %30 = load i32, ptr %10, align 4
  %31 = insertvalue { ptr, i32 } poison, ptr %29, 0
  %32 = insertvalue { ptr, i32 } %31, i32 %30, 1
  resume { ptr, i32 } %32
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare void @_ZN4juce15StreamingSocketC1Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

declare noundef zeroext i1 @_ZN4juce15StreamingSocket14createListenerEiRKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #2

declare void @_ZN4juce6Thread11startThreadEv(ptr noundef nonnull align 8 dereferenceable(285)) #2

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { nobuiltin 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 #4 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!12, !6, i64 296}
!12 = !{!"_ZTS17ServerConnections", !13, i64 0, !6, i64 288, !6, i64 296}
!13 = !{!"_ZTSN4juce6ThreadE", !14, i64 8, !6, i64 16, !6, i64 24, !16, i64 32, !17, i64 72, !17, i64 168, !10, i64 264, !19, i64 272, !10, i64 280, !18, i64 284}
!14 = !{!"_ZTSN4juce6StringE", !15, i64 0}
!15 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!16 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!17 = !{!"_ZTSN4juce13WaitableEventE", !7, i64 0, !7, i64 48, !18, i64 88, !18, i64 89}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!12, !6, i64 288}


; 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 i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17ServerConnections5startEiRKN4juce6StringEPNS0_10OwnedArrayINS0_15StreamingSocketENS0_20DummyCriticalSectionEEE(ptr noundef nonnull align 8 dereferenceable(304) %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef %3) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 296
  store ptr %3, ptr %5, align 8, !tbaa !5
  %6 = tail call noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #4
  invoke void @_ZN4juce15StreamingSocketC1Ev(ptr noundef nonnull align 8 dereferenceable(64) %6)
          to label %7 unwind label %11

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 288
  store ptr %6, ptr %8, align 8, !tbaa !18
  %9 = tail call noundef zeroext i1 @_ZN4juce15StreamingSocket14createListenerEiRKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(64) %6, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %9, label %10, label %13

10:                                               ; preds = %7
  tail call void @_ZN4juce6Thread11startThreadEv(ptr noundef nonnull align 8 dereferenceable(285) %0)
  br label %13

11:                                               ; preds = %4
  %12 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 64) #5
  resume { ptr, i32 } %12

13:                                               ; preds = %10, %7
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

declare void @_ZN4juce15StreamingSocketC1Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN4juce15StreamingSocket14createListenerEiRKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

declare void @_ZN4juce6Thread11startThreadEv(ptr noundef nonnull align 8 dereferenceable(285)) local_unnamed_addr #2

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { nobuiltin 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 #4 = { builtin allocsize(0) }
attributes #5 = { builtin 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, !10, i64 296}
!6 = !{!"_ZTS17ServerConnections", !7, i64 0, !10, i64 288, !10, i64 296}
!7 = !{!"_ZTSN4juce6ThreadE", !8, i64 8, !10, i64 16, !10, i64 24, !13, i64 32, !14, i64 72, !14, i64 168, !16, i64 264, !17, i64 272, !16, i64 280, !15, i64 284}
!8 = !{!"_ZTSN4juce6StringE", !9, i64 0}
!9 = !{!"_ZTSN4juce16CharPointer_UTF8E", !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSN4juce15CriticalSectionE", !11, i64 0}
!14 = !{!"_ZTSN4juce13WaitableEventE", !11, i64 0, !11, i64 48, !15, i64 88, !15, i64 89}
!15 = !{!"bool", !11, i64 0}
!16 = !{!"int", !11, i64 0}
!17 = !{!"long", !11, i64 0}
!18 = !{!6, !10, i64 288}


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