; LLVM IR from square/subzero :: core/trezor-crypto/ed25519-donna (curve25519-donna-scalarmult-base)

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

; Function Attrs: nounwind uwtable
define dso_local void @curve25519_scalarmult_donna(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [10 x i32], align 16
  %8 = alloca [10 x i32], align 16
  %9 = alloca [10 x i32], align 16
  %10 = alloca [10 x i32], align 16
  %11 = alloca [10 x i32], align 16
  %12 = alloca [10 x i32], align 16
  %13 = alloca [10 x i32], align 16
  %14 = alloca [10 x i32], align 16
  %15 = alloca [10 x i32], align 16
  %16 = alloca [10 x i32], align 16
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #4
  call void @llvm.memset.p0.i64(ptr align 16 %7, i8 0, i64 40, i1 false)
  %20 = getelementptr inbounds <{ i32, [9 x i32] }>, ptr %7, i32 0, i32 0
  store i32 1, ptr %20, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #4
  call void @llvm.memset.p0.i64(ptr align 16 %8, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #4
  call void @llvm.memset.p0.i64(ptr align 16 %9, i8 0, i64 40, i1 false)
  %21 = getelementptr inbounds <{ i32, [9 x i32] }>, ptr %9, i32 0, i32 0
  store i32 1, ptr %21, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %22 = getelementptr inbounds [10 x i32], ptr %11, i64 0, i64 0
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  call void @curve25519_expand(ptr noundef %22, ptr noundef %23)
  %24 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %25 = getelementptr inbounds [10 x i32], ptr %11, i64 0, i64 0
  call void @curve25519_copy(ptr noundef %24, ptr noundef %25)
  store i64 1, ptr %18, align 8, !tbaa !9
  store i32 253, ptr %19, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %104, %3
  %27 = load i32, ptr %19, align 4, !tbaa !11
  %28 = icmp sge i32 %27, 2
  br i1 %28, label %29, label %107

29:                                               ; preds = %26
  %30 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %31 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %32 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_add(ptr noundef %30, ptr noundef %31, ptr noundef %32)
  %33 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %34 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %35 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %33, ptr noundef %34, ptr noundef %35)
  %36 = getelementptr inbounds [10 x i32], ptr %13, i64 0, i64 0
  %37 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %38 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_add(ptr noundef %36, ptr noundef %37, ptr noundef %38)
  %39 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %40 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %41 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %39, ptr noundef %40, ptr noundef %41)
  %42 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %43 = getelementptr inbounds [10 x i32], ptr %13, i64 0, i64 0
  %44 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %42, ptr noundef %43, ptr noundef %44)
  %45 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %46 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %47 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %45, ptr noundef %46, ptr noundef %47)
  %48 = getelementptr inbounds [10 x i32], ptr %14, i64 0, i64 0
  %49 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %50 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_add(ptr noundef %48, ptr noundef %49, ptr noundef %50)
  %51 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %52 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %53 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %51, ptr noundef %52, ptr noundef %53)
  %54 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %55 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  call void @curve25519_square(ptr noundef %54, ptr noundef %55)
  %56 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %57 = getelementptr inbounds [10 x i32], ptr %14, i64 0, i64 0
  call void @curve25519_square(ptr noundef %56, ptr noundef %57)
  %58 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %59 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %60 = getelementptr inbounds [10 x i32], ptr %11, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %58, ptr noundef %59, ptr noundef %60)
  %61 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %62 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  call void @curve25519_square(ptr noundef %61, ptr noundef %62)
  %63 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %64 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_square(ptr noundef %63, ptr noundef %64)
  %65 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %66 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %67 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %65, ptr noundef %66, ptr noundef %67)
  %68 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %69 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %70 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %68, ptr noundef %69, ptr noundef %70)
  %71 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %72 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_scalar_product(ptr noundef %71, ptr noundef %72, i32 noundef 121665)
  %73 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %74 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %75 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  call void @curve25519_add(ptr noundef %73, ptr noundef %74, ptr noundef %75)
  %76 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %77 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %78 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %76, ptr noundef %77, ptr noundef %78)
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %19, align 4, !tbaa !11
  %81 = sdiv i32 %80, 8
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %79, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !13
  %85 = zext i8 %84 to i32
  %86 = load i32, ptr %19, align 4, !tbaa !11
  %87 = and i32 %86, 7
  %88 = ashr i32 %85, %87
  %89 = and i32 %88, 1
  %90 = sext i32 %89 to i64
  store i64 %90, ptr %17, align 8, !tbaa !9
  %91 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %92 = getelementptr inbounds [10 x i32], ptr %7, i64 0, i64 0
  %93 = load i64, ptr %17, align 8, !tbaa !9
  %94 = load i64, ptr %18, align 8, !tbaa !9
  %95 = xor i64 %93, %94
  %96 = trunc i64 %95 to i32
  call void @curve25519_swap_conditional(ptr noundef %91, ptr noundef %92, i32 noundef %96)
  %97 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %98 = getelementptr inbounds [10 x i32], ptr %8, i64 0, i64 0
  %99 = load i64, ptr %17, align 8, !tbaa !9
  %100 = load i64, ptr %18, align 8, !tbaa !9
  %101 = xor i64 %99, %100
  %102 = trunc i64 %101 to i32
  call void @curve25519_swap_conditional(ptr noundef %97, ptr noundef %98, i32 noundef %102)
  %103 = load i64, ptr %17, align 8, !tbaa !9
  store i64 %103, ptr %18, align 8, !tbaa !9
  br label %104

