; LLVM IR from dynexcoin/Dynex :: src/Transfers/TransfersContainer.ll (ZNK7DynexCN21SpentOutputDescriptoreqERKS0_)

; 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.DynexCN::SpentOutputDescriptor" = type { i8, %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { i64, i32 }

@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [86 x i8], align 1
@__PRETTY_FUNCTION__._ZNK7DynexCN21SpentOutputDescriptoreqERKS0_ = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7DynexCN21SpentOutputDescriptoreqERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  %7 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 0
  %8 = load i8, ptr %7, align 8, !tbaa !9
  %9 = icmp eq i8 %8, 1
  br i1 %9, label %10, label %26

10:                                               ; preds = %2
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %11, i32 0, i32 0
  %13 = load i8, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 0
  %15 = load i8, ptr %14, align 8, !tbaa !9
  %16 = icmp eq i8 %13, %15
  br i1 %16, label %17, label %24

17:                                               ; preds = %10
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  %21 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  %23 = call noundef zeroext i1 @_ZN6CryptoeqERKNS_8KeyImageES2_(ptr noundef nonnull align 1 dereferenceable(32) %20, ptr noundef nonnull align 1 dereferenceable(32) %22)
  br label %24

24:                                               ; preds = %17, %10
  %25 = phi i1 [ false, %10 ], [ %23, %17 ]
  store i1 %25, ptr %3, align 1
  br label %58

26:                                               ; preds = %2
  %27 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 0
  %28 = load i8, ptr %27, align 8, !tbaa !9
  %29 = icmp eq i8 %28, 2
  br i1 %29, label %30, label %57

30:                                               ; preds = %26
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %31, i32 0, i32 0
  %33 = load i8, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 0
  %35 = load i8, ptr %34, align 8, !tbaa !9
  %36 = icmp eq i8 %33, %35
  br i1 %36, label %37, label %55

37:                                               ; preds = %30
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds %struct.anon, ptr %39, i32 0, i32 0
  %41 = load i64, ptr %40, align 8, !tbaa !12
  %42 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 1
  %43 = getelementptr inbounds %struct.anon, ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !12
  %45 = icmp eq i64 %41, %44
  br i1 %45, label %46, label %55

46:                                               ; preds = %37
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %47, i32 0, i32 1
  %49 = getelementptr inbounds %struct.anon, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !12
  %51 = getelementptr inbounds %"class.DynexCN::SpentOutputDescriptor", ptr %6, i32 0, i32 1
  %52 = getelementptr inbounds %struct.anon, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !12
  %54 = icmp eq i32 %50, %53
  br label %55

55:                                               ; preds = %46, %37, %30
  %56 = phi i1 [ false, %37 ], [ false, %30 ], [ %54, %46 ]
  store i1 %56, ptr %3, align 1
  br label %58

57:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.8, i32 noundef 171, ptr noundef @__PRETTY_FUNCTION__._ZNK7DynexCN21SpentOutputDescriptoreqERKS0_) #3
  unreachable

58:                                               ; preds = %55, %24
  %59 = load i1, ptr %3, align 1
  ret i1 %59
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6CryptoeqERKNS_8KeyImageES2_(ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32)) #2

attributes #0 = { noreturn 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 #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 = { inlinehint 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 #3 = { noreturn 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, !11, i64 0}
!10 = !{!"_ZTSN7DynexCN21SpentOutputDescriptorE", !11, i64 0, !7, i64 8}
!11 = !{!"_ZTSN7DynexCN16TransactionTypes10OutputTypeE", !7, i64 0}
!12 = !{!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"

@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [86 x i8], align 1
@__PRETTY_FUNCTION__._ZNK7DynexCN21SpentOutputDescriptoreqERKS0_ = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK7DynexCN21SpentOutputDescriptoreqERKS0_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1) local_unnamed_addr #1 align 2 {
  %3 = load i8, ptr %0, align 8, !tbaa !5
  switch i8 %3, label %28 [
    i8 1, label %4
    i8 2, label %13
  ]

4:                                                ; preds = %2
  %5 = load i8, ptr %1, align 8, !tbaa !5
  %6 = icmp eq i8 %5, 1
  br i1 %6, label %7, label %29

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !10
  %12 = tail call noundef zeroext i1 @_ZN6CryptoeqERKNS_8KeyImageES2_(ptr noundef nonnull align 1 dereferenceable(32) %9, ptr noundef nonnull align 1 dereferenceable(32) %11)
  br label %29

13:                                               ; preds = %2
  %14 = load i8, ptr %1, align 8, !tbaa !5
  %15 = icmp eq i8 %14, 2
  br i1 %15, label %16, label %29

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = load i64, ptr %17, align 8, !tbaa !10
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  %20 = load i64, ptr %19, align 8, !tbaa !10
  %21 = icmp eq i64 %18, %20
  br i1 %21, label %22, label %29

22:                                               ; preds = %16
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load i32, ptr %23, align 8, !tbaa !10
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load i32, ptr %25, align 8, !tbaa !10
  %27 = icmp eq i32 %24, %26
  br label %29

28:                                               ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, i32 noundef 171, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK7DynexCN21SpentOutputDescriptoreqERKS0_) #3
  unreachable

29:                                               ; preds = %13, %16, %22, %4, %7
  %.0 = phi i1 [ false, %4 ], [ %12, %7 ], [ false, %16 ], [ false, %13 ], [ %27, %22 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6CryptoeqERKNS_8KeyImageES2_(ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32)) local_unnamed_addr #2

attributes #0 = { noreturn 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 #1 = { 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 #2 = { inlinehint 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 #3 = { noreturn 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 0}
!6 = !{!"_ZTSN7DynexCN21SpentOutputDescriptorE", !7, i64 0, !8, i64 8}
!7 = !{!"_ZTSN7DynexCN16TransactionTypes10OutputTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!8, !8, i64 0}


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