; LLVM IR from kacperks/Fractal_Engine :: Engine/Thirdparty/cmake/Engine/Thirdparty/cmake/openal-soft/alc (alconfig)

; 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.al::optional.17" = type { %"struct.al::optional_storage.18" }
%"struct.al::optional_storage.18" = type { %"struct.al::optstore_helper.19" }
%"struct.al::optstore_helper.19" = type { %"struct.al::optstore_base.20" }
%"struct.al::optstore_base.20" = type { i8, %union.anon.21 }
%union.anon.21 = type { i8 }
%"struct.al::nullopt_t" = type { i8 }

@.str.17 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1

; 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
declare dso_local noundef ptr @_Z14GetConfigValuePKcS0_S0_S0_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local i16 @_Z15ConfigValueBoolPKcS0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca %"class.al::optional.17", align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.al::nullopt_t", align 1
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = call noundef ptr @_Z14GetConfigValuePKcS0_S0_S0_(ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef @.str.17)
  store ptr %15, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 0
  %18 = load i8, ptr %17, align 1, !tbaa !9
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %21, label %20

20:                                               ; preds = %3
  call void @_ZN2al8optionalIbEC2ENS_9nullopt_tE(ptr noundef nonnull align 1 dereferenceable(2) %4) #6
  store i32 1, ptr %10, align 4
  br label %44

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef %22, ptr noundef @.str.18) #6
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %37, label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef %26, ptr noundef @.str.19) #6
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %37, label %29

29:                                               ; preds = %25
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef %30, ptr noundef @.str.20) #6
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %37, label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = call i32 @atoi(ptr noundef %34) #7
  %36 = icmp ne i32 %35, 0
  br label %37

37:                                               ; preds = %33, %29, %25, %21
  %38 = phi i1 [ true, %29 ], [ true, %25 ], [ true, %21 ], [ %36, %33 ]
  %39 = zext i1 %38 to i8
  store i8 %39, ptr %11, align 1, !tbaa !10
  %40 = call i16 @_ZN2al13make_optionalIbEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 1 dereferenceable(1) %11)
  %41 = getelementptr inbounds %"class.al::optional.17", ptr %4, i32 0, i32 0
  %42 = getelementptr inbounds %"struct.al::optional_storage.18", ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %"struct.al::optstore_helper.19", ptr %42, i32 0, i32 0
  store i16 %40, ptr %43, align 1
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  store i32 1, ptr %10, align 4
  br label %44

44:                                               ; preds = %37, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %45 = getelementptr inbounds %"class.al::optional.17", ptr %4, i32 0, i32 0
  %46 = getelementptr inbounds %"struct.al::optional_storage.18", ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %"struct.al::optstore_helper.19", ptr %46, i32 0, i32 0
  %48 = load i16, ptr %47, align 1
  ret i16 %48
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2al8optionalIbEC2ENS_9nullopt_tE(ptr noundef nonnull align 1 dereferenceable(2)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i16 @_ZN2al13make_optionalIbEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 1 dereferenceable(1)) #4

; Function Attrs: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #5

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 "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 = { 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 #4 = { inlinehint 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 #5 = { inlinehint mustprogress nounwind willreturn memory(read) 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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

%"class.al::optional.17" = type { %"struct.al::optional_storage.18" }
%"struct.al::optional_storage.18" = type { %"struct.al::optstore_helper.19" }
%"struct.al::optstore_helper.19" = type { %"struct.al::optstore_base.20" }
%"struct.al::optstore_base.20" = type { i8, %union.anon.21 }
%union.anon.21 = type { i8 }

@.str.17 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1

; 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
declare dso_local noundef ptr @_Z14GetConfigValuePKcS0_S0_S0_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local i16 @_Z15ConfigValueBoolPKcS0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca %"class.al::optional.17", align 2
  %5 = alloca i8, align 1
  %6 = tail call noundef ptr @_Z14GetConfigValuePKcS0_S0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull @.str.17)
  %7 = load i8, ptr %6, align 1, !tbaa !5
  %.not = icmp eq i8 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %3
  call void @_ZN2al8optionalIbEC2ENS_9nullopt_tE(ptr noundef nonnull align 1 dereferenceable(2) %4) #6
  %.pre = load i16, ptr %4, align 2
  br label %25

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  %10 = tail call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef nonnull %6, ptr noundef nonnull @.str.18) #6
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %22, label %12

12:                                               ; preds = %9
  %13 = tail call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef nonnull %6, ptr noundef nonnull @.str.19) #6
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %22, label %15

15:                                               ; preds = %12
  %16 = tail call noundef i32 @_ZN2al10strcasecmpEPKcS1_(ptr noundef nonnull %6, ptr noundef nonnull @.str.20) #6
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %22, label %18

18:                                               ; preds = %15
  %19 = tail call i32 @atoi(ptr nocapture noundef %6) #7
  %20 = icmp ne i32 %19, 0
  %21 = zext i1 %20 to i8
  br label %22

22:                                               ; preds = %18, %15, %12, %9
  %23 = phi i8 [ 1, %15 ], [ 1, %12 ], [ 1, %9 ], [ %21, %18 ]
  store i8 %23, ptr %5, align 1, !tbaa !8
  %24 = call i16 @_ZN2al13make_optionalIbEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  br label %25

25:                                               ; preds = %22, %8
  %26 = phi i16 [ %24, %22 ], [ %.pre, %8 ]
  ret i16 %26
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2al8optionalIbEC2ENS_9nullopt_tE(ptr noundef nonnull align 1 dereferenceable(2)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i16 @_ZN2al13make_optionalIbEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #5

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 "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 = { 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 #4 = { inlinehint 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 #5 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"bool", !6, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass