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

; 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::CCustomerTable" = type { %"class.TPCE::TableTemplate", i64, %"class.TPCE::CPerson", ptr, i64, i64, i64, i32, ptr, %"class.TPCE::CCustomerSelection" }
%"class.TPCE::TableTemplate" = type { ptr, %"struct.TPCE::CUSTOMER_ROW", i64, i8, %"class.TPCE::CRandom" }
%"struct.TPCE::CUSTOMER_ROW" = type <{ i64, [21 x i8], [5 x i8], [26 x i8], [21 x i8], [2 x i8], i8, i8, [3 x i8], %"class.TPCE::CDateTime", i64, [4 x i8], [4 x i8], [11 x i8], [6 x i8], [4 x i8], [4 x i8], [11 x i8], [6 x i8], [4 x i8], [4 x i8], [11 x i8], [6 x i8], [51 x i8], [51 x i8], [7 x i8] }>
%"class.TPCE::CDateTime" = type { i32, i32, ptr }
%"class.TPCE::CRandom" = type { i64 }
%"class.TPCE::CPerson" = type { ptr, ptr, ptr, %"class.TPCE::CRandom", i8, i32, i64, ptr, ptr }
%"class.TPCE::CCustomerSelection" = type { ptr, i64, i64, i8, i32, i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4TPCE14CCustomerTable18GeneratePersonInfoEv(ptr noundef nonnull align 8 dereferenceable(496) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.TPCE::CCustomerTable", ptr %3, i32 0, i32 2
  %5 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %6 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %5, i32 0, i32 0
  %7 = load i64, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %9 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %8, i32 0, i32 4
  %10 = getelementptr inbounds [21 x i8], ptr %9, i64 0, i64 0
  %11 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %12 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %11, i32 0, i32 3
  %13 = getelementptr inbounds [26 x i8], ptr %12, i64 0, i64 0
  %14 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %15 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %14, i32 0, i32 1
  %16 = getelementptr inbounds [21 x i8], ptr %15, i64 0, i64 0
  call void @_ZN4TPCE7CPerson20GetFirstLastAndTaxIDExPcS1_S1_(ptr noundef nonnull align 8 dereferenceable(64) %4, i64 noundef %7, ptr noundef %10, ptr noundef %13, ptr noundef %16)
  %17 = getelementptr inbounds %"class.TPCE::CCustomerTable", ptr %3, i32 0, i32 2
  %18 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %19 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %18, i32 0, i32 0
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = call noundef signext i8 @_ZN4TPCE7CPerson9GetGenderEx(ptr noundef nonnull align 8 dereferenceable(64) %17, i64 noundef %20)
  %22 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %23 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %22, i32 0, i32 6
  store i8 %21, ptr %23, align 1, !tbaa !17
  %24 = getelementptr inbounds %"class.TPCE::CCustomerTable", ptr %3, i32 0, i32 2
  %25 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %26 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %25, i32 0, i32 0
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = call noundef signext i8 @_ZN4TPCE7CPerson13GetMiddleNameEx(ptr noundef nonnull align 8 dereferenceable(64) %24, i64 noundef %27)
  %29 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %30 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %29, i32 0, i32 5
  %31 = getelementptr inbounds [2 x i8], ptr %30, i64 0, i64 0
  store i8 %28, ptr %31, align 1, !tbaa !18
  %32 = getelementptr inbounds %"class.TPCE::TableTemplate", ptr %3, i32 0, i32 1
  %33 = getelementptr inbounds %"struct.TPCE::CUSTOMER_ROW", ptr %32, i32 0, i32 5
  %34 = getelementptr inbounds [2 x i8], ptr %33, i64 0, i64 1
  store i8 0, ptr %34, align 1, !tbaa !18
  ret void
}

declare void @_ZN4TPCE7CPerson20GetFirstLastAndTaxIDExPcS1_S1_(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare noundef signext i8 @_ZN4TPCE7CPerson9GetGenderEx(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) #1

declare noundef signext i8 @_ZN4TPCE7CPerson13GetMiddleNameEx(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) #1

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 = { "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" }

!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 8}
!10 = !{!"_ZTSN4TPCE13TableTemplateINS_12CUSTOMER_ROWEEE", !11, i64 8, !12, i64 304, !15, i64 312, !16, i64 320}
!11 = !{!"_ZTSN4TPCE12CUSTOMER_ROWE", !12, i64 0, !7, i64 8, !7, i64 29, !7, i64 34, !7, i64 60, !7, i64 81, !7, i64 83, !7, i64 84, !13, i64 88, !12, i64 104, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 131, !7, i64 137, !7, i64 141, !7, i64 145, !7, i64 156, !7, i64 162, !7, i64 166, !7, i64 170, !7, i64 181, !7, i64 187, !7, i64 238}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"_ZTSN4TPCE9CDateTimeE", !14, i64 0, !14, i64 4, !6, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN4TPCE7CRandomE", !12, i64 0}
!17 = !{!10, !7, i64 91}
!18 = !{!7, !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 uwtable
define dso_local void @_ZN4TPCE14CCustomerTable18GeneratePersonInfoEv(ptr noundef nonnull align 8 dereferenceable(496) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 336
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 68
  %6 = getelementptr inbounds i8, ptr %0, i64 42
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN4TPCE7CPerson20GetFirstLastAndTaxIDExPcS1_S1_(ptr noundef nonnull align 8 dereferenceable(64) %2, i64 noundef %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %8 = load i64, ptr %3, align 8, !tbaa !5
  %9 = tail call noundef signext i8 @_ZN4TPCE7CPerson9GetGenderEx(ptr noundef nonnull align 8 dereferenceable(64) %2, i64 noundef %8)
  %10 = getelementptr inbounds i8, ptr %0, i64 91
  store i8 %9, ptr %10, align 1, !tbaa !16
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = tail call noundef signext i8 @_ZN4TPCE7CPerson13GetMiddleNameEx(ptr noundef nonnull align 8 dereferenceable(64) %2, i64 noundef %11)
  %13 = getelementptr inbounds i8, ptr %0, i64 89
  store i8 %12, ptr %13, align 1, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %0, i64 90
  store i8 0, ptr %14, align 2, !tbaa !17
  ret void
}

declare void @_ZN4TPCE7CPerson20GetFirstLastAndTaxIDExPcS1_S1_(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef signext i8 @_ZN4TPCE7CPerson9GetGenderEx(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) local_unnamed_addr #1

declare noundef signext i8 @_ZN4TPCE7CPerson13GetMiddleNameEx(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) local_unnamed_addr #1

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 = { "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" }

!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 8}
!6 = !{!"_ZTSN4TPCE13TableTemplateINS_12CUSTOMER_ROWEEE", !7, i64 8, !8, i64 304, !14, i64 312, !15, i64 320}
!7 = !{!"_ZTSN4TPCE12CUSTOMER_ROWE", !8, i64 0, !9, i64 8, !9, i64 29, !9, i64 34, !9, i64 60, !9, i64 81, !9, i64 83, !9, i64 84, !11, i64 88, !8, i64 104, !9, i64 112, !9, i64 116, !9, i64 120, !9, i64 131, !9, i64 137, !9, i64 141, !9, i64 145, !9, i64 156, !9, i64 162, !9, i64 166, !9, i64 170, !9, i64 181, !9, i64 187, !9, i64 238}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN4TPCE9CDateTimeE", !12, i64 0, !12, i64 4, !13, i64 8}
!12 = !{!"int", !9, i64 0}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"bool", !9, i64 0}
!15 = !{!"_ZTSN4TPCE7CRandomE", !8, i64 0}
!16 = !{!6, !9, i64 91}
!17 = !{!9, !9, i64 0}


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