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

; 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::CPerson" = type { ptr, ptr, ptr, %"class.TPCE::CRandom", i8, i32, i64, ptr, ptr }
%"class.TPCE::CRandom" = type { i64 }
%"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 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4TPCE7CPersonC2ENS_11CInputFilesExb(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef %1, i64 noundef %2, i1 noundef zeroext %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %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 i64 %2, ptr %7, align 8, !tbaa !9
  %12 = zext i1 %3 to i8
  store i8 %12, ptr %8, align 1, !tbaa !11
  %13 = load ptr, ptr %5, align 8
  %14 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %"class.TPCE::CInputFiles", ptr %1, i32 0, i32 9
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  store ptr %16, ptr %14, align 8, !tbaa !15
  %17 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 1
  %18 = getelementptr inbounds %"class.TPCE::CInputFiles", ptr %1, i32 0, i32 10
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  store ptr %19, ptr %17, align 8, !tbaa !20
  %20 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 2
  %21 = getelementptr inbounds %"class.TPCE::CInputFiles", ptr %1, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  store ptr %22, ptr %20, align 8, !tbaa !22
  %23 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 3
  call void @_ZN4TPCE7CRandomC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %23)
  %24 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 4
  %25 = load i8, ptr %8, align 1, !tbaa !11, !range !23, !noundef !24
  %26 = trunc i8 %25 to i1
  %27 = zext i1 %26 to i8
  store i8 %27, ptr %24, align 8, !tbaa !25
  %28 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 4
  %29 = load i8, ptr %28, align 8, !tbaa !25, !range !23, !noundef !24
  %30 = trunc i8 %29 to i1
  br i1 %30, label %31, label %81

31:                                               ; preds = %4
  %32 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 5
  store i32 1000, ptr %32, align 4, !tbaa !26
  %33 = load i64, ptr %7, align 8, !tbaa !9
  %34 = add nsw i64 4300000000, %33
  %35 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 6
  store i64 %34, ptr %35, align 8, !tbaa !27
  %36 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 5
  %37 = load i32, ptr %36, align 4, !tbaa !26
  %38 = sext i32 %37 to i64
  %39 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %38, i64 8)
  %40 = extractvalue { i64, i1 } %39, 1
  %41 = extractvalue { i64, i1 } %39, 0
  %42 = select i1 %40, i64 -1, i64 %41
  %43 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %42) #6
          to label %44 unwind label %62

44:                                               ; preds = %31
  %45 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 8
  store ptr %43, ptr %45, align 8, !tbaa !28
  %46 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 5
  %47 = load i32, ptr %46, align 4, !tbaa !26
  %48 = sext i32 %47 to i64
  %49 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %48, i64 8)
  %50 = extractvalue { i64, i1 } %49, 1
  %51 = extractvalue { i64, i1 } %49, 0
  %52 = select i1 %50, i64 -1, i64 %51
  %53 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %52) #6
          to label %54 unwind label %62

54:                                               ; preds = %44
  %55 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 7
  store ptr %53, ptr %55, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !30
  br label %56

56:                                               ; preds = %77, %54
  %57 = load i32, ptr %11, align 4, !tbaa !30
  %58 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 5
  %59 = load i32, ptr %58, align 4, !tbaa !26
  %60 = icmp slt i32 %57, %59
  br i1 %60, label %66, label %61

61:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %80

62:                                               ; preds = %44, %31
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %9, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %10, align 4
  call void @_ZN4TPCE7CRandomD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  br label %82

66:                                               ; preds = %56
  %67 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 8
  %68 = load ptr, ptr %67, align 8, !tbaa !28
  %69 = load i32, ptr %11, align 4, !tbaa !30
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %68, i64 %70
  store ptr null, ptr %71, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.TPCE::CPerson", ptr %13, i32 0, i32 7
  %73 = load ptr, ptr %72, align 8, !tbaa !29
  %74 = load i32, ptr %11, align 4, !tbaa !30
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds ptr, ptr %73, i64 %75
  store ptr null, ptr %76, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %66
  %78 = load i32, ptr %11, align 4, !tbaa !30
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %11, align 4, !tbaa !30
  br label %56, !llvm.loop !31

80:                                               ; preds = %61
  br label %81

