; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/EGenGenerateAndLoad.ll (ZN4TPCE16CGenerateAndLoad10InitChargeEv)

; 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.TPCE::CGenerateAndLoad" = type { %"class.TPCE::CInputFiles", i64, i64, i64, i32, i32, i32, ptr, ptr, [512 x i8], ptr, %"class.TPCE::CLoaderSettings", i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.TPCE::CInputFiles" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.TPCE::CLoaderSettings" = type { %"class.TPCE::CParametersWithDefaults" }
%"class.TPCE::CParametersWithDefaults" = type { ptr, %"struct.TPCE::TLoaderSettings", %"struct.TPCE::TLoaderSettingsState", %"struct.TPCE::TLoaderSettings" }
%"struct.TPCE::TLoaderSettingsState" = type { i8, i8, i8, i8, i8, i8 }
%"struct.TPCE::TLoaderSettings" = type { i64, i64, i32, i32, i64, i64 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE12CChargeTableC2EPc(ptr noundef nonnull align 8 dereferenceable(576), ptr noundef) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4TPCE16CGenerateAndLoad10InitChargeEv(ptr noundef nonnull align 8 dereferenceable(1040) %0) #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 576) #3
  %7 = getelementptr inbounds %"class.TPCE::CGenerateAndLoad", ptr %5, i32 0, i32 9
  %8 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  invoke void @_ZN4TPCE12CChargeTableC2EPc(ptr noundef nonnull align 8 dereferenceable(576) %6, ptr noundef %8)
          to label %9 unwind label %11

9:                                                ; preds = %1
  %10 = getelementptr inbounds %"class.TPCE::CGenerateAndLoad", ptr %5, i32 0, i32 14
  store ptr %6, ptr %10, align 8, !tbaa !9
  ret void

11:                                               ; preds = %1
  %12 = landingpad { ptr, i32 }
          cleanup
  %13 = extractvalue { ptr, i32 } %12, 0
  store ptr %13, ptr %3, align 8
  %14 = extractvalue { ptr, i32 } %12, 1
  store i32 %14, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %6, i64 noundef 576) #4
  br label %15

15:                                               ; preds = %11
  %16 = load ptr, ptr %3, align 8
  %17 = load i32, ptr %4, align 4
  %18 = insertvalue { ptr, i32 } poison, ptr %16, 0
  %19 = insertvalue { ptr, i32 } %18, i32 %17, 1
  resume { ptr, i32 } %19
}

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 = { 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 #3 = { builtin allocsize(0) }
attributes #4 = { 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, !6, i64 872}
!10 = !{!"_ZTSN4TPCE16CGenerateAndLoadE", !11, i64 0, !12, i64 184, !12, i64 192, !12, i64 200, !13, i64 208, !13, i64 212, !13, i64 216, !6, i64 224, !6, i64 232, !7, i64 240, !6, i64 752, !14, i64 760, !18, i64 856, !6, i64 864, !6, i64 872, !6, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !6, i64 984, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032}
!11 = !{!"_ZTSN4TPCE11CInputFilesE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN4TPCE15CLoaderSettingsE", !15, i64 0}
!15 = !{!"_ZTSN4TPCE23CParametersWithDefaultsINS_15TLoaderSettingsENS_20TLoaderSettingsStateEEE", !16, i64 8, !17, i64 48, !16, i64 56}
!16 = !{!"_ZTSN4TPCE15TLoaderSettingsE", !12, i64 0, !12, i64 8, !13, i64 16, !13, i64 20, !12, i64 24, !12, i64 32}
!17 = !{!"_ZTSN4TPCE20TLoaderSettingsStateE", !18, i64 0, !18, i64 1, !18, i64 2, !18, i64 3, !18, i64 4, !18, i64 5}
!18 = !{!"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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE12CChargeTableC2EPc(ptr noundef nonnull align 8 dereferenceable(576), ptr noundef) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4TPCE16CGenerateAndLoad10InitChargeEv(ptr noundef nonnull align 8 dereferenceable(1040) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noalias noundef nonnull dereferenceable(576) ptr @_Znwm(i64 noundef 576) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 240
  invoke void @_ZN4TPCE12CChargeTableC2EPc(ptr noundef nonnull align 8 dereferenceable(576) %2, ptr noundef nonnull %3)
          to label %4 unwind label %6

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 872
  store ptr %2, ptr %5, align 8, !tbaa !5
  ret void

6:                                                ; preds = %1
  %7 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %2, i64 noundef 576) #4
  resume { ptr, i32 } %7
}

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 = { 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 #3 = { builtin allocsize(0) }
attributes #4 = { 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, !8, i64 872}
!6 = !{!"_ZTSN4TPCE16CGenerateAndLoadE", !7, i64 0, !11, i64 184, !11, i64 192, !11, i64 200, !12, i64 208, !12, i64 212, !12, i64 216, !8, i64 224, !8, i64 232, !9, i64 240, !8, i64 752, !13, i64 760, !17, i64 856, !8, i64 864, !8, i64 872, !8, i64 880, !8, i64 888, !8, i64 896, !8, i64 904, !8, i64 912, !8, i64 920, !8, i64 928, !8, i64 936, !8, i64 944, !8, i64 952, !8, i64 960, !8, i64 968, !8, i64 976, !8, i64 984, !8, i64 992, !8, i64 1000, !8, i64 1008, !8, i64 1016, !8, i64 1024, !8, i64 1032}
!7 = !{!"_ZTSN4TPCE11CInputFilesE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !8, i64 160, !8, i64 168, !8, i64 176}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long long", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"_ZTSN4TPCE15CLoaderSettingsE", !14, i64 0}
!14 = !{!"_ZTSN4TPCE23CParametersWithDefaultsINS_15TLoaderSettingsENS_20TLoaderSettingsStateEEE", !15, i64 8, !16, i64 48, !15, i64 56}
!15 = !{!"_ZTSN4TPCE15TLoaderSettingsE", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 20, !11, i64 24, !11, i64 32}
!16 = !{!"_ZTSN4TPCE20TLoaderSettingsStateE", !17, i64 0, !17, i64 1, !17, i64 2, !17, i64 3, !17, i64 4, !17, i64 5}
!17 = !{!"bool", !9, i64 0}


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