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

; 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._cpGFpElement = type { 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 @ippsGFpECSetPoint(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 %8, 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 %124

13:                                               ; preds = %4
  %14 = load ptr, ptr %9, 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 %124

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

26:                                               ; preds = %17
  store i32 -13, ptr %5, align 4
  br label %124

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

36:                                               ; preds = %27
  store i32 -13, ptr %5, align 4
  br label %124

37:                                               ; preds = %27
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = icmp eq ptr null, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  store i32 -8, ptr %5, align 4
  br label %124

41:                                               ; preds = %37
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = icmp eq ptr null, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store i32 -8, ptr %5, align 4
  br label %124

45:                                               ; preds = %41
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._cpGFpElement, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !14
  %49 = load ptr, ptr %6, 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, 1129136456
  br i1 %53, label %55, label %54

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

55:                                               ; preds = %45
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._cpGFpElement, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !14
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = call i64 @IPP_UINT_PTR(ptr noundef %59)
  %61 = trunc i64 %60 to i32
  %62 = xor i32 %58, %61
  %63 = icmp eq i32 %62, 1129136456
  br i1 %63, label %65, label %64

64:                                               ; preds = %55
  store i32 -13, ptr %5, align 4
  br label %124

65:                                               ; preds = %55
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._cpGFpElement, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !16
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._cpGFpEC, ptr %69, i32 0, i32 2
  %71 = load ptr, ptr %70, align 8, !tbaa !17
  %72 = getelementptr inbounds %struct._cpGFp, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !18
  %74 = getelementptr inbounds %struct._gsModEngine, ptr %73, i32 0, i32 3
  %75 = load i32, ptr %74, align 8, !tbaa !20
  %76 = icmp ne i32 %68, %75
  br i1 %76, label %77, label %78

77:                                               ; preds = %65
  store i32 -11, ptr %5, align 4
  br label %124

78:                                               ; preds = %65
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._cpGFpElement, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !16
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._cpGFpEC, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  %85 = getelementptr inbounds %struct._cpGFp, ptr %84, i32 0, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !18
  %87 = getelementptr inbounds %struct._gsModEngine, ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 8, !tbaa !20
  %89 = icmp ne i32 %81, %88
  br i1 %89, label %90, label %91

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

91:                                               ; preds = %78
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._cpGFpECPoint, ptr %92, i32 0, i32 2
  %94 = load i32, ptr %93, align 8, !tbaa !23
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._cpGFpEC, ptr %95, i32 0, i32 2
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = getelementptr inbounds %struct._cpGFp, ptr %97, i32 0, i32 2
  %99 = load ptr, ptr %98, align 8, !tbaa !18
  %100 = getelementptr inbounds %struct._gsModEngine, ptr %99, i32 0, i32 3
  %101 = load i32, ptr %100, align 8, !tbaa !20
  %102 = icmp ne i32 %94, %101
  br i1 %102, label %103, label %104

103:                                              ; preds = %91
  store i32 -11, ptr %5, align 4
  br label %124

104:                                              ; preds = %91
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._cpGFpECPoint, ptr %105, i32 0, i32 3
  %107 = load ptr, ptr %106, align 8, !tbaa !24
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._cpGFpElement, ptr %108, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !25
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._cpGFpElement, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %112, align 8, !tbaa !25
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = call i32 @gfec_SetPoint(ptr noundef %107, ptr noundef %110, ptr noundef %113, ptr noundef %114)
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %120

117:                                              ; preds = %104
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._cpGFpECPoint, ptr %118, i32 0, i32 1
  store i32 3, ptr %119, align 4, !tbaa !26
  br label %123

120:                                              ; preds = %104
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._cpGFpECPoint, ptr %121, i32 0, i32 1
  store i32 0, ptr %122, align 4, !tbaa !26
  br label %123

123:                                              ; preds = %120, %117
  store i32 0, ptr %5, align 4
  br label %124

124:                                              ; preds = %123, %103, %90, %77, %64, %54, %44, %40, %36, %26, %16, %12
  %125 = load i32, ptr %5, align 4
  ret i32 %125
}

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

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


; 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 @ippsGFpECSetPoint(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = icmp eq ptr %2, null
  %6 = icmp eq ptr %3, null
  %or.cond = or i1 %5, %6
  br i1 %or.cond, label %57, label %7

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

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

19:                                               ; preds = %13
  %20 = icmp eq ptr %0, null
  %21 = icmp eq ptr %1, null
  %or.cond32 = or i1 %20, %21
  br i1 %or.cond32, label %57, label %22

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

28:                                               ; preds = %22
  %29 = load i32, ptr %1, align 8, !tbaa !13
  %30 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %1)
  %31 = trunc i64 %30 to i32
  %32 = xor i32 %29, %31
  %33 = icmp eq i32 %32, 1129136456
  br i1 %33, label %34, label %57

34:                                               ; preds = %28
  %35 = getelementptr inbounds i8, ptr %0, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %3, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = getelementptr inbounds i8, ptr %38, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %.not = icmp eq i32 %36, %42
  br i1 %.not, label %43, label %57

43:                                               ; preds = %34
  %44 = getelementptr inbounds i8, ptr %1, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !15
  %.not29 = icmp eq i32 %45, %36
  br i1 %.not29, label %46, label %57

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %2, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !22
  %.not30 = icmp eq i32 %48, %36
  br i1 %.not30, label %.sink.split, label %57

.sink.split:                                      ; preds = %46
  %49 = getelementptr inbounds i8, ptr %2, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %0, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !24
  %53 = getelementptr inbounds i8, ptr %1, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = tail call i32 @gfec_SetPoint(ptr noundef %50, ptr noundef %52, ptr noundef %54, ptr noundef nonnull %3) #3
  %.not31 = icmp eq i32 %55, 0
  %56 = getelementptr inbounds i8, ptr %2, i64 4
  %. = select i1 %.not31, i32 0, i32 3
  store i32 %., ptr %56, align 4, !tbaa !25
  br label %57

57:                                               ; preds = %.sink.split, %46, %43, %34, %28, %22, %19, %13, %7, %4
  %.0 = phi i32 [ -8, %4 ], [ -13, %7 ], [ -13, %13 ], [ -8, %19 ], [ -13, %22 ], [ -13, %28 ], [ -11, %34 ], [ -11, %43 ], [ -11, %46 ], [ 0, %.sink.split ]
  ret i32 %.0
}

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

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


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