104:                                              ; preds = %29
  %105 = load i32, ptr %19, align 4, !tbaa !11
  %106 = add nsw i32 %105, -1
  store i32 %106, ptr %19, align 4, !tbaa !11
  br label %26, !llvm.loop !14

107:                                              ; preds = %26
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %108

108:                                              ; preds = %136, %107
  %109 = load i32, ptr %19, align 4, !tbaa !11
  %110 = icmp slt i32 %109, 3
  br i1 %110, label %111, label %139

111:                                              ; preds = %108
  %112 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %113 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %114 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_add(ptr noundef %112, ptr noundef %113, ptr noundef %114)
  %115 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %116 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %117 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %115, ptr noundef %116, ptr noundef %117)
  %118 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %119 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  call void @curve25519_square(ptr noundef %118, ptr noundef %119)
  %120 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %121 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_square(ptr noundef %120, ptr noundef %121)
  %122 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %123 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %124 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %122, ptr noundef %123, ptr noundef %124)
  %125 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %126 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  %127 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_sub(ptr noundef %125, ptr noundef %126, ptr noundef %127)
  %128 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %129 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_scalar_product(ptr noundef %128, ptr noundef %129, i32 noundef 121665)
  %130 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %131 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  %132 = getelementptr inbounds [10 x i32], ptr %12, i64 0, i64 0
  call void @curve25519_add(ptr noundef %130, ptr noundef %131, ptr noundef %132)
  %133 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %134 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %135 = getelementptr inbounds [10 x i32], ptr %15, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %133, ptr noundef %134, ptr noundef %135)
  br label %136

136:                                              ; preds = %111
  %137 = load i32, ptr %19, align 4, !tbaa !11
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %19, align 4, !tbaa !11
  br label %108, !llvm.loop !16

139:                                              ; preds = %108
  %140 = getelementptr inbounds [10 x i32], ptr %16, i64 0, i64 0
  %141 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_recip(ptr noundef %140, ptr noundef %141)
  %142 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  %143 = getelementptr inbounds [10 x i32], ptr %10, i64 0, i64 0
  %144 = getelementptr inbounds [10 x i32], ptr %16, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %142, ptr noundef %143, ptr noundef %144)
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds [10 x i32], ptr %9, i64 0, i64 0
  call void @curve25519_contract(ptr noundef %145, ptr noundef %146)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #4
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @curve25519_expand(ptr noundef, ptr noundef) #3

declare void @curve25519_copy(ptr noundef, ptr noundef) #3

declare void @curve25519_add(ptr noundef, ptr noundef, ptr noundef) #3

declare void @curve25519_sub(ptr noundef, ptr noundef, ptr noundef) #3

declare void @curve25519_mul(ptr noundef, ptr noundef, ptr noundef) #3

declare void @curve25519_square(ptr noundef, ptr noundef) #3

declare void @curve25519_scalar_product(ptr noundef, ptr noundef, i32 noundef) #3

declare void @curve25519_swap_conditional(ptr noundef, ptr noundef, i32 noundef) #3

declare void @curve25519_recip(ptr noundef, ptr noundef) #3

declare void @curve25519_contract(ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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 void @curve25519_scalarmult_donna(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [10 x i32], align 16
  %5 = alloca [10 x i32], align 16
  %6 = alloca [10 x i32], align 16
  %7 = alloca [10 x i32], align 16
  %8 = alloca [10 x i32], align 16
  %9 = alloca [10 x i32], align 16
  %10 = alloca [10 x i32], align 16
  %11 = alloca [10 x i32], align 16
  %12 = alloca [10 x i32], align 16
  %13 = alloca [10 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %4, i8 0, i64 40, i1 false)
  store i32 1, ptr %4, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %5, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %6, i8 0, i64 40, i1 false)
  store i32 1, ptr %6, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %13) #4
  call void @curve25519_expand(ptr noundef nonnull %8, ptr noundef %2) #4
  call void @curve25519_copy(ptr noundef nonnull %7, ptr noundef nonnull %8) #4
  br label %14

