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

; 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._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 }
%struct._cpGFpElement = type { i32, i32, ptr }
%struct._cpGFpECPoint = type { i32, i32, i32, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsGFpECMakePoint(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 %95

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 %95

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 %95

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 %95

29:                                               ; preds = %19
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._cpGFpEC, ptr %30, i32 0, i32 2
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  %33 = getelementptr inbounds %struct._cpGFp, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = getelementptr inbounds %struct._gsModEngine, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = icmp eq ptr %36, null
  br i1 %37, label %39, label %38

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

39:                                               ; preds = %29
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._cpGFpElement, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !18
  %43 = load ptr, ptr %5, 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, 1129136456
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %39
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._cpGFpECPoint, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !20
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = call i64 @IPP_UINT_PTR(ptr noundef %53)
  %55 = trunc i64 %54 to i32
  %56 = xor i32 %52, %55
  %57 = icmp eq i32 %56, 1129136462
  br i1 %57, label %59, label %58

58:                                               ; preds = %49
  store i32 -13, ptr %4, align 4
  br label %95

59:                                               ; preds = %49
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._cpGFpElement, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !22
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._cpGFpEC, ptr %63, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !12
  %66 = getelementptr inbounds %struct._cpGFp, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !13
  %68 = getelementptr inbounds %struct._gsModEngine, ptr %67, i32 0, i32 3
  %69 = load i32, ptr %68, align 8, !tbaa !23
  %70 = icmp ne i32 %62, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %59
  store i32 -11, ptr %4, align 4
  br label %95

72:                                               ; preds = %59
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._cpGFpECPoint, ptr %73, i32 0, i32 2
  %75 = load i32, ptr %74, align 8, !tbaa !24
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._cpGFpEC, ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %77, align 8, !tbaa !12
  %79 = getelementptr inbounds %struct._cpGFp, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !13
  %81 = getelementptr inbounds %struct._gsModEngine, ptr %80, i32 0, i32 3
  %82 = load i32, ptr %81, align 8, !tbaa !23
  %83 = icmp ne i32 %75, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %72
  store i32 -11, ptr %4, align 4
  br label %95

85:                                               ; preds = %72
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._cpGFpElement, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !25
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = call i32 @gfec_MakePoint(ptr noundef %86, ptr noundef %89, ptr noundef %90)
  %92 = icmp ne i32 %91, 0
  %93 = zext i1 %92 to i64
  %94 = select i1 %92, i32 0, i32 -1016
  store i32 %94, ptr %4, align 4
  br label %95

95:                                               ; preds = %85, %84, %71, %58, %48, %38, %28, %18, %14, %10
  %96 = load i32, ptr %4, align 4
  ret i32 %96
}

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

declare i32 @gfec_MakePoint(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 = !{!10, !6, i64 8}
!13 = !{!14, !6, i64 8}
!14 = !{!"_cpGFp", !11, i64 0, !11, i64 4, !6, i64 8}
!15 = !{!16, !6, i64 0}
!16 = !{!"_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, !17, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !6, i64 104}
!17 = !{!"long long", !7, i64 0}
!18 = !{!19, !11, i64 0}
!19 = !{!"_cpGFpElement", !11, i64 0, !11, i64 4, !6, i64 8}
!20 = !{!21, !11, i64 0}
!21 = !{!"_cpGFpECPoint", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16}
!22 = !{!19, !11, i64 4}
!23 = !{!16, !11, i64 16}
!24 = !{!21, !11, i64 8}
!25 = !{!19, !6, i64 8}


; 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 -1016, 1) i32 @ippsGFpECMakePoint(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.cond23 = or i1 %or.cond, %6
  br i1 %or.cond23, label %48, 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 %48

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %2, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %48

20:                                               ; preds = %13
  %21 = load i32, ptr %0, align 8, !tbaa !17
  %22 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %0)
  %23 = trunc i64 %22 to i32
  %24 = xor i32 %21, %23
  %25 = icmp eq i32 %24, 1129136456
  br i1 %25, label %26, label %48

26:                                               ; preds = %20
  %27 = load i32, ptr %1, align 8, !tbaa !19
  %28 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %1)
  %29 = trunc i64 %28 to i32
  %30 = xor i32 %27, %29
  %31 = icmp eq i32 %30, 1129136462
  br i1 %31, label %32, label %48

32:                                               ; preds = %26
  %33 = getelementptr inbounds i8, ptr %0, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !21
  %35 = load ptr, ptr %14, align 8, !tbaa !11
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %39 = load i32, ptr %38, align 8, !tbaa !22
  %.not = icmp eq i32 %34, %39
  br i1 %.not, label %40, label %48

40:                                               ; preds = %32
  %41 = getelementptr inbounds i8, ptr %1, i64 8
  %42 = load i32, ptr %41, align 8, !tbaa !23
  %.not21 = icmp eq i32 %42, %34
  br i1 %.not21, label %43, label %48

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %0, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !24
  %46 = tail call i32 @gfec_MakePoint(ptr noundef nonnull %1, ptr noundef %45, ptr noundef nonnull %2) #3
  %.not22 = icmp eq i32 %46, 0
  %47 = select i1 %.not22, i32 -1016, i32 0
  br label %48

48:                                               ; preds = %40, %32, %26, %20, %13, %7, %3, %43
  %.0 = phi i32 [ %47, %43 ], [ -8, %3 ], [ -13, %7 ], [ -5, %13 ], [ -13, %20 ], [ -13, %26 ], [ -11, %32 ], [ -11, %40 ]
  ret i32 %.0
}

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

declare i32 @gfec_MakePoint(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 = !{!6, !10, i64 8}
!12 = !{!13, !10, i64 8}
!13 = !{!"_cpGFp", !7, i64 0, !7, i64 4, !10, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"_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, !16, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !7, i64 96, !7, i64 100, !10, i64 104}
!16 = !{!"long long", !8, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"_cpGFpElement", !7, i64 0, !7, i64 4, !10, i64 8}
!19 = !{!20, !7, i64 0}
!20 = !{!"_cpGFpECPoint", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!21 = !{!18, !7, i64 4}
!22 = !{!15, !7, i64 16}
!23 = !{!20, !7, i64 8}
!24 = !{!18, !10, i64 8}


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