; LLVM IR from sca-secure-library-sca25519/sca25519 :: cw/sca25519_cw_st/crypto/scalarmult (scalarmult_25519)

; 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.point25519 = type { ptr, ptr, ptr }
%union.UN_256bitValue_ = type { [4 x %union.UN_64bitValue_] }
%union.UN_64bitValue_ = type { [1 x i64] }
%union.UN_512bitValue_ = type { [8 x i64] }

@Rx = external hidden global { [32 x i8] }, align 8
@Ry = external hidden global { [32 x i8] }, align 8
@Rz = external hidden global { <{ i8, [31 x i8] }> }, align 8
@Sx = external hidden global { [32 x i8] }, align 8
@Sy = external hidden global { [32 x i8] }, align 8
@Sz = external hidden global { <{ i8, [31 x i8] }> }, align 8
@static_key = external hidden global { [32 x i8] }, align 8
@blindingFactor = external hidden global { <{ [8 x i8], [24 x i8] }> }, align 8

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

; Function Attrs: nounwind uwtable
define dso_local void @update_static_key_curve25519() #1 {
  %1 = alloca %struct.point25519, align 8
  %2 = alloca %struct.point25519, align 8
  %3 = alloca %struct.point25519, align 8
  %4 = alloca %struct.point25519, align 8
  %5 = alloca %union.UN_256bitValue_, align 8
  %6 = alloca %union.UN_256bitValue_, align 8
  %7 = alloca %union.UN_256bitValue_, align 8
  %8 = alloca %union.UN_256bitValue_, align 8
  %9 = alloca %union.UN_256bitValue_, align 8
  %10 = alloca %union.UN_256bitValue_, align 8
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca %union.UN_256bitValue_, align 8
  %14 = alloca %union.UN_256bitValue_, align 8
  %15 = alloca %union.UN_256bitValue_, align 8
  %16 = alloca %union.UN_256bitValue_, align 8
  %17 = alloca %union.UN_512bitValue_, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #3
  %18 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 0
  store ptr @Rx, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 1
  store ptr @Ry, ptr %19, align 8, !tbaa !10
  %20 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 2
  store ptr @Rz, ptr %20, align 8, !tbaa !11
  %21 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 0
  store ptr @Sx, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 1
  store ptr @Sy, ptr %22, align 8, !tbaa !10
  %23 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 2
  store ptr @Sz, ptr %23, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #3
  %24 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 0
  store ptr %5, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 1
  store ptr %6, ptr %25, align 8, !tbaa !10
  %26 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 2
  store ptr %7, ptr %26, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 0
  store ptr %8, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 1
  store ptr %9, ptr %28, align 8, !tbaa !10
  %29 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 2
  store ptr %10, ptr %29, align 8, !tbaa !11
  %30 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  call void @fe25519_cpy(ptr noundef %31, ptr noundef %33)
  %34 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !10
  %36 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !10
  call void @fe25519_cpy(ptr noundef %35, ptr noundef %37)
  %38 = getelementptr inbounds %struct.point25519, ptr %3, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %struct.point25519, ptr %1, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  call void @fe25519_cpy(ptr noundef %39, ptr noundef %41)
  %42 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  call void @fe25519_cpy(ptr noundef %43, ptr noundef %45)
  %46 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !10
  %48 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !10
  call void @fe25519_cpy(ptr noundef %47, ptr noundef %49)
  %50 = getelementptr inbounds %struct.point25519, ptr %4, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %struct.point25519, ptr %2, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  call void @fe25519_cpy(ptr noundef %51, ptr noundef %53)
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  call void @randombytes(ptr noundef %11, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #3
  store i8 7, ptr %12, align 1, !tbaa !12
  br label %54

54:                                               ; preds = %67, %0
  %55 = load i8, ptr %12, align 1, !tbaa !12
  %56 = sext i8 %55 to i32
  %57 = icmp sge i32 %56, 0
  br i1 %57, label %58, label %70

58:                                               ; preds = %54
  call void @curve25519_doublePoint(ptr noundef %1, ptr noundef %1)
  call void @curve25519_doublePoint(ptr noundef %2, ptr noundef %2)
  %59 = load i8, ptr %11, align 1, !tbaa !12
  %60 = zext i8 %59 to i32
  %61 = load i8, ptr %12, align 1, !tbaa !12
  %62 = sext i8 %61 to i32
  %63 = shl i32 1, %62
  %64 = and i32 %60, %63
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %58
  call void @curve25519_addPoint(ptr noundef %1, ptr noundef %1, ptr noundef %3)
  call void @curve25519_addPoint(ptr noundef %2, ptr noundef %2, ptr noundef %4)
  br label %67

67:                                               ; preds = %66, %58
  %68 = load i8, ptr %12, align 1, !tbaa !12
  %69 = add i8 %68, -1
  store i8 %69, ptr %12, align 1, !tbaa !12
  br label %54, !llvm.loop !13

70:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #3
  call void @fe25519_setzero(ptr noundef %13)
  br label %71

71:                                               ; preds = %73, %70
  %72 = getelementptr inbounds [32 x i8], ptr %13, i64 0, i64 0
  call void @randombytes(ptr noundef %72, i64 noundef 8)
  br label %73

73:                                               ; preds = %71
  %74 = getelementptr inbounds [4 x %union.UN_64bitValue_], ptr %13, i64 0, i64 0
  %75 = getelementptr inbounds [1 x i64], ptr %74, i64 0, i64 0
  %76 = load i64, ptr %75, align 8, !tbaa !12
  %77 = icmp ne i64 %76, 0
  %78 = xor i1 %77, true
  br i1 %78, label %71, label %79, !llvm.loop !15

79:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr %17) #3
  %80 = getelementptr inbounds [64 x i8], ptr %17, i64 0, i64 0
  call void @randombytes(ptr noundef %80, i64 noundef 64)
  call void @fe25519_reduceTo256Bits_asm(ptr noundef %16, ptr noundef %17)
  call void @sc25519_mul(ptr noundef %15, ptr noundef %13, ptr noundef %16)
  call void @sc25519_inverse(ptr noundef %15, ptr noundef %15)
  call void @sc25519_mul(ptr noundef %14, ptr noundef %15, ptr noundef %16)
  call void @sc25519_mul(ptr noundef @static_key, ptr noundef @static_key, ptr noundef %14)
  call void @sc25519_mul(ptr noundef @static_key, ptr noundef @static_key, ptr noundef @blindingFactor)
  call void @cpy_256bitvalue(ptr noundef @blindingFactor, ptr noundef %13)
  call void @llvm.lifetime.end.p0(i64 64, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %1) #3
  ret void
}

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

