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

; 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 @ippsGFpECCmpPoint(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = icmp eq ptr null, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %4
  store i32 -8, ptr %5, align 4
  br label %90

13:                                               ; preds = %4
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = icmp eq ptr null, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  store i32 -8, ptr %5, align 4
  br label %90

17:                                               ; preds = %13
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = icmp eq ptr null, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  store i32 -8, ptr %5, align 4
  br label %90

21:                                               ; preds = %17
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp eq ptr null, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i32 -8, ptr %5, align 4
  br label %90

25:                                               ; preds = %21
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._cpGFpEC, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call i64 @IPP_UINT_PTR(ptr noundef %29)
  %31 = trunc i64 %30 to i32
  %32 = xor i32 %28, %31
  %33 = icmp eq i32 %32, 1129136461
  br i1 %33, label %35, label %34

34:                                               ; preds = %25
  store i32 -13, ptr %5, align 4
  br label %90

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

44:                                               ; preds = %35
  store i32 -13, ptr %5, align 4
  br label %90

45:                                               ; preds = %35
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._cpGFpECPoint, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !12
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = call i64 @IPP_UINT_PTR(ptr noundef %49)
  %51 = trunc i64 %50 to i32
  %52 = xor i32 %48, %51
  %53 = icmp eq i32 %52, 1129136462
  br i1 %53, label %55, label %54

54:                                               ; preds = %45
  store i32 -13, ptr %5, align 4
  br label %90

55:                                               ; preds = %45
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._cpGFpECPoint, ptr %56, i32 0, i32 2
  %58 = load i32, ptr %57, align 8, !tbaa !14
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._cpGFpEC, ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = getelementptr inbounds %struct._cpGFp, ptr %61, i32 0, i32 2
  %63 = load ptr, ptr %62, align 8, !tbaa !16
  %64 = getelementptr inbounds %struct._gsModEngine, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 8, !tbaa !18
  %66 = icmp ne i32 %58, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %55
  store i32 -11, ptr %5, align 4
  br label %90

68:                                               ; preds = %55
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._cpGFpECPoint, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !14
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._cpGFpEC, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = getelementptr inbounds %struct._cpGFp, ptr %74, i32 0, i32 2
  %76 = load ptr, ptr %75, align 8, !tbaa !16
  %77 = getelementptr inbounds %struct._gsModEngine, ptr %76, i32 0, i32 3
  %78 = load i32, ptr %77, align 8, !tbaa !18
  %79 = icmp ne i32 %71, %78
  br i1 %79, label %80, label %81

80:                                               ; preds = %68
  store i32 -11, ptr %5, align 4
  br label %90

81:                                               ; preds = %68
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = call i32 @gfec_ComparePoint(ptr noundef %82, ptr noundef %83, ptr noundef %84)
  %86 = icmp ne i32 %85, 0
  %87 = zext i1 %86 to i64
  %88 = select i1 %86, i32 15, i32 16
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %88, ptr %89, align 4, !tbaa !21
  store i32 0, ptr %5, align 4
  br label %90

90:                                               ; preds = %81, %80, %67, %54, %44, %34, %24, %20, %16, %12
  %91 = load i32, ptr %5, align 4
  ret i32 %91
}

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

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

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

!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}
!21 = !{!11, !11, 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 @ippsGFpECCmpPoint(ptr noundef %0, ptr noundef %1, ptr noundef writeonly %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %6 = insertelement <4 x ptr> %5, ptr %1, i64 1
  %7 = insertelement <4 x ptr> %6, ptr %2, i64 2
  %8 = insertelement <4 x ptr> %7, ptr %3, i64 3
  %9 = icmp eq <4 x ptr> %8, zeroinitializer
  %10 = bitcast <4 x i1> %9 to i4
  %.not27 = icmp eq i4 %10, 0
  br i1 %.not27, label %11, label %44

11:                                               ; preds = %4
  %12 = load i32, ptr %3, align 8, !tbaa !5
  %13 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %3)
  %14 = trunc i64 %13 to i32
  %15 = xor i32 %12, %14
  %16 = icmp eq i32 %15, 1129136461
  br i1 %16, label %17, label %44

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

23:                                               ; preds = %17
  %24 = load i32, ptr %1, align 8, !tbaa !11
  %25 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %1)
  %26 = trunc i64 %25 to i32
  %27 = xor i32 %24, %26
  %28 = icmp eq i32 %27, 1129136462
  br i1 %28, label %29, label %44

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = getelementptr inbounds i8, ptr %3, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %34 = getelementptr inbounds i8, ptr %33, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load i32, ptr %36, align 8, !tbaa !17
  %.not = icmp eq i32 %31, %37
  br i1 %.not, label %38, label %44

38:                                               ; preds = %29
  %39 = getelementptr inbounds i8, ptr %1, i64 8
  %40 = load i32, ptr %39, align 8, !tbaa !13
  %.not23 = icmp eq i32 %40, %31
  br i1 %.not23, label %41, label %44

41:                                               ; preds = %38
  %42 = tail call i32 @gfec_ComparePoint(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %3) #3
  %.not24 = icmp eq i32 %42, 0
  %43 = select i1 %.not24, i32 16, i32 15
  store i32 %43, ptr %2, align 4, !tbaa !20
  br label %44

44:                                               ; preds = %38, %29, %23, %17, %11, %4, %41
  %.0 = phi i32 [ 0, %41 ], [ -8, %4 ], [ -13, %11 ], [ -13, %17 ], [ -13, %23 ], [ -11, %29 ], [ -11, %38 ]
  ret i32 %.0
}

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

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

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" }
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 = { 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 = !{!"_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}
!20 = !{!7, !7, i64 0}


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