; LLVM IR from dynexcoin/Dynex :: src/DynexCNCore/Account.ll (ZN7DynexCN11AccountBase12generate_keyERKN6Crypto9SecretKeyEbb)

; 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"

%"struct.Crypto::SecretKey" = type { [32 x i8] }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }
%"class.DynexCN::AccountBase" = type { %"struct.DynexCN::AccountKeys", i64 }
%"struct.DynexCN::AccountKeys" = type { %"struct.DynexCN::AccountPublicAddress", %"struct.Crypto::SecretKey", %"struct.Crypto::SecretKey" }
%"struct.DynexCN::AccountPublicAddress" = type { %"struct.Crypto::PublicKey", %"struct.Crypto::PublicKey" }
%"struct.Crypto::PublicKey" = type { [32 x i8] }

; 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: nounwind
declare i64 @time(ptr noundef) #1

declare i32 @keccak(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN11AccountBase12generate_keyERKN6Crypto9SecretKeyEbb(ptr dead_on_unwind noalias writable sret(%"struct.Crypto::SecretKey") align 1 %0, ptr noundef nonnull align 8 dereferenceable(136) %1, ptr noundef nonnull align 1 dereferenceable(32) %2, i1 noundef zeroext %3, i1 noundef zeroext %4) #3 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca %"struct.Crypto::SecretKey", align 1
  %11 = alloca %"struct.Crypto::SecretKey", align 1
  %12 = alloca %struct.tm, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = zext i1 %3 to i8
  store i8 %13, ptr %8, align 1, !tbaa !9
  %14 = zext i1 %4 to i8
  store i8 %14, ptr %9, align 1, !tbaa !9
  %15 = load ptr, ptr %6, align 8
  %16 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 0
  %17 = getelementptr inbounds %"struct.DynexCN::AccountKeys", ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %"struct.DynexCN::AccountPublicAddress", ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 0
  %20 = getelementptr inbounds %"struct.DynexCN::AccountKeys", ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %23 = trunc i8 %22 to i1
  call void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind writable sret(%"struct.Crypto::SecretKey") align 1 %0, ptr noundef nonnull align 1 dereferenceable(32) %18, ptr noundef nonnull align 1 dereferenceable(32) %20, ptr noundef nonnull align 1 dereferenceable(32) %21, i1 noundef zeroext %23)
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  %24 = call i32 @keccak(ptr noundef %0, i32 noundef 32, ptr noundef %10, i32 noundef 32)
  %25 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 0
  %26 = getelementptr inbounds %"struct.DynexCN::AccountKeys", ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %"struct.DynexCN::AccountPublicAddress", ptr %26, i32 0, i32 1
  %28 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 0
  %29 = getelementptr inbounds %"struct.DynexCN::AccountKeys", ptr %28, i32 0, i32 2
  %30 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  %32 = zext i1 %31 to i64
  %33 = select i1 %31, i1 false, i1 true
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  call void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind writable sret(%"struct.Crypto::SecretKey") align 1 %11, ptr noundef nonnull align 1 dereferenceable(32) %27, ptr noundef nonnull align 1 dereferenceable(32) %29, ptr noundef nonnull align 1 dereferenceable(32) %10, i1 noundef zeroext %33)
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 56, ptr %12) #5
  %34 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 5
  store i32 116, ptr %34, align 4, !tbaa !13
  %35 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 4
  store i32 4, ptr %35, align 8, !tbaa !17
  %36 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 3
  store i32 30, ptr %36, align 4, !tbaa !18
  %37 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 2
  store i32 0, ptr %37, align 8, !tbaa !19
  %38 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 1
  store i32 0, ptr %38, align 4, !tbaa !20
  %39 = getelementptr inbounds %struct.tm, ptr %12, i32 0, i32 0
  store i32 0, ptr %39, align 8, !tbaa !21
  %40 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %45

42:                                               ; preds = %5
  %43 = call i64 @mktime(ptr noundef %12) #5
  %44 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 1
  store i64 %43, ptr %44, align 8, !tbaa !22
  br label %48

45:                                               ; preds = %5
  %46 = call i64 @time(ptr noundef null) #5
  %47 = getelementptr inbounds %"class.DynexCN::AccountBase", ptr %15, i32 0, i32 1
  store i64 %46, ptr %47, align 8, !tbaa !22
  br label %48

