; LLVM IR from intel/cryptography-primitives :: sources/ippcp/gfpec (pcpgfpeccpypoint)

; 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._cpGFpEC = type { i32, i32, ptr, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._cpGFpECPoint = type { i32, i32, i32, ptr }
%struct._cpGFp = type { i32, i32, ptr }
%struct._gsModEngine = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, i32, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsGFpECCpyPoint(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = icmp eq ptr null, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  store i32 -8, ptr %4, align 4
  br label %86

11:                                               ; preds = %3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp eq ptr null, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  store i32 -8, ptr %4, align 4
  br label %86

15:                                               ; preds = %11
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = icmp eq ptr null, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  store i32 -8, ptr %4, align 4
  br label %86

19:                                               ; preds = %15
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._cpGFpEC, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = call i64 @IPP_UINT_PTR(ptr noundef %23)
  %25 = trunc i64 %24 to i32
  %26 = xor i32 %22, %25
  %27 = icmp eq i32 %26, 1129136461
  br i1 %27, label %29, label %28

28:                                               ; preds = %19
  store i32 -13, ptr %4, align 4
  br label %86

29:                                               ; preds = %19
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._cpGFpECPoint, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !12
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call i64 @IPP_UINT_PTR(ptr noundef %33)
  %35 = trunc i64 %34 to i32
  %36 = xor i32 %32, %35
  %37 = icmp eq i32 %36, 1129136462
  br i1 %37, label %39, label %38

38:                                               ; preds = %29
  store i32 -13, ptr %4, align 4
  br label %86

39:                                               ; preds = %29
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._cpGFpECPoint, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !12
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call i64 @IPP_UINT_PTR(ptr noundef %43)
  %45 = trunc i64 %44 to i32
  %46 = xor i32 %42, %45
  %47 = icmp eq i32 %46, 1129136462
  br i1 %47, label %49, label %48

48:                                               ; preds = %39
  store i32 -13, ptr %4, align 4
  br label %86

49:                                               ; preds = %39
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._cpGFpECPoint, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._cpGFpEC, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = getelementptr inbounds %struct._cpGFp, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !16
  %58 = getelementptr inbounds %struct._gsModEngine, ptr %57, i32 0, i32 3
  %59 = load i32, ptr %58, align 8, !tbaa !18
  %60 = icmp ne i32 %52, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %49
  store i32 -11, ptr %4, align 4
  br label %86

62:                                               ; preds = %49
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._cpGFpECPoint, ptr %63, i32 0, i32 2
  %65 = load i32, ptr %64, align 8, !tbaa !14
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._cpGFpEC, ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = getelementptr inbounds %struct._cpGFp, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !16
  %71 = getelementptr inbounds %struct._gsModEngine, ptr %70, i32 0, i32 3
  %72 = load i32, ptr %71, align 8, !tbaa !18
  %73 = icmp ne i32 %65, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %62
  store i32 -11, ptr %4, align 4
  br label %86

75:                                               ; preds = %62
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._cpGFpEC, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !15
  %81 = getelementptr inbounds %struct._cpGFp, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds %struct._gsModEngine, ptr %82, i32 0, i32 3
  %84 = load i32, ptr %83, align 8, !tbaa !18
  %85 = call ptr @gfec_CopyPoint(ptr noundef %76, ptr noundef %77, i32 noundef %84)
  store i32 0, ptr %4, align 4
  br label %86

86:                                               ; preds = %75, %74, %61, %48, %38, %28, %18, %14, %10
  %87 = load i32, ptr %4, align 4
  ret i32 %87
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_UINT_PTR(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @gfec_CopyPoint(ptr noundef, ptr noundef, i32 noundef) #1

attributes #0 = { 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 #1 = { inlinehint 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" }

!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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_cpGFpEC", !11, i64 0, !11, i64 4, !6, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !11, i64 68, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_cpGFpECPoint", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16}
!14 = !{!13, !11, i64 8}
!15 = !{!10, !6, i64 8}
!16 = !{!17, !6, i64 8}
!17 = !{!"_cpGFp", !11, i64 0, !11, i64 4, !6, i64 8}
!18 = !{!19, !11, i64 16}
!19 = !{!"_gsModEngine", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !20, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !6, i64 104}
!20 = !{!"long long", !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: nounwind uwtable
define dso_local range(i32 -13, 1) i32 @ippsGFpECCpyPoint(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  %6 = icmp eq ptr %2, null
  %or.cond21 = or i1 %or.cond, %6
  br i1 %or.cond21, label %39, label %7

7:                                                ; preds = %3
  %8 = load i32, ptr %2, align 8, !tbaa !5
  %9 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %2)
  %10 = trunc i64 %9 to i32
  %11 = xor i32 %8, %10
  %12 = icmp eq i32 %11, 1129136461
  br i1 %12, label %13, label %39

13:                                               ; preds = %7
  %14 = load i32, ptr %0, align 8, !tbaa !11
  %15 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %0)
  %16 = trunc i64 %15 to i32
  %17 = xor i32 %14, %16
  %18 = icmp eq i32 %17, 1129136462
  br i1 %18, label %19, label %39

19:                                               ; preds = %13
  %20 = load i32, ptr %1, align 8, !tbaa !11
  %21 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %1)
  %22 = trunc i64 %21 to i32
  %23 = xor i32 %20, %22
  %24 = icmp eq i32 %23, 1129136462
  br i1 %24, label %25, label %39

25:                                               ; preds = %19
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %2, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !17
  %.not = icmp eq i32 %27, %33
  br i1 %.not, label %34, label %39

34:                                               ; preds = %25
  %35 = getelementptr inbounds i8, ptr %1, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !13
  %.not20 = icmp eq i32 %36, %27
  br i1 %.not20, label %37, label %39

37:                                               ; preds = %34
  %38 = tail call ptr @gfec_CopyPoint(ptr noundef nonnull %1, ptr noundef nonnull %0, i32 noundef %27)
  br label %39

39:                                               ; preds = %34, %25, %19, %13, %7, %3, %37
  %.0 = phi i32 [ 0, %37 ], [ -8, %3 ], [ -13, %7 ], [ -13, %13 ], [ -13, %19 ], [ -11, %25 ], [ -11, %34 ]
  ret i32 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_UINT_PTR(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @gfec_CopyPoint(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { inlinehint 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" }

!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 = !{!"_cpGFpEC", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_cpGFpECPoint", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!13 = !{!12, !7, i64 8}
!14 = !{!6, !10, i64 8}
!15 = !{!16, !10, i64 8}
!16 = !{!"_cpGFp", !7, i64 0, !7, i64 4, !10, i64 8}
!17 = !{!18, !7, i64 16}
!18 = !{!"_gsModEngine", !10, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !19, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !7, i64 96, !7, i64 100, !10, i64 104}
!19 = !{!"long long", !8, i64 0}


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