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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsGFpSetElementHash_rmf(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca [64 x i8], align 16
  %15 = alloca [9 x i64], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %20 = load ptr, ptr %11, align 8, !tbaa !5
  %21 = icmp eq ptr null, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %5
  store i32 -8, ptr %6, align 4
  br label %116

23:                                               ; preds = %5
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store i32 -15, ptr %6, align 4
  br label %116

27:                                               ; preds = %23
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %34

30:                                               ; preds = %27
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  store i32 -8, ptr %6, align 4
  br label %116

34:                                               ; preds = %30, %27
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = icmp eq ptr null, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  store i32 -8, ptr %6, align 4
  br label %116

38:                                               ; preds = %34
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = icmp eq ptr null, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i32 -8, ptr %6, align 4
  br label %116

42:                                               ; preds = %38
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._cpGFp, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !11
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call i64 @IPP_UINT_PTR(ptr noundef %46)
  %48 = trunc i64 %47 to i32
  %49 = xor i32 %45, %48
  %50 = icmp eq i32 %49, 1129136455
  br i1 %50, label %52, label %51

51:                                               ; preds = %42
  store i32 -13, ptr %6, align 4
  br label %116

52:                                               ; preds = %42
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._cpGFpElement, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !13
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = call i64 @IPP_UINT_PTR(ptr noundef %56)
  %58 = trunc i64 %57 to i32
  %59 = xor i32 %55, %58
  %60 = icmp eq i32 %59, 1129136456
  br i1 %60, label %62, label %61

61:                                               ; preds = %52
  store i32 -13, ptr %6, align 4
  br label %116

62:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._cpGFp, ptr %63, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  store ptr %65, ptr %12, align 8, !tbaa !5
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._gsModEngine, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %69 = icmp eq ptr %68, null
  br i1 %69, label %71, label %70

70:                                               ; preds = %62
  store i32 -5, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %115

71:                                               ; preds = %62
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._cpGFpElement, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._gsModEngine, ptr %75, i32 0, i32 3
  %77 = load i32, ptr %76, align 8, !tbaa !20
  %78 = icmp ne i32 %74, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %71
  store i32 -11, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %115

80:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 64, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = load i32, ptr %8, align 4, !tbaa !9
  %83 = getelementptr inbounds [64 x i8], ptr %14, i64 0, i64 0
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = call i32 @ippsHashMessage_rmf(ptr noundef %81, i32 noundef %82, ptr noundef %83, ptr noundef %84)
  store i32 %85, ptr %16, align 4, !tbaa !9
  %86 = load i32, ptr %16, align 4, !tbaa !9
  %87 = icmp eq i32 0, %86
  br i1 %87, label %88, label %113

88:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._gsModEngine, ptr %89, i32 0, i32 3
  %91 = load i32, ptr %90, align 8, !tbaa !20
  store i32 %91, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._cpHashMethod_rmf, ptr %92, i32 0, i32 1
  %94 = load i32, ptr %93, align 4, !tbaa !21
  store i32 %94, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %95 = getelementptr inbounds [9 x i64], ptr %15, i64 0, i64 0
  %96 = getelementptr inbounds [64 x i8], ptr %14, i64 0, i64 0
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = call i32 @cpFromOctStr_BNU(ptr noundef %95, ptr noundef %96, i32 noundef %97)
  store i32 %98, ptr %19, align 4, !tbaa !9
  %99 = getelementptr inbounds [9 x i64], ptr %15, i64 0, i64 0
  %100 = load i32, ptr %19, align 4, !tbaa !9
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._gsModEngine, ptr %101, i32 0, i32 8
  %103 = load ptr, ptr %102, align 8, !tbaa !23
  %104 = load i32, ptr %17, align 4, !tbaa !9
  %105 = call i32 @cpMod_BNU(ptr noundef %99, i32 noundef %100, ptr noundef %103, i32 noundef %104)
  store i32 %105, ptr %19, align 4, !tbaa !9
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._cpGFpElement, ptr %106, i32 0, i32 2
  %108 = load ptr, ptr %107, align 8, !tbaa !24
  %109 = getelementptr inbounds [9 x i64], ptr %15, i64 0, i64 0
  %110 = load i32, ptr %19, align 4, !tbaa !9
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = call ptr @cpGFpSet(ptr noundef %108, ptr noundef %109, i32 noundef %110, ptr noundef %111)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %113

113:                                              ; preds = %88, %80
  %114 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %114, ptr %6, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %14) #4
  br label %115

