; 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.2" = type { %"struct.al::optional_storage.3" }
%"struct.al::optional_storage.3" = type { %"struct.al::optstore_helper.4" }
%"struct.al::optstore_helper.4" = type { %"struct.al::optstore_base.5" }
%"struct.al::optstore_base.5" = type { i8, %union.anon.6 }
%union.anon.6 = type { i32 }
%"struct.al::nullopt_t" = type { i8 }

@.str.17 = external hidden unnamed_addr constant [1 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: mustprogress uwtable
define dso_local i64 @_Z14ConfigValueIntPKcS0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca %"class.al::optional.2", align 4
  %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 i32, align 4
  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) #5
  %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 @_ZN2al8optionalIiEC2ENS_9nullopt_tE(ptr noundef nonnull align 4 dereferenceable(8) %4) #5
  store i32 1, ptr %10, align 4
  br label %29

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = call i64 @strtol(ptr noundef %22, ptr noundef null, i32 noundef 0) #5
  %24 = trunc i64 %23 to i32
  store i32 %24, ptr %11, align 4, !tbaa !10
  %25 = call i64 @_ZN2al13make_optionalIiEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 4 dereferenceable(4) %11)
  %26 = getelementptr inbounds %"class.al::optional.2", ptr %4, i32 0, i32 0
  %27 = getelementptr inbounds %"struct.al::optional_storage.3", ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %"struct.al::optstore_helper.4", ptr %27, i32 0, i32 0
  store i64 %25, ptr %28, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  store i32 1, ptr %10, align 4
  br label %29

29:                                               ; preds = %21, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %30 = getelementptr inbounds %"class.al::optional.2", ptr %4, i32 0, i32 0
  %31 = getelementptr inbounds %"struct.al::optional_storage.3", ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %"struct.al::optstore_helper.4", ptr %31, i32 0, i32 0
  %33 = load i64, ptr %32, align 4
  ret i64 %33
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2al8optionalIiEC2ENS_9nullopt_tE(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN2al13make_optionalIiEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #4

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 = { 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 #3 = { 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 #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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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.2" = type { %"struct.al::optional_storage.3" }
%"struct.al::optional_storage.3" = type { %"struct.al::optstore_helper.4" }
%"struct.al::optstore_helper.4" = type { %"struct.al::optstore_base.5" }
%"struct.al::optstore_base.5" = type { i8, %union.anon.6 }
%union.anon.6 = type { i32 }

@.str.17 = external hidden unnamed_addr constant [1 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: mustprogress uwtable
define dso_local i64 @_Z14ConfigValueIntPKcS0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca %"class.al::optional.2", align 8
  %5 = alloca i32, align 4
  %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 @_ZN2al8optionalIiEC2ENS_9nullopt_tE(ptr noundef nonnull align 4 dereferenceable(8) %4) #5
  %.pre = load i64, ptr %4, align 8
  br label %13

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %10 = tail call i64 @strtol(ptr nocapture noundef nonnull %6, ptr noundef null, i32 noundef 0) #5
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr %5, align 4, !tbaa !8
  %12 = call i64 @_ZN2al13make_optionalIiEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %13

13:                                               ; preds = %9, %8
  %14 = phi i64 [ %12, %9 ], [ %.pre, %8 ]
  ret i64 %14
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2al8optionalIiEC2ENS_9nullopt_tE(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN2al13make_optionalIiEENS_8optionalINSt5decayIT_E4typeEEEOS3_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

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 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}


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