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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsGFpECGet(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
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  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
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = icmp eq ptr null, %14
  br i1 %15, label %16, label %17

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

17:                                               ; preds = %4
  %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 %106

27:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._cpGFpEC, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !12
  store ptr %30, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._cpGFp, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  store ptr %33, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._gsModEngine, ptr %34, i32 0, i32 3
  %36 = load i32, ptr %35, align 8, !tbaa !15
  store i32 %36, ptr %12, align 4, !tbaa !18
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %42

39:                                               ; preds = %27
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %40, ptr %41, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %39, %27
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %73

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

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

55:                                               ; preds = %45
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._cpGFpElement, ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 4, !tbaa !21
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._gsModEngine, ptr %59, i32 0, i32 3
  %61 = load i32, ptr %60, align 8, !tbaa !15
  %62 = icmp ne i32 %58, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %55
  store i32 -11, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %105

64:                                               ; preds = %55
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._cpGFpElement, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !22
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._cpGFpEC, ptr %68, i32 0, i32 6
  %70 = load ptr, ptr %69, align 8, !tbaa !23
  %71 = load i32, ptr %12, align 4, !tbaa !18
  %72 = call ptr @cpGFpElementCopy(ptr noundef %67, ptr noundef %70, i32 noundef %71)
  br label %73

73:                                               ; preds = %64, %42
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %104

76:                                               ; preds = %73
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._cpGFpElement, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 8, !tbaa !19
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = call i64 @IPP_UINT_PTR(ptr noundef %80)
  %82 = trunc i64 %81 to i32
  %83 = xor i32 %79, %82
  %84 = icmp eq i32 %83, 1129136456
  br i1 %84, label %86, label %85

85:                                               ; preds = %76
  store i32 -13, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %105

86:                                               ; preds = %76
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._cpGFpElement, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !21
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._gsModEngine, ptr %90, i32 0, i32 3
  %92 = load i32, ptr %91, align 8, !tbaa !15
  %93 = icmp ne i32 %89, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %86
  store i32 -11, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %105

95:                                               ; preds = %86
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._cpGFpElement, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._cpGFpEC, ptr %99, i32 0, i32 7
  %101 = load ptr, ptr %100, align 8, !tbaa !24
  %102 = load i32, ptr %12, align 4, !tbaa !18
  %103 = call ptr @cpGFpElementCopy(ptr noundef %98, ptr noundef %101, i32 noundef %102)
  br label %104

104:                                              ; preds = %95, %73
  store i32 0, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %105

105:                                              ; preds = %104, %94, %85, %63, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %106

106:                                              ; preds = %105, %26, %16
  %107 = load i32, ptr %5, align 4
  ret i32 %107
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !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, !11, i64 16}
!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 = !{!11, !11, i64 0}
!19 = !{!20, !11, i64 0}
!20 = !{!"_cpGFpElement", !11, i64 0, !11, i64 4, !6, i64 8}
!21 = !{!20, !11, i64 4}
!22 = !{!20, !6, i64 8}
!23 = !{!10, !6, i64 32}
!24 = !{!10, !6, i64 40}


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

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

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %3, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %20, label %19

19:                                               ; preds = %12
  store ptr %14, ptr %0, align 8, !tbaa !17
  br label %20

20:                                               ; preds = %19, %12
  %.not29 = icmp eq ptr %1, null
  br i1 %.not29, label %37, label %21

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

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %1, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = load i32, ptr %17, align 8, !tbaa !14
  %.not30 = icmp eq i32 %29, %30
  br i1 %.not30, label %31, label %54

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %1, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !21
  %34 = getelementptr inbounds i8, ptr %3, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !22
  %36 = tail call ptr @cpGFpElementCopy(ptr noundef %33, ptr noundef %35, i32 noundef %18)
  br label %37

37:                                               ; preds = %31, %20
  %.not31 = icmp eq ptr %2, null
  br i1 %.not31, label %54, label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %2, align 8, !tbaa !18
  %40 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %2)
  %41 = trunc i64 %40 to i32
  %42 = xor i32 %39, %41
  %43 = icmp eq i32 %42, 1129136456
  br i1 %43, label %44, label %54

44:                                               ; preds = %38
  %45 = getelementptr inbounds i8, ptr %2, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !20
  %47 = load i32, ptr %17, align 8, !tbaa !14
  %.not32 = icmp eq i32 %46, %47
  br i1 %.not32, label %48, label %54

48:                                               ; preds = %44
  %49 = getelementptr inbounds i8, ptr %2, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = getelementptr inbounds i8, ptr %3, i64 40
  %52 = load ptr, ptr %51, align 8, !tbaa !23
  %53 = tail call ptr @cpGFpElementCopy(ptr noundef %50, ptr noundef %52, i32 noundef %18)
  br label %54

54:                                               ; preds = %21, %27, %38, %44, %48, %37, %6, %4
  %.1 = phi i32 [ -8, %4 ], [ -13, %6 ], [ -13, %21 ], [ -11, %27 ], [ -13, %38 ], [ -11, %44 ], [ 0, %48 ], [ 0, %37 ]
  ret i32 %.1
}

; 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 @cpGFpElementCopy(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 = !{!6, !10, i64 8}
!12 = !{!13, !10, i64 8}
!13 = !{!"_cpGFp", !7, i64 0, !7, i64 4, !10, i64 8}
!14 = !{!15, !7, i64 16}
!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 = !{!10, !10, i64 0}
!18 = !{!19, !7, i64 0}
!19 = !{!"_cpGFpElement", !7, i64 0, !7, i64 4, !10, i64 8}
!20 = !{!19, !7, i64 4}
!21 = !{!19, !10, i64 8}
!22 = !{!6, !10, i64 32}
!23 = !{!6, !10, i64 40}


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