; 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: nounwind uwtable
define dso_local void @Hacl_Bignum25519_load_51(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [4 x i64], align 16
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  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)
  br label %28

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

105:                                              ; preds = %28
  br label %106

106:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  %107 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 3
  %108 = load i64, ptr %107, align 8, !tbaa !11
  store i64 %108, ptr %27, align 8, !tbaa !11
  %109 = load i64, ptr %27, align 8, !tbaa !11
  %110 = and i64 %109, 9223372036854775807
  %111 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 3
  store i64 %110, ptr %111, align 8, !tbaa !11
  %112 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 0
  %113 = load i64, ptr %112, align 16, !tbaa !11
  %114 = and i64 %113, 2251799813685247
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds i64, ptr %115, i64 0
  store i64 %114, ptr %116, align 8, !tbaa !11
  %117 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 0
  %118 = load i64, ptr %117, align 16, !tbaa !11
  %119 = lshr i64 %118, 51
  %120 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 1
  %121 = load i64, ptr %120, align 8, !tbaa !11
  %122 = and i64 %121, 274877906943
  %123 = shl i64 %122, 13
  %124 = or i64 %119, %123
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds i64, ptr %125, i64 1
  store i64 %124, ptr %126, align 8, !tbaa !11
  %127 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 1
  %128 = load i64, ptr %127, align 8, !tbaa !11
  %129 = lshr i64 %128, 38
  %130 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 2
  %131 = load i64, ptr %130, align 16, !tbaa !11
  %132 = and i64 %131, 33554431
  %133 = shl i64 %132, 26
  %134 = or i64 %129, %133
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds i64, ptr %135, i64 2
  store i64 %134, ptr %136, align 8, !tbaa !11
  %137 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 2
  %138 = load i64, ptr %137, align 16, !tbaa !11
  %139 = lshr i64 %138, 25
  %140 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 3
  %141 = load i64, ptr %140, align 8, !tbaa !11
  %142 = and i64 %141, 4095
  %143 = shl i64 %142, 39
  %144 = or i64 %139, %143
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = getelementptr inbounds i64, ptr %145, i64 3
  store i64 %144, ptr %146, align 8, !tbaa !11
  %147 = getelementptr inbounds [4 x i64], ptr %5, i64 0, i64 3
  %148 = load i64, ptr %147, align 8, !tbaa !11
  %149 = lshr i64 %148, 12
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = getelementptr inbounds i64, ptr %150, i64 4
  store i64 %149, ptr %151, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #4
  ret void
}

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @load64(ptr noundef) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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: nounwind uwtable
define dso_local void @Hacl_Bignum25519_load_51(ptr nocapture noundef writeonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i64 @load64(ptr noundef %1)
  %4 = tail call i64 @__uint64_identity(i64 noundef %3)
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = tail call i64 @load64(ptr noundef nonnull %5)
  %7 = tail call i64 @__uint64_identity(i64 noundef %6)
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = tail call i64 @load64(ptr noundef nonnull %8)
  %10 = tail call i64 @__uint64_identity(i64 noundef %9)
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = tail call i64 @load64(ptr noundef nonnull %11)
  %13 = tail call i64 @__uint64_identity(i64 noundef %12)
  %14 = and i64 %4, 2251799813685247
  store i64 %14, ptr %0, align 8, !tbaa !5
  %15 = lshr i64 %4, 51
  %16 = shl i64 %7, 13
  %17 = and i64 %16, 2251799813677056
  %18 = or disjoint i64 %17, %15
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %18, ptr %19, align 8, !tbaa !5
  %20 = lshr i64 %7, 38
  %21 = shl i64 %10, 26
  %22 = and i64 %21, 2251799746576384
  %23 = or disjoint i64 %22, %20
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 %23, ptr %24, align 8, !tbaa !5
  %25 = lshr i64 %10, 25
  %26 = shl i64 %13, 39
  %27 = and i64 %26, 2251250057871360
  %28 = or disjoint i64 %27, %25
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %28, ptr %29, align 8, !tbaa !5
  %30 = lshr i64 %13, 12
  %31 = and i64 %30, 2251799813685247
  %32 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 %31, ptr %32, align 8, !tbaa !5
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @load64(ptr noundef) local_unnamed_addr #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 = { 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" }

!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,SimplifyCFGPass,TailCallElimPass