; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/audiosource/speech (soloud_speech)

; 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.darray = type <{ ptr, i32, i32, i32, [4 x i8] }>
%"class.SoLoud::Speech" = type { %"class.SoLoud::AudioSource", i32, float, float, i32, i32, [4 x i8], %class.darray }
%"class.SoLoud::AudioSource" = type { ptr, i32, float, float, i32, i32, float, float, float, i32, float, [8 x ptr], ptr, ptr, ptr, i32, double }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6darray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(20)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6darray7getDataEv(ptr noundef nonnull align 8 dereferenceable(20)) #0 align 2

; 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 noundef i32 @_ZN6SoLoud6Speech7setTextEPKc(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %class.darray, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  store i32 1, ptr %3, align 4
  br label %30

13:                                               ; preds = %2
  call void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152) %9)
  %14 = getelementptr inbounds %"class.SoLoud::Speech", ptr %9, i32 0, i32 7
  call void @_ZN6darray5clearEv(ptr noundef nonnull align 8 dereferenceable(20) %14)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #5
  call void @_ZN6darrayC1Ev(ptr noundef nonnull align 8 dereferenceable(20) %6)
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = invoke noundef i32 @_Z12xlate_stringPKcP6darray(ptr noundef %15, ptr noundef %6)
          to label %17 unwind label %26

17:                                               ; preds = %13
  %18 = invoke noundef ptr @_ZN6darray7getDataEv(ptr noundef nonnull align 8 dereferenceable(20) %6)
          to label %19 unwind label %26

19:                                               ; preds = %17
  %20 = invoke noundef i32 @_ZNK6darray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(20) %6)
          to label %21 unwind label %26

21:                                               ; preds = %19
  %22 = getelementptr inbounds %"class.SoLoud::Speech", ptr %9, i32 0, i32 7
  %23 = invoke noundef i32 @_ZN5klatt12phone_to_elmEPciP6darray(ptr noundef %18, i32 noundef %20, ptr noundef %22)
          to label %24 unwind label %26

24:                                               ; preds = %21
  %25 = getelementptr inbounds %"class.SoLoud::Speech", ptr %9, i32 0, i32 5
  store i32 %23, ptr %25, align 8, !tbaa !9
  store i32 0, ptr %3, align 4
  call void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  br label %30

26:                                               ; preds = %21, %19, %17, %13
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %7, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %8, align 4
  call void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  br label %32

30:                                               ; preds = %24, %12
  %31 = load i32, ptr %3, align 4
  ret i32 %31

32:                                               ; preds = %26
  %33 = load ptr, ptr %7, align 8
  %34 = load i32, ptr %8, align 4
  %35 = insertvalue { ptr, i32 } poison, ptr %33, 0
  %36 = insertvalue { ptr, i32 } %35, i32 %34, 1
  resume { ptr, i32 } %36
}

declare void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152)) #3

declare void @_ZN6darray5clearEv(ptr noundef nonnull align 8 dereferenceable(20)) #3

declare void @_ZN6darrayC1Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #3

declare noundef i32 @_Z12xlate_stringPKcP6darray(ptr noundef, ptr noundef) #3

declare noundef i32 @_ZN5klatt12phone_to_elmEPciP6darray(ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind
declare void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #4

attributes #0 = { 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 #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 "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 #5 = { 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, !12, i64 168}
!10 = !{!"_ZTSN6SoLoud6SpeechE", !11, i64 0, !12, i64 152, !13, i64 156, !13, i64 160, !12, i64 164, !12, i64 168, !15, i64 176}
!11 = !{!"_ZTSN6SoLoud11AudioSourceE", !12, i64 8, !13, i64 12, !13, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !12, i64 40, !13, i64 44, !7, i64 48, !6, i64 112, !6, i64 120, !6, i64 128, !12, i64 136, !14, i64 144}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS6darray", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}


; 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.darray = type <{ ptr, i32, i32, i32, [4 x i8] }>

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6darray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6darray7getDataEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress 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 noundef range(i32 0, 2) i32 @_ZN6SoLoud6Speech7setTextEPKc(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.darray, align 8
  %4 = icmp eq ptr %1, null
  br i1 %4, label %16, label %5

5:                                                ; preds = %2
  tail call void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152) %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN6darray5clearEv(ptr noundef nonnull align 8 dereferenceable(20) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  call void @_ZN6darrayC1Ev(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %7 = invoke noundef i32 @_Z12xlate_stringPKcP6darray(ptr noundef nonnull %1, ptr noundef nonnull %3)
          to label %8 unwind label %14

8:                                                ; preds = %5
  %9 = call noundef ptr @_ZN6darray7getDataEv(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %10 = call noundef i32 @_ZNK6darray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(20) %3)
  %11 = invoke noundef i32 @_ZN5klatt12phone_to_elmEPciP6darray(ptr noundef %9, i32 noundef %10, ptr noundef nonnull %6)
          to label %12 unwind label %14

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 168
  store i32 %11, ptr %13, align 8, !tbaa !5
  call void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  br label %16

14:                                               ; preds = %8, %5
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  resume { ptr, i32 } %15

16:                                               ; preds = %2, %12
  %.0 = phi i32 [ 0, %12 ], [ 1, %2 ]
  ret i32 %.0
}

declare void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152)) local_unnamed_addr #3

declare void @_ZN6darray5clearEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #3

declare void @_ZN6darrayC1Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #3

declare noundef i32 @_Z12xlate_stringPKcP6darray(ptr noundef, ptr noundef) local_unnamed_addr #3

declare noundef i32 @_ZN5klatt12phone_to_elmEPciP6darray(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN6darrayD1Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress 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 "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 #5 = { 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, !8, i64 168}
!6 = !{!"_ZTSN6SoLoud6SpeechE", !7, i64 0, !8, i64 152, !11, i64 156, !11, i64 160, !8, i64 164, !8, i64 168, !14, i64 176}
!7 = !{!"_ZTSN6SoLoud11AudioSourceE", !8, i64 8, !11, i64 12, !11, i64 16, !8, i64 20, !8, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !8, i64 40, !11, i64 44, !9, i64 48, !12, i64 112, !12, i64 120, !12, i64 128, !8, i64 136, !13, i64 144}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"float", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"double", !9, i64 0}
!14 = !{!"_ZTS6darray", !12, i64 0, !8, i64 8, !8, i64 12, !8, i64 16}


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