48:                                               ; preds = %45, %42
  call void @llvm.lifetime.end.p0(i64 56, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind noalias writable sret(%"struct.Crypto::SecretKey") align 1, ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32), i1 noundef zeroext) #4

; Function Attrs: nounwind
declare i64 @mktime(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 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 = { 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 #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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !15, i64 20}
!14 = !{!"_ZTS2tm", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !16, i64 40, !6, i64 48}
!15 = !{!"int", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!14, !15, i64 16}
!18 = !{!14, !15, i64 12}
!19 = !{!14, !15, i64 8}
!20 = !{!14, !15, i64 4}
!21 = !{!14, !15, i64 0}
!22 = !{!23, !16, i64 128}
!23 = !{!"_ZTSN7DynexCN11AccountBaseE", !24, i64 0, !16, i64 128}
!24 = !{!"_ZTSN7DynexCN11AccountKeysE", !25, i64 0, !27, i64 64, !27, i64 96}
!25 = !{!"_ZTSN7DynexCN20AccountPublicAddressE", !26, i64 0, !26, i64 32}
!26 = !{!"_ZTSN6Crypto9PublicKeyE", !7, i64 0}
!27 = !{!"_ZTSN6Crypto9SecretKeyE", !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"

%"struct.Crypto::SecretKey" = type { [32 x i8] }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }

; 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: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #1

declare i32 @keccak(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN11AccountBase12generate_keyERKN6Crypto9SecretKeyEbb(ptr dead_on_unwind noalias writable sret(%"struct.Crypto::SecretKey") align 1 %0, ptr noundef nonnull align 8 dereferenceable(136) %1, ptr noundef nonnull align 1 dereferenceable(32) %2, i1 noundef zeroext %3, i1 noundef zeroext %4) local_unnamed_addr #3 align 2 {
  %6 = alloca %"struct.Crypto::SecretKey", align 1
  %7 = alloca %"struct.Crypto::SecretKey", align 1
  %8 = alloca %struct.tm, align 16
  %9 = getelementptr inbounds i8, ptr %1, i64 64
  tail call void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind writable sret(%"struct.Crypto::SecretKey") align 1 %0, ptr noundef nonnull align 1 dereferenceable(32) %1, ptr noundef nonnull align 1 dereferenceable(32) %9, ptr noundef nonnull align 1 dereferenceable(32) %2, i1 noundef zeroext %3)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  %10 = call i32 @keccak(ptr noundef %0, i32 noundef 32, ptr noundef nonnull %6, i32 noundef 32)
  %11 = getelementptr inbounds i8, ptr %1, i64 32
  %12 = getelementptr inbounds i8, ptr %1, i64 96
  %not. = xor i1 %4, true
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  call void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind nonnull writable sret(%"struct.Crypto::SecretKey") align 1 %7, ptr noundef nonnull align 1 dereferenceable(32) %11, ptr noundef nonnull align 1 dereferenceable(32) %12, ptr noundef nonnull align 1 dereferenceable(32) %6, i1 noundef zeroext %not.)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %8) #6
  %13 = getelementptr inbounds i8, ptr %8, i64 20
  store i32 116, ptr %13, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %8, i64 16
  store i32 4, ptr %14, align 16, !tbaa !12
  store <4 x i32> <i32 0, i32 0, i32 0, i32 30>, ptr %8, align 16, !tbaa !13
  br i1 %3, label %15, label %17

15:                                               ; preds = %5
  %16 = call i64 @mktime(ptr noundef nonnull %8) #6
  br label %19

17:                                               ; preds = %5
  %18 = call i64 @time(ptr noundef null) #6
  br label %19

19:                                               ; preds = %17, %15
  %.sink = phi i64 [ %16, %15 ], [ %18, %17 ]
  %20 = getelementptr inbounds i8, ptr %1, i64 128
  store i64 %.sink, ptr %20, align 8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Crypto15generate_m_keysERNS_9PublicKeyERNS_9SecretKeyERKS2_b(ptr dead_on_unwind noalias writable sret(%"struct.Crypto::SecretKey") align 1, ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32), i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn
declare noundef i64 @mktime(ptr nocapture noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 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 = { 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 #5 = { 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 #6 = { 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, !7, i64 20}
!6 = !{!"_ZTS2tm", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 40, !11, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 16}
!13 = !{!7, !7, i64 0}


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