declare void @fe25519_cpy(ptr noundef, ptr noundef) #2

declare void @randombytes(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @curve25519_doublePoint(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @curve25519_addPoint(ptr noundef, ptr noundef, ptr noundef) #1

declare void @fe25519_setzero(ptr noundef) #2

declare void @fe25519_reduceTo256Bits_asm(ptr noundef, ptr noundef) #2

declare void @sc25519_mul(ptr noundef, ptr noundef, ptr noundef) #2

declare void @sc25519_inverse(ptr noundef, ptr noundef) #2

declare void @cpy_256bitvalue(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

%struct.point25519 = type { ptr, ptr, ptr }
%union.UN_256bitValue_ = type { [4 x %union.UN_64bitValue_] }
%union.UN_64bitValue_ = type { [1 x i64] }
%union.UN_512bitValue_ = type { [8 x i64] }

@Rx = external hidden global { [32 x i8] }, align 8
@Ry = external hidden global { [32 x i8] }, align 8
@Rz = external hidden global { <{ i8, [31 x i8] }> }, align 8
@Sx = external hidden global { [32 x i8] }, align 8
@Sy = external hidden global { [32 x i8] }, align 8
@Sz = external hidden global { <{ i8, [31 x i8] }> }, align 8
@static_key = external hidden global { [32 x i8] }, align 8
@blindingFactor = external hidden global { <{ [8 x i8], [24 x i8] }> }, align 8

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

; Function Attrs: nounwind uwtable
define dso_local void @update_static_key_curve25519() local_unnamed_addr #1 {
  %1 = alloca %struct.point25519, align 8
  %2 = alloca %struct.point25519, align 8
  %3 = alloca %struct.point25519, align 8
  %4 = alloca %struct.point25519, align 8
  %5 = alloca %union.UN_256bitValue_, align 8
  %6 = alloca %union.UN_256bitValue_, align 8
  %7 = alloca %union.UN_256bitValue_, align 8
  %8 = alloca %union.UN_256bitValue_, align 8
  %9 = alloca %union.UN_256bitValue_, align 8
  %10 = alloca %union.UN_256bitValue_, align 8
  %11 = alloca i8, align 1
  %12 = alloca %union.UN_256bitValue_, align 8
  %13 = alloca %union.UN_256bitValue_, align 8
  %14 = alloca %union.UN_256bitValue_, align 8
  %15 = alloca %union.UN_256bitValue_, align 8
  %16 = alloca %union.UN_512bitValue_, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #3
  store ptr @Rx, ptr %1, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr @Ry, ptr %17, align 8, !tbaa !10
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr @Rz, ptr %18, align 8, !tbaa !11
  store ptr @Sx, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @Sy, ptr %19, align 8, !tbaa !10
  %20 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @Sz, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #3
  store ptr %5, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %6, ptr %21, align 8, !tbaa !10
  %22 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %7, ptr %22, align 8, !tbaa !11
  store ptr %8, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %9, ptr %23, align 8, !tbaa !10
  %24 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %10, ptr %24, align 8, !tbaa !11
  call void @fe25519_cpy(ptr noundef nonnull %5, ptr noundef nonnull @Rx) #3
  call void @fe25519_cpy(ptr noundef nonnull %6, ptr noundef nonnull @Ry) #3
  call void @fe25519_cpy(ptr noundef nonnull %7, ptr noundef nonnull @Rz) #3
  call void @fe25519_cpy(ptr noundef nonnull %8, ptr noundef nonnull @Sx) #3
  call void @fe25519_cpy(ptr noundef nonnull %9, ptr noundef nonnull @Sy) #3
  call void @fe25519_cpy(ptr noundef nonnull %10, ptr noundef nonnull @Sz) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #3
  call void @randombytes(ptr noundef nonnull %11, i64 noundef 1) #3
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %25 = load i8, ptr %11, align 1, !tbaa !12
  %.not4 = icmp sgt i8 %25, -1
  br i1 %.not4, label %27, label %26

26:                                               ; preds = %0
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %27

27:                                               ; preds = %26, %0
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %28 = load i8, ptr %11, align 1, !tbaa !12
  %29 = and i8 %28, 64
  %.not4.1 = icmp eq i8 %29, 0
  br i1 %.not4.1, label %31, label %30

30:                                               ; preds = %27
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %31

31:                                               ; preds = %30, %27
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %32 = load i8, ptr %11, align 1, !tbaa !12
  %33 = and i8 %32, 32
  %.not4.2 = icmp eq i8 %33, 0
  br i1 %.not4.2, label %35, label %34

34:                                               ; preds = %31
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %35

35:                                               ; preds = %34, %31
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %36 = load i8, ptr %11, align 1, !tbaa !12
  %37 = and i8 %36, 16
  %.not4.3 = icmp eq i8 %37, 0
  br i1 %.not4.3, label %39, label %38

38:                                               ; preds = %35
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %39

39:                                               ; preds = %38, %35
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %40 = load i8, ptr %11, align 1, !tbaa !12
  %41 = and i8 %40, 8
  %.not4.4 = icmp eq i8 %41, 0
  br i1 %.not4.4, label %43, label %42

42:                                               ; preds = %39
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %43

43:                                               ; preds = %42, %39
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %44 = load i8, ptr %11, align 1, !tbaa !12
  %45 = and i8 %44, 4
  %.not4.5 = icmp eq i8 %45, 0
  br i1 %.not4.5, label %47, label %46

46:                                               ; preds = %43
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %47

47:                                               ; preds = %46, %43
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %48 = load i8, ptr %11, align 1, !tbaa !12
  %49 = and i8 %48, 2
  %.not4.6 = icmp eq i8 %49, 0
  br i1 %.not4.6, label %51, label %50

50:                                               ; preds = %47
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %51

51:                                               ; preds = %50, %47
  call void @curve25519_doublePoint(ptr noundef nonnull %1, ptr noundef nonnull %1)
  call void @curve25519_doublePoint(ptr noundef nonnull %2, ptr noundef nonnull %2)
  %52 = load i8, ptr %11, align 1, !tbaa !12
  %53 = and i8 %52, 1
  %.not4.7 = icmp eq i8 %53, 0
  br i1 %.not4.7, label %55, label %54

54:                                               ; preds = %51
  call void @curve25519_addPoint(ptr noundef nonnull %1, ptr noundef nonnull %1, ptr noundef nonnull %3)
  call void @curve25519_addPoint(ptr noundef nonnull %2, ptr noundef nonnull %2, ptr noundef nonnull %4)
  br label %55

55:                                               ; preds = %54, %51
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #3
  call void @fe25519_setzero(ptr noundef nonnull %12) #3
  br label %56

56:                                               ; preds = %56, %55
  call void @randombytes(ptr noundef nonnull %12, i64 noundef 8) #3
  %57 = load i64, ptr %12, align 8, !tbaa !12
  %.not = icmp eq i64 %57, 0
  br i1 %.not, label %56, label %58, !llvm.loop !13

58:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %15) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %16) #3
  call void @randombytes(ptr noundef nonnull %16, i64 noundef 64) #3
  call void @fe25519_reduceTo256Bits_asm(ptr noundef nonnull %15, ptr noundef nonnull %16) #3
  call void @sc25519_mul(ptr noundef nonnull %14, ptr noundef nonnull %12, ptr noundef nonnull %15) #3
  call void @sc25519_inverse(ptr noundef nonnull %14, ptr noundef nonnull %14) #3
  call void @sc25519_mul(ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull %15) #3
  call void @sc25519_mul(ptr noundef nonnull @static_key, ptr noundef nonnull @static_key, ptr noundef nonnull %13) #3
  call void @sc25519_mul(ptr noundef nonnull @static_key, ptr noundef nonnull @static_key, ptr noundef nonnull @blindingFactor) #3
  call void @cpy_256bitvalue(ptr noundef nonnull @blindingFactor, ptr noundef nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %16) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #3
  ret void
}

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

declare void @fe25519_cpy(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @randombytes(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @curve25519_doublePoint(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @curve25519_addPoint(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @fe25519_setzero(ptr noundef) local_unnamed_addr #2

declare void @fe25519_reduceTo256Bits_asm(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @sc25519_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @sc25519_inverse(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @cpy_256bitvalue(ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass