; LLVM IR from square/subzero :: core/trezor-crypto/ed25519-donna (ed25519-donna-impl-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"

%struct.ge25519_niels_t = type { [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_pniels_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_p1p1_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }

@ge25519_niels_sliding_multiples = external constant [32 x %struct.ge25519_niels_t], align 16

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_nielsadd2_p1p1(ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_pnielsadd_p1p1(ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_set_neutral(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @ge25519_double_scalarmult_vartime(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [256 x i8], align 16
  %10 = alloca [256 x i8], align 16
  %11 = alloca [8 x %struct.ge25519_pniels_t], align 16
  %12 = alloca %struct.ge25519_t, align 4
  %13 = alloca %struct.ge25519_p1p1_t, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 256, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 256, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 1280, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 160, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 160, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @memzero(ptr noundef %13, i64 noundef 160)
  %15 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 0
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  call void @contract256_slidingwindow_modm(ptr noundef %15, ptr noundef %16, i32 noundef 5)
  %17 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  call void @contract256_slidingwindow_modm(ptr noundef %17, ptr noundef %18, i32 noundef 7)
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ge25519_double(ptr noundef %12, ptr noundef %19)
  %20 = getelementptr inbounds [8 x %struct.ge25519_pniels_t], ptr %11, i64 0, i64 0
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ge25519_full_to_pniels(ptr noundef %20, ptr noundef %21)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %33, %4
  %23 = load i32, ptr %14, align 4, !tbaa !9
  %24 = icmp slt i32 %23, 7
  br i1 %24, label %25, label %36

25:                                               ; preds = %22
  %26 = load i32, ptr %14, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [8 x %struct.ge25519_pniels_t], ptr %11, i64 0, i64 %28
  %30 = load i32, ptr %14, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [8 x %struct.ge25519_pniels_t], ptr %11, i64 0, i64 %31
  call void @ge25519_pnielsadd(ptr noundef %29, ptr noundef %12, ptr noundef %32)
  br label %33

33:                                               ; preds = %25
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %14, align 4, !tbaa !9
  br label %22, !llvm.loop !11

36:                                               ; preds = %22
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ge25519_set_neutral(ptr noundef %37)
  store i32 255, ptr %14, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %57, %36
  %39 = load i32, ptr %14, align 4, !tbaa !9
  %40 = icmp sge i32 %39, 0
  br i1 %40, label %41, label %55

41:                                               ; preds = %38
  %42 = load i32, ptr %14, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !13
  %46 = sext i8 %45 to i32
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !13
  %51 = sext i8 %50 to i32
  %52 = or i32 %46, %51
  %53 = icmp ne i32 %52, 0
  %54 = xor i1 %53, true
  br label %55

55:                                               ; preds = %41, %38
  %56 = phi i1 [ false, %38 ], [ %54, %41 ]
  br i1 %56, label %57, label %60

57:                                               ; preds = %55
  %58 = load i32, ptr %14, align 4, !tbaa !9
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %14, align 4, !tbaa !9
  br label %38, !llvm.loop !14

60:                                               ; preds = %55
  br label %61

61:                                               ; preds = %117, %60
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = icmp sge i32 %62, 0
  br i1 %63, label %64, label %120

64:                                               ; preds = %61
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ge25519_double_p1p1(ptr noundef %13, ptr noundef %65)
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !13
  %70 = icmp ne i8 %69, 0
  br i1 %70, label %71, label %90

71:                                               ; preds = %64
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ge25519_p1p1_to_full(ptr noundef %72, ptr noundef %13)
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load i32, ptr %14, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !13
  %78 = sext i8 %77 to i32
  %79 = call i32 @llvm.abs.i32(i32 %78, i1 true)
  %80 = sdiv i32 %79, 2
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [8 x %struct.ge25519_pniels_t], ptr %11, i64 0, i64 %81
  %83 = load i32, ptr %14, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [256 x i8], ptr %9, i64 0, i64 %84
  %86 = load i8, ptr %85, align 1, !tbaa !13
  %87 = zext i8 %86 to i32
  %88 = ashr i32 %87, 7
  %89 = trunc i32 %88 to i8
  call void @ge25519_pnielsadd_p1p1(ptr noundef %13, ptr noundef %73, ptr noundef %82, i8 noundef zeroext %89)
  br label %90

90:                                               ; preds = %71, %64
  %91 = load i32, ptr %14, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !13
  %95 = icmp ne i8 %94, 0
  br i1 %95, label %96, label %115

96:                                               ; preds = %90
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ge25519_p1p1_to_full(ptr noundef %97, ptr noundef %13)
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %14, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %100
  %102 = load i8, ptr %101, align 1, !tbaa !13
  %103 = sext i8 %102 to i32
  %104 = call i32 @llvm.abs.i32(i32 %103, i1 true)
  %105 = sdiv i32 %104, 2
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [32 x %struct.ge25519_niels_t], ptr @ge25519_niels_sliding_multiples, i64 0, i64 %106
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %109
  %111 = load i8, ptr %110, align 1, !tbaa !13
  %112 = zext i8 %111 to i32
  %113 = ashr i32 %112, 7
  %114 = trunc i32 %113 to i8
  call void @ge25519_nielsadd2_p1p1(ptr noundef %13, ptr noundef %98, ptr noundef %107, i8 noundef zeroext %114)
  br label %115

115:                                              ; preds = %96, %90
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ge25519_p1p1_to_partial(ptr noundef %116, ptr noundef %13)
  br label %117

117:                                              ; preds = %115
  %118 = load i32, ptr %14, align 4, !tbaa !9
  %119 = add nsw i32 %118, -1
  store i32 %119, ptr %14, align 4, !tbaa !9
  br label %61, !llvm.loop !15

120:                                              ; preds = %61
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ge25519_t, ptr %121, i32 0, i32 3
  %123 = getelementptr inbounds [10 x i32], ptr %122, i64 0, i64 0
  %124 = getelementptr inbounds %struct.ge25519_p1p1_t, ptr %13, i32 0, i32 0
  %125 = getelementptr inbounds [10 x i32], ptr %124, i64 0, i64 0
  %126 = getelementptr inbounds %struct.ge25519_p1p1_t, ptr %13, i32 0, i32 1
  %127 = getelementptr inbounds [10 x i32], ptr %126, i64 0, i64 0
  call void @curve25519_mul(ptr noundef %123, ptr noundef %125, ptr noundef %127)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 1280, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr %9) #4
  ret void
}

declare void @contract256_slidingwindow_modm(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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.ge25519_niels_t = type { [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_pniels_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }
%struct.ge25519_p1p1_t = type { [10 x i32], [10 x i32], [10 x i32], [10 x i32] }

@ge25519_niels_sliding_multiples = external constant [32 x %struct.ge25519_niels_t], align 16

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_nielsadd2_p1p1(ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_pnielsadd_p1p1(ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ge25519_set_neutral(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @ge25519_double_scalarmult_vartime(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca [256 x i8], align 16
  %6 = alloca [256 x i8], align 16
  %7 = alloca [8 x %struct.ge25519_pniels_t], align 16
  %8 = alloca %struct.ge25519_t, align 4
  %9 = alloca %struct.ge25519_p1p1_t, align 4
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 1280, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %9) #4
  call void @memzero(ptr noundef nonnull %9, i64 noundef 160) #4
  call void @contract256_slidingwindow_modm(ptr noundef nonnull %5, ptr noundef %2, i32 noundef 5) #4
  call void @contract256_slidingwindow_modm(ptr noundef nonnull %6, ptr noundef %3, i32 noundef 7) #4
  call void @ge25519_double(ptr noundef nonnull %8, ptr noundef %1)
  call void @ge25519_full_to_pniels(ptr noundef nonnull %7, ptr noundef %1)
  %10 = getelementptr inbounds i8, ptr %7, i64 160
  call void @ge25519_pnielsadd(ptr noundef nonnull %10, ptr noundef nonnull %8, ptr noundef nonnull %7)
  %11 = getelementptr inbounds i8, ptr %7, i64 320
  call void @ge25519_pnielsadd(ptr noundef nonnull %11, ptr noundef nonnull %8, ptr noundef nonnull %10)
  %12 = getelementptr inbounds i8, ptr %7, i64 480
  call void @ge25519_pnielsadd(ptr noundef nonnull %12, ptr noundef nonnull %8, ptr noundef nonnull %11)
  %13 = getelementptr inbounds i8, ptr %7, i64 640
  call void @ge25519_pnielsadd(ptr noundef nonnull %13, ptr noundef nonnull %8, ptr noundef nonnull %12)
  %14 = getelementptr inbounds i8, ptr %7, i64 800
  call void @ge25519_pnielsadd(ptr noundef nonnull %14, ptr noundef nonnull %8, ptr noundef nonnull %13)
  %15 = getelementptr inbounds i8, ptr %7, i64 960
  call void @ge25519_pnielsadd(ptr noundef nonnull %15, ptr noundef nonnull %8, ptr noundef nonnull %14)
  %16 = getelementptr inbounds i8, ptr %7, i64 1120
  call void @ge25519_pnielsadd(ptr noundef nonnull %16, ptr noundef nonnull %8, ptr noundef nonnull %15)
  call void @ge25519_set_neutral(ptr noundef %0)
  br label %17

17:                                               ; preds = %48, %4
  %.130 = phi i32 [ 255, %4 ], [ %49, %48 ]
  %18 = zext nneg i32 %.130 to i64
  %19 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 %18
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = or i8 %22, %20
  %.not = icmp eq i8 %23, 0
  br i1 %.not, label %24, label %.critedge

24:                                               ; preds = %17
  %25 = add nsw i32 %.130, -1
  %26 = zext nneg i32 %25 to i64
  %27 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %29 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 %26
  %30 = load i8, ptr %29, align 1, !tbaa !5
  %31 = or i8 %30, %28
  %.not.1 = icmp eq i8 %31, 0
  br i1 %.not.1, label %32, label %.critedge

32:                                               ; preds = %24
  %33 = add nsw i32 %.130, -2
  %34 = zext nneg i32 %33 to i64
  %35 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !5
  %37 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 %34
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = or i8 %38, %36
  %.not.2 = icmp eq i8 %39, 0
  br i1 %.not.2, label %40, label %.critedge

40:                                               ; preds = %32
  %41 = add nsw i32 %.130, -3
  %42 = zext nneg i32 %41 to i64
  %43 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !5
  %45 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 %42
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = or i8 %46, %44
  %.not.3 = icmp eq i8 %47, 0
  br i1 %.not.3, label %48, label %.critedge

48:                                               ; preds = %40
  %49 = add nsw i32 %.130, -4
  %.not34.3 = icmp eq i32 %41, 0
  br i1 %.not34.3, label %._crit_edge, label %17, !llvm.loop !8

.critedge:                                        ; preds = %40, %32, %24, %17
  %.130.lcssa = phi i32 [ %.130, %17 ], [ %25, %24 ], [ %33, %32 ], [ %41, %40 ]
  %50 = icmp sgt i32 %.130.lcssa, -1
  br i1 %50, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.critedge
  %51 = zext nneg i32 %.130.lcssa to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %71
  %indvars.iv = phi i64 [ %51, %.lr.ph.preheader ], [ %indvars.iv.next, %71 ]
  call void @ge25519_double_p1p1(ptr noundef nonnull %9, ptr noundef %0)
  %52 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %indvars.iv
  %53 = load i8, ptr %52, align 1, !tbaa !5
  %.not27 = icmp eq i8 %53, 0
  br i1 %.not27, label %61, label %54

54:                                               ; preds = %.lr.ph
  call void @ge25519_p1p1_to_full(ptr noundef %0, ptr noundef nonnull %9)
  %55 = load i8, ptr %52, align 1, !tbaa !5
  %56 = call i8 @llvm.abs.i8(i8 %55, i1 false)
  %57 = lshr i8 %56, 1
  %58 = zext nneg i8 %57 to i64
  %59 = getelementptr inbounds [8 x %struct.ge25519_pniels_t], ptr %7, i64 0, i64 %58
  %60 = lshr i8 %55, 7
  call void @ge25519_pnielsadd_p1p1(ptr noundef nonnull %9, ptr noundef %0, ptr noundef nonnull %59, i8 noundef zeroext %60)
  br label %61

61:                                               ; preds = %54, %.lr.ph
  %62 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 %indvars.iv
  %63 = load i8, ptr %62, align 1, !tbaa !5
  %.not28 = icmp eq i8 %63, 0
  br i1 %.not28, label %71, label %64

64:                                               ; preds = %61
  call void @ge25519_p1p1_to_full(ptr noundef %0, ptr noundef nonnull %9)
  %65 = load i8, ptr %62, align 1, !tbaa !5
  %66 = call i8 @llvm.abs.i8(i8 %65, i1 false)
  %67 = lshr i8 %66, 1
  %68 = zext nneg i8 %67 to i64
  %69 = getelementptr inbounds [32 x %struct.ge25519_niels_t], ptr @ge25519_niels_sliding_multiples, i64 0, i64 %68
  %70 = lshr i8 %65, 7
  call void @ge25519_nielsadd2_p1p1(ptr noundef nonnull %9, ptr noundef %0, ptr noundef nonnull %69, i8 noundef zeroext %70)
  br label %71

71:                                               ; preds = %64, %61
  call void @ge25519_p1p1_to_partial(ptr noundef %0, ptr noundef nonnull %9)
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %72 = icmp sgt i64 %indvars.iv, 0
  br i1 %72, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %48, %71, %.critedge
  %73 = getelementptr inbounds i8, ptr %0, i64 120
  %74 = getelementptr inbounds i8, ptr %9, i64 40
  call void @curve25519_mul(ptr noundef nonnull %73, ptr noundef nonnull %9, ptr noundef nonnull %74) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 1280, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %5) #4
  ret void
}

declare void @contract256_slidingwindow_modm(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.abs.i8(i8, i1 immarg) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
!10 = distinct !{!10, !9}


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