; LLVM IR from GPUOpen-LibrariesAndSDKs/TAN :: tan/tanlibrary/src/clFFT-master/src/library (fft_binary_lookup)

; 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.FFTBinaryLookup = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"struct.FFTBinaryLookup::Header_", ptr, ptr, ptr, %"class.std::__cxx11::basic_string", ptr, ptr, %"class.std::vector", i8, [7 x i8] }>
%"struct.FFTBinaryLookup::Header_" = type { [4 x i8], i64, i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<FFTBinaryLookup::Variant, std::allocator<FFTBinaryLookup::Variant>>::_Vector_impl" }
%"struct.std::_Vector_base<FFTBinaryLookup::Variant, std::allocator<FFTBinaryLookup::Variant>>::_Vector_impl" = type { %"struct.std::_Vector_base<FFTBinaryLookup::Variant, std::allocator<FFTBinaryLookup::Variant>>::_Vector_impl_data" }
%"struct.std::_Vector_base<FFTBinaryLookup::Variant, std::allocator<FFTBinaryLookup::Variant>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 i32 @_ZN15FFTBinaryLookup13populateCacheEv(ptr noundef nonnull align 8 dereferenceable(201)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN15FFTBinaryLookup15buildFromSourceEPKc(ptr noundef nonnull align 8 dereferenceable(201) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %class.FFTBinaryLookup, ptr %8, i32 0, i32 3
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds %class.FFTBinaryLookup, ptr %8, i32 0, i32 4
  %13 = load ptr, ptr %12, align 8, !tbaa !20
  %14 = call noundef ptr @_ZN15FFTBinaryLookup22buildProgramFromSourceEPKcP11_cl_contextP13_cl_device_idRiS1_(ptr noundef %9, ptr noundef %11, ptr noundef %13, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef null)
  %15 = getelementptr inbounds %class.FFTBinaryLookup, ptr %8, i32 0, i32 5
  store ptr %14, ptr %15, align 8, !tbaa !21
  %16 = load i32, ptr %6, align 4, !tbaa !22
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %2
  %19 = load i32, ptr %6, align 4, !tbaa !22
  store i32 %19, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %22

20:                                               ; preds = %2
  %21 = call noundef i32 @_ZN15FFTBinaryLookup13populateCacheEv(ptr noundef nonnull align 8 dereferenceable(201) %8)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %22

22:                                               ; preds = %20, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %23 = load i32, ptr %3, align 4
  ret i32 %23
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN15FFTBinaryLookup22buildProgramFromSourceEPKcP11_cl_contextP13_cl_device_idRiS1_(ptr noundef, ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) #1 align 2

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 }

!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, !6, i64 104}
!10 = !{!"_ZTS15FFTBinaryLookup", !11, i64 0, !11, i64 32, !14, i64 64, !6, i64 104, !6, i64 112, !6, i64 120, !11, i64 128, !6, i64 160, !6, i64 168, !15, i64 176, !19, i64 200}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN15FFTBinaryLookup7Header_E", !7, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!15 = !{!"_ZTSSt6vectorIN15FFTBinaryLookup7VariantESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"bool", !7, i64 0}
!20 = !{!10, !6, i64 112}
!21 = !{!10, !6, i64 120}
!22 = !{!23, !23, i64 0}
!23 = !{!"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"

; 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 i32 @_ZN15FFTBinaryLookup13populateCacheEv(ptr noundef nonnull align 8 dereferenceable(201)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN15FFTBinaryLookup15buildFromSourceEPKc(ptr noundef nonnull align 8 dereferenceable(201) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 112
  %7 = load ptr, ptr %6, align 8, !tbaa !19
  %8 = call noundef ptr @_ZN15FFTBinaryLookup22buildProgramFromSourceEPKcP11_cl_contextP13_cl_device_idRiS1_(ptr noundef %1, ptr noundef %5, ptr noundef %7, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef null)
  %9 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %8, ptr %9, align 8, !tbaa !20
  %10 = load i32, ptr %3, align 4, !tbaa !21
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %11, label %13

11:                                               ; preds = %2
  %12 = call noundef i32 @_ZN15FFTBinaryLookup13populateCacheEv(ptr noundef nonnull align 8 dereferenceable(201) %0)
  br label %13

13:                                               ; preds = %2, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #2
  ret i32 %10
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN15FFTBinaryLookup22buildProgramFromSourceEPKcP11_cl_contextP13_cl_device_idRiS1_(ptr noundef, ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) local_unnamed_addr #1 align 2

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 }

!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, !9, i64 104}
!6 = !{!"_ZTS15FFTBinaryLookup", !7, i64 0, !7, i64 32, !13, i64 64, !9, i64 104, !9, i64 112, !9, i64 120, !7, i64 128, !9, i64 160, !9, i64 168, !14, i64 176, !18, i64 200}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"_ZTSN15FFTBinaryLookup7Header_E", !10, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!14 = !{!"_ZTSSt6vectorIN15FFTBinaryLookup7VariantESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN15FFTBinaryLookup7VariantESaIS1_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!18 = !{!"bool", !10, i64 0}
!19 = !{!6, !9, i64 112}
!20 = !{!6, !9, i64 120}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !10, i64 0}


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