115:                                              ; preds = %113, %79, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %116

116:                                              ; preds = %115, %61, %51, %41, %37, %33, %26, %22
  %117 = load i32, ptr %6, align 4
  ret i32 %117
}

; 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

declare i32 @ippsHashMessage_rmf(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #3

declare i32 @cpFromOctStr_BNU(ptr noundef, ptr noundef, i32 noundef) #3

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

declare ptr @cpGFpSet(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; 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 = { "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 #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_cpGFp", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!14, !10, i64 0}
!14 = !{!"_cpGFpElement", !10, i64 0, !10, i64 4, !6, i64 8}
!15 = !{!12, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"_gsModEngine", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !18, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104}
!18 = !{!"long long", !7, i64 0}
!19 = !{!14, !10, i64 4}
!20 = !{!17, !10, i64 16}
!21 = !{!22, !10, i64 4}
!22 = !{!"_cpHashMethod_rmf", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!17, !6, i64 48}
!24 = !{!14, !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 i32 @ippsGFpSetElementHash_rmf(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca [64 x i8], align 16
  %7 = alloca [9 x i64], align 16
  %8 = icmp eq ptr %4, null
  br i1 %8, label %53, label %9

9:                                                ; preds = %5
  %10 = icmp slt i32 %1, 0
  br i1 %10, label %53, label %11

11:                                               ; preds = %9
  %12 = icmp ne i32 %1, 0
  %13 = icmp eq ptr %0, null
  %or.cond.not37 = and i1 %13, %12
  %14 = icmp eq ptr %2, null
  %or.cond33 = or i1 %or.cond.not37, %14
  %15 = icmp eq ptr %3, null
  %or.cond34 = or i1 %or.cond33, %15
  br i1 %or.cond34, label %53, label %16

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

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

28:                                               ; preds = %22
  %29 = getelementptr inbounds i8, ptr %3, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %53

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %2, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %30, i64 16
  %37 = load i32, ptr %36, align 8, !tbaa !18
  %.not = icmp eq i32 %35, %37
  br i1 %.not, label %38, label %53

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %7) #4
  %39 = call i32 @ippsHashMessage_rmf(ptr noundef %0, i32 noundef %1, ptr noundef nonnull %6, ptr noundef nonnull %4) #4
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %52

41:                                               ; preds = %38
  %42 = load i32, ptr %36, align 8, !tbaa !18
  %43 = getelementptr inbounds i8, ptr %4, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !19
  %45 = call i32 @cpFromOctStr_BNU(ptr noundef nonnull %7, ptr noundef nonnull %6, i32 noundef %44) #4
  %46 = getelementptr inbounds i8, ptr %30, i64 48
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  %48 = call i32 @cpMod_BNU(ptr noundef nonnull %7, i32 noundef %45, ptr noundef %47, i32 noundef %42)
  %49 = getelementptr inbounds i8, ptr %2, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %51 = call ptr @cpGFpSet(ptr noundef %50, ptr noundef nonnull %7, i32 noundef %48, ptr noundef nonnull %30) #4
  br label %52

52:                                               ; preds = %41, %38
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #4
  br label %53

53:                                               ; preds = %52, %28, %33, %22, %16, %11, %9, %5
  %.1 = phi i32 [ -8, %5 ], [ -15, %9 ], [ -8, %11 ], [ -13, %16 ], [ -13, %22 ], [ %39, %52 ], [ -5, %28 ], [ -11, %33 ]
  ret i32 %.1
}

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

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

declare i32 @ippsHashMessage_rmf(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @cpFromOctStr_BNU(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

declare ptr @cpGFpSet(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 #4 = { 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 = !{!"_cpGFp", !7, i64 0, !7, i64 4, !10, i64 8}
!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 = !{!"_cpGFpElement", !7, i64 0, !7, i64 4, !10, i64 8}
!13 = !{!6, !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 = !{!12, !7, i64 4}
!18 = !{!15, !7, i64 16}
!19 = !{!20, !7, i64 4}
!20 = !{!"_cpHashMethod_rmf", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!21 = !{!15, !10, i64 48}
!22 = !{!12, !10, i64 8}


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