14:                                               ; preds = %3, %14
  %.015 = phi i32 [ 253, %3 ], [ %24, %14 ]
  %.01314 = phi i32 [ 1, %3 ], [ %22, %14 ]
  call void @curve25519_add(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_add(ptr noundef nonnull %10, ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  call void @curve25519_sub(ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  call void @curve25519_mul(ptr noundef nonnull %4, ptr noundef nonnull %10, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %5, ptr noundef nonnull %9, ptr noundef nonnull %5) #4
  call void @curve25519_add(ptr noundef nonnull %11, ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  call void @curve25519_sub(ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  call void @curve25519_square(ptr noundef nonnull %5, ptr noundef nonnull %5) #4
  call void @curve25519_square(ptr noundef nonnull %4, ptr noundef nonnull %11) #4
  call void @curve25519_mul(ptr noundef nonnull %5, ptr noundef nonnull %5, ptr noundef nonnull %8) #4
  call void @curve25519_square(ptr noundef nonnull %9, ptr noundef nonnull %9) #4
  call void @curve25519_square(ptr noundef nonnull %6, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_scalar_product(ptr noundef nonnull %12, ptr noundef nonnull %6, i32 noundef 121665) #4
  call void @curve25519_add(ptr noundef nonnull %12, ptr noundef nonnull %12, ptr noundef nonnull %9) #4
  call void @curve25519_mul(ptr noundef nonnull %6, ptr noundef nonnull %6, ptr noundef nonnull %12) #4
  %15 = lshr i32 %.015, 3
  %16 = zext nneg i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %1, i64 %16
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = zext i8 %18 to i32
  %20 = and i32 %.015, 7
  %21 = lshr i32 %19, %20
  %22 = and i32 %21, 1
  %23 = xor i32 %22, %.01314
  call void @curve25519_swap_conditional(ptr noundef nonnull %7, ptr noundef nonnull %4, i32 noundef %23) #4
  call void @curve25519_swap_conditional(ptr noundef nonnull %6, ptr noundef nonnull %5, i32 noundef %23) #4
  %24 = add nsw i32 %.015, -1
  %25 = icmp ugt i32 %.015, 2
  br i1 %25, label %14, label %.preheader.preheader, !llvm.loop !8

.preheader.preheader:                             ; preds = %14
  call void @curve25519_add(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_square(ptr noundef nonnull %9, ptr noundef nonnull %9) #4
  call void @curve25519_square(ptr noundef nonnull %6, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_scalar_product(ptr noundef nonnull %12, ptr noundef nonnull %6, i32 noundef 121665) #4
  call void @curve25519_add(ptr noundef nonnull %12, ptr noundef nonnull %12, ptr noundef nonnull %9) #4
  call void @curve25519_mul(ptr noundef nonnull %6, ptr noundef nonnull %6, ptr noundef nonnull %12) #4
  call void @curve25519_add(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_square(ptr noundef nonnull %9, ptr noundef nonnull %9) #4
  call void @curve25519_square(ptr noundef nonnull %6, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_scalar_product(ptr noundef nonnull %12, ptr noundef nonnull %6, i32 noundef 121665) #4
  call void @curve25519_add(ptr noundef nonnull %12, ptr noundef nonnull %12, ptr noundef nonnull %9) #4
  call void @curve25519_mul(ptr noundef nonnull %6, ptr noundef nonnull %6, ptr noundef nonnull %12) #4
  call void @curve25519_add(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  call void @curve25519_square(ptr noundef nonnull %9, ptr noundef nonnull %9) #4
  call void @curve25519_square(ptr noundef nonnull %6, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_sub(ptr noundef nonnull %6, ptr noundef nonnull %9, ptr noundef nonnull %6) #4
  call void @curve25519_scalar_product(ptr noundef nonnull %12, ptr noundef nonnull %6, i32 noundef 121665) #4
  call void @curve25519_add(ptr noundef nonnull %12, ptr noundef nonnull %12, ptr noundef nonnull %9) #4
  call void @curve25519_mul(ptr noundef nonnull %6, ptr noundef nonnull %6, ptr noundef nonnull %12) #4
  call void @curve25519_recip(ptr noundef nonnull %13, ptr noundef nonnull %6) #4
  call void @curve25519_mul(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %13) #4
  call void @curve25519_contract(ptr noundef %0, ptr noundef nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @curve25519_expand(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_copy(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_add(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_sub(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_square(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_scalar_product(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @curve25519_swap_conditional(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @curve25519_recip(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @curve25519_contract(ptr 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) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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