; 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: 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @__uint64_identity(i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Bignum25519_store_51(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [4 x i64], align 16
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #4
  call void @llvm.memset.p0.i64(ptr align 16 %5, i8 0, i64 32, i1 false)
  %7 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 0
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  call void @Hacl_Impl_Curve25519_Field51_store_felem(ptr noundef %7, ptr noundef %8)
  br label %9

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = mul i32 %11, 8
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds i8, ptr %10, i64 %13
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 %16
  %18 = load i64, ptr %17, align 8, !tbaa !11
  %19 = call i64 @__uint64_identity(i64 noundef %18)
  call void @store64(ptr noundef %14, i64 noundef %19)
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = add i32 %20, 1
  store i32 %21, ptr %6, align 4, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = mul i32 %24, 8
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %23, i64 %26
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = call i64 @__uint64_identity(i64 noundef %31)
  call void @store64(ptr noundef %27, i64 noundef %32)
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = add i32 %33, 1
  store i32 %34, ptr %6, align 4, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = mul i32 %37, 8
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %36, i64 %39
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !11
  %45 = call i64 @__uint64_identity(i64 noundef %44)
  call void @store64(ptr noundef %40, i64 noundef %45)
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !9
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = mul i32 %50, 8
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %49, i64 %52
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !11
  %58 = call i64 @__uint64_identity(i64 noundef %57)
  call void @store64(ptr noundef %53, i64 noundef %58)
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = add i32 %59, 1
  store i32 %60, ptr %6, align 4, !tbaa !9
  %61 = load i32, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %62

62:                                               ; preds = %9
  br label %63

63:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #4
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @Hacl_Impl_Curve25519_Field51_store_felem(ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @store64(ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 #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, !12, i64 0}
!12 = !{!"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 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @__uint64_identity(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Bignum25519_store_51(ptr noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca [4 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %3, i8 0, i64 32, i1 false)
  call void @Hacl_Impl_Curve25519_Field51_store_felem(ptr noundef nonnull %3, ptr noundef %1)
  %4 = load i64, ptr %3, align 16, !tbaa !5
  %5 = call i64 @__uint64_identity(i64 noundef %4)
  call void @store64(ptr noundef %0, i64 noundef %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = call i64 @__uint64_identity(i64 noundef %8)
  call void @store64(ptr noundef nonnull %6, i64 noundef %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = getelementptr inbounds i8, ptr %3, i64 16
  %12 = load i64, ptr %11, align 16, !tbaa !5
  %13 = call i64 @__uint64_identity(i64 noundef %12)
  call void @store64(ptr noundef nonnull %10, i64 noundef %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = getelementptr inbounds i8, ptr %3, i64 24
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = call i64 @__uint64_identity(i64 noundef %16)
  call void @store64(ptr noundef nonnull %14, i64 noundef %17)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @Hacl_Impl_Curve25519_Field51_store_felem(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @store64(ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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