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

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

@Hacl_Hash_Blake2s_ivTable_B = external hidden constant [8 x i64], align 16

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Hash_Blake2b_init(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, 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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %21, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds i64, ptr %22, i64 4
  store ptr %23, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %24, i64 8
  store ptr %25, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds i64, ptr %26, i64 12
  store ptr %27, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %28 = load i64, ptr @Hacl_Hash_Blake2s_ivTable_B, align 16, !tbaa !11
  store i64 %28, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %29 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 1), align 8, !tbaa !11
  store i64 %29, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %30 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 2), align 16, !tbaa !11
  store i64 %30, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %31 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 3), align 8, !tbaa !11
  store i64 %31, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %32 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 4), align 16, !tbaa !11
  store i64 %32, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  %33 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 5), align 8, !tbaa !11
  store i64 %33, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #2
  %34 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 6), align 16, !tbaa !11
  store i64 %34, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %35 = load i64, ptr getelementptr inbounds ([8 x i64], ptr @Hacl_Hash_Blake2s_ivTable_B, i64 0, i64 7), align 8, !tbaa !11
  store i64 %35, ptr %18, align 8, !tbaa !11
  %36 = load i64, ptr %11, align 8, !tbaa !11
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds i64, ptr %37, i64 0
  store i64 %36, ptr %38, align 8, !tbaa !11
  %39 = load i64, ptr %12, align 8, !tbaa !11
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds i64, ptr %40, i64 1
  store i64 %39, ptr %41, align 8, !tbaa !11
  %42 = load i64, ptr %13, align 8, !tbaa !11
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = getelementptr inbounds i64, ptr %43, i64 2
  store i64 %42, ptr %44, align 8, !tbaa !11
  %45 = load i64, ptr %14, align 8, !tbaa !11
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds i64, ptr %46, i64 3
  store i64 %45, ptr %47, align 8, !tbaa !11
  %48 = load i64, ptr %15, align 8, !tbaa !11
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds i64, ptr %49, i64 0
  store i64 %48, ptr %50, align 8, !tbaa !11
  %51 = load i64, ptr %16, align 8, !tbaa !11
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds i64, ptr %52, i64 1
  store i64 %51, ptr %53, align 8, !tbaa !11
  %54 = load i64, ptr %17, align 8, !tbaa !11
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds i64, ptr %55, i64 2
  store i64 %54, ptr %56, align 8, !tbaa !11
  %57 = load i64, ptr %18, align 8, !tbaa !11
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds i64, ptr %58, i64 3
  store i64 %57, ptr %59, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  %60 = load i32, ptr %5, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = shl i64 %61, 8
  store i64 %62, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #2
  %63 = load i64, ptr %11, align 8, !tbaa !11
  %64 = load i64, ptr %19, align 8, !tbaa !11
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = xor i64 %64, %66
  %68 = xor i64 16842752, %67
  %69 = xor i64 %63, %68
  store i64 %69, ptr %20, align 8, !tbaa !11
  %70 = load i64, ptr %20, align 8, !tbaa !11
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds i64, ptr %71, i64 0
  store i64 %70, ptr %72, align 8, !tbaa !11
  %73 = load i64, ptr %12, align 8, !tbaa !11
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds i64, ptr %74, i64 1
  store i64 %73, ptr %75, align 8, !tbaa !11
  %76 = load i64, ptr %13, align 8, !tbaa !11
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds i64, ptr %77, i64 2
  store i64 %76, ptr %78, align 8, !tbaa !11
  %79 = load i64, ptr %14, align 8, !tbaa !11
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds i64, ptr %80, i64 3
  store i64 %79, ptr %81, align 8, !tbaa !11
  %82 = load i64, ptr %15, align 8, !tbaa !11
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds i64, ptr %83, i64 0
  store i64 %82, ptr %84, align 8, !tbaa !11
  %85 = load i64, ptr %16, align 8, !tbaa !11
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds i64, ptr %86, i64 1
  store i64 %85, ptr %87, align 8, !tbaa !11
  %88 = load i64, ptr %17, align 8, !tbaa !11
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds i64, ptr %89, i64 2
  store i64 %88, ptr %90, align 8, !tbaa !11
  %91 = load i64, ptr %18, align 8, !tbaa !11
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds i64, ptr %92, i64 3
  store i64 %91, ptr %93, align 8, !tbaa !11
  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
  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 = !{!"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"

@Hacl_Hash_Blake2s_ivTable_B = external hidden local_unnamed_addr constant [8 x i64], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @Hacl_Hash_Blake2b_init(ptr nocapture noundef writeonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = load i64, ptr @Hacl_Hash_Blake2s_ivTable_B, align 16, !tbaa !5
  %8 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 8), align 8, !tbaa !5
  %9 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 16), align 16, !tbaa !5
  %10 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 24), align 8, !tbaa !5
  %11 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 32), align 16, !tbaa !5
  %12 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 40), align 8, !tbaa !5
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 48), align 16, !tbaa !5
  %14 = load i64, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_Blake2s_ivTable_B, i64 56), align 8, !tbaa !5
  store i64 %7, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %8, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  store i64 %9, ptr %16, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 88
  store i64 %10, ptr %17, align 8, !tbaa !5
  store i64 %11, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  store i64 %12, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 112
  store i64 %13, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  store i64 %14, ptr %20, align 8, !tbaa !5
  %21 = zext i32 %1 to i64
  %22 = shl nuw nsw i64 %21, 8
  %23 = xor i32 %2, 16842752
  %24 = zext i32 %23 to i64
  %25 = xor i64 %22, %24
  %26 = xor i64 %25, %7
  store i64 %26, ptr %0, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %8, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 %9, ptr %28, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %10, ptr %29, align 8, !tbaa !5
  store i64 %11, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %12, ptr %30, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 %13, ptr %31, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 56
  store i64 %14, ptr %32, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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