; LLVM IR from cryspen/libcrux :: sys/hacl/c/src (Hacl_Ed25519)

; 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 @Hacl_Bignum25519_reduce_513(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds i64, ptr %26, i64 0
  %28 = load i64, ptr %27, align 8, !tbaa !9
  store i64 %28, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds i64, ptr %29, i64 1
  %31 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %31, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds i64, ptr %32, i64 2
  %34 = load i64, ptr %33, align 8, !tbaa !9
  store i64 %34, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds i64, ptr %35, i64 3
  %37 = load i64, ptr %36, align 8, !tbaa !9
  store i64 %37, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds i64, ptr %38, i64 4
  %40 = load i64, ptr %39, align 8, !tbaa !9
  store i64 %40, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %41 = load i64, ptr %3, align 8, !tbaa !9
  %42 = add i64 %41, 0
  store i64 %42, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %43 = load i64, ptr %8, align 8, !tbaa !9
  %44 = and i64 %43, 2251799813685247
  store i64 %44, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %45 = load i64, ptr %8, align 8, !tbaa !9
  %46 = lshr i64 %45, 51
  store i64 %46, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %47 = load i64, ptr %4, align 8, !tbaa !9
  %48 = load i64, ptr %10, align 8, !tbaa !9
  %49 = add i64 %47, %48
  store i64 %49, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %50 = load i64, ptr %11, align 8, !tbaa !9
  %51 = and i64 %50, 2251799813685247
  store i64 %51, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %52 = load i64, ptr %11, align 8, !tbaa !9
  %53 = lshr i64 %52, 51
  store i64 %53, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %54 = load i64, ptr %5, align 8, !tbaa !9
  %55 = load i64, ptr %13, align 8, !tbaa !9
  %56 = add i64 %54, %55
  store i64 %56, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %57 = load i64, ptr %14, align 8, !tbaa !9
  %58 = and i64 %57, 2251799813685247
  store i64 %58, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  %59 = load i64, ptr %14, align 8, !tbaa !9
  %60 = lshr i64 %59, 51
  store i64 %60, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #2
  %61 = load i64, ptr %6, align 8, !tbaa !9
  %62 = load i64, ptr %16, align 8, !tbaa !9
  %63 = add i64 %61, %62
  store i64 %63, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %64 = load i64, ptr %17, align 8, !tbaa !9
  %65 = and i64 %64, 2251799813685247
  store i64 %65, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  %66 = load i64, ptr %17, align 8, !tbaa !9
  %67 = lshr i64 %66, 51
  store i64 %67, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #2
  %68 = load i64, ptr %7, align 8, !tbaa !9
  %69 = load i64, ptr %19, align 8, !tbaa !9
  %70 = add i64 %68, %69
  store i64 %70, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #2
  %71 = load i64, ptr %20, align 8, !tbaa !9
  %72 = and i64 %71, 2251799813685247
  store i64 %72, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #2
  %73 = load i64, ptr %20, align 8, !tbaa !9
  %74 = lshr i64 %73, 51
  store i64 %74, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #2
  %75 = load i64, ptr %9, align 8, !tbaa !9
  %76 = load i64, ptr %22, align 8, !tbaa !9
  %77 = mul i64 %76, 19
  %78 = add i64 %75, %77
  store i64 %78, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #2
  %79 = load i64, ptr %23, align 8, !tbaa !9
  %80 = and i64 %79, 2251799813685247
  store i64 %80, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #2
  %81 = load i64, ptr %23, align 8, !tbaa !9
  %82 = lshr i64 %81, 51
  store i64 %82, ptr %25, align 8, !tbaa !9
  %83 = load i64, ptr %24, align 8, !tbaa !9
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds i64, ptr %84, i64 0
  store i64 %83, ptr %85, align 8, !tbaa !9
  %86 = load i64, ptr %12, align 8, !tbaa !9
  %87 = load i64, ptr %25, align 8, !tbaa !9
  %88 = add i64 %86, %87
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds i64, ptr %89, i64 1
  store i64 %88, ptr %90, align 8, !tbaa !9
  %91 = load i64, ptr %15, align 8, !tbaa !9
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds i64, ptr %92, i64 2
  store i64 %91, ptr %93, align 8, !tbaa !9
  %94 = load i64, ptr %18, align 8, !tbaa !9
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = getelementptr inbounds i64, ptr %95, i64 3
  store i64 %94, ptr %96, align 8, !tbaa !9
  %97 = load i64, ptr %21, align 8, !tbaa !9
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds i64, ptr %98, i64 4
  store i64 %97, ptr %99, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  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 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 = { 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}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @Hacl_Bignum25519_reduce_513(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load i64, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load i64, ptr %9, align 8, !tbaa !5
  %11 = and i64 %2, 2251799813685247
  %12 = lshr i64 %2, 51
  %13 = add i64 %4, %12
  %14 = and i64 %13, 2251799813685247
  %15 = lshr i64 %13, 51
  %16 = add i64 %15, %6
  %17 = and i64 %16, 2251799813685247
  %18 = lshr i64 %16, 51
  %19 = add i64 %18, %8
  %20 = and i64 %19, 2251799813685247
  %21 = lshr i64 %19, 51
  %22 = add i64 %21, %10
  %23 = and i64 %22, 2251799813685247
  %24 = lshr i64 %22, 51
  %25 = mul nuw nsw i64 %24, 19
  %26 = add nuw nsw i64 %25, %11
  %27 = and i64 %26, 2251799813685247
  %28 = lshr i64 %26, 51
  store i64 %27, ptr %0, align 8, !tbaa !5
  %29 = add nuw nsw i64 %28, %14
  store i64 %29, ptr %3, align 8, !tbaa !5
  store i64 %17, ptr %5, align 8, !tbaa !5
  store i64 %20, ptr %7, align 8, !tbaa !5
  store i64 %23, ptr %9, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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