81:                                               ; preds = %80, %4
  ret void

82:                                               ; preds = %62
  %83 = load ptr, ptr %9, align 8
  %84 = load i32, ptr %10, align 4
  %85 = insertvalue { ptr, i32 } poison, ptr %83, 0
  %86 = insertvalue { ptr, i32 } %85, i32 %84, 1
  resume { ptr, i32 } %86
}

declare void @_ZN4TPCE7CRandomC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

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

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" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { builtin allocsize(0) }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 72}
!14 = !{!"_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}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSN4TPCE7CPersonE", !6, i64 0, !6, i64 8, !6, i64 16, !17, i64 24, !12, i64 32, !18, i64 36, !10, i64 40, !6, i64 48, !6, i64 56}
!17 = !{!"_ZTSN4TPCE7CRandomE", !10, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!14, !6, i64 80}
!20 = !{!16, !6, i64 8}
!21 = !{!14, !6, i64 56}
!22 = !{!16, !6, i64 16}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!16, !12, i64 32}
!26 = !{!16, !18, i64 36}
!27 = !{!16, !10, i64 40}
!28 = !{!16, !6, i64 56}
!29 = !{!16, !6, i64 48}
!30 = !{!18, !18, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; 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 @_ZN4TPCE7CPersonC2ENS_11CInputFilesExb(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr nocapture noundef readonly %1, i64 noundef %2, i1 noundef zeroext %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = zext i1 %3 to i8
  %6 = getelementptr inbounds i8, ptr %1, i64 72
  %7 = load <2 x ptr>, ptr %6, align 8, !tbaa !5
  store <2 x ptr> %7, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = getelementptr inbounds i8, ptr %1, i64 56
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %10, ptr %8, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN4TPCE7CRandomC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  store i8 %5, ptr %12, align 8, !tbaa !17
  br i1 %3, label %13, label %.loopexit

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 1000, ptr %14, align 4, !tbaa !18
  %15 = add nsw i64 %2, 4300000000
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %15, ptr %16, align 8, !tbaa !19
  %17 = invoke noalias noundef nonnull dereferenceable(8000) ptr @_Znam(i64 noundef 8000) #4
          to label %18 unwind label %23

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %17, ptr %19, align 8, !tbaa !20
  %20 = invoke noalias noundef nonnull dereferenceable(8000) ptr @_Znam(i64 noundef 8000) #4
          to label %21 unwind label %23

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %20, ptr %22, align 8, !tbaa !21
  br label %25

23:                                               ; preds = %18, %13
  %24 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4TPCE7CRandomD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  resume { ptr, i32 } %24

25:                                               ; preds = %25, %21
  %indvars.iv = phi i64 [ 0, %21 ], [ %indvars.iv.next.1, %25 ]
  %26 = load ptr, ptr %19, align 8, !tbaa !20
  %27 = getelementptr inbounds ptr, ptr %26, i64 %indvars.iv
  store ptr null, ptr %27, align 8, !tbaa !5
  %28 = load ptr, ptr %22, align 8, !tbaa !21
  %29 = getelementptr inbounds ptr, ptr %28, i64 %indvars.iv
  store ptr null, ptr %29, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %30 = load ptr, ptr %19, align 8, !tbaa !20
  %31 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv.next
  store ptr null, ptr %31, align 8, !tbaa !5
  %32 = load ptr, ptr %22, align 8, !tbaa !21
  %33 = getelementptr inbounds ptr, ptr %32, i64 %indvars.iv.next
  store ptr null, ptr %33, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 1000
  br i1 %exitcond.not.1, label %.loopexit, label %25, !llvm.loop !22

.loopexit:                                        ; preds = %25, %4
  ret void
}

declare void @_ZN4TPCE7CRandomC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

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" }
attributes #2 = { 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 #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 = { builtin allocsize(0) }
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 = !{!10, !6, i64 56}
!10 = !{!"_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}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSN4TPCE7CPersonE", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !15, i64 32, !16, i64 36, !14, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!"_ZTSN4TPCE7CRandomE", !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!12, !15, i64 32}
!18 = !{!12, !16, i64 36}
!19 = !{!12, !14, i64 40}
!20 = !{!12, !6, i64 56}
!21 = !{!12, !6, i64 48}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass