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

; 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_SHA2_h224 = external hidden constant [8 x i32], 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
define dso_local void @Hacl_Hash_SHA2_sha224_init(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %21, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !9
  store i32 %25, ptr %5, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr %27, i64 %29
  store i32 %26, ptr %30, align 4, !tbaa !9
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = add i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !9
  %33 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %34, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  %35 = load i32, ptr %3, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !9
  store i32 %38, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %40, i64 %42
  store i32 %39, ptr %43, align 4, !tbaa !9
  %44 = load i32, ptr %3, align 4, !tbaa !9
  %45 = add i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !9
  %46 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %47, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !9
  store i32 %51, ptr %9, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  store i32 %52, ptr %56, align 4, !tbaa !9
  %57 = load i32, ptr %3, align 4, !tbaa !9
  %58 = add i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !9
  %59 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %60, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  %61 = load i32, ptr %3, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  store i32 %64, ptr %11, align 4, !tbaa !9
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %66, i64 %68
  store i32 %65, ptr %69, align 4, !tbaa !9
  %70 = load i32, ptr %3, align 4, !tbaa !9
  %71 = add i32 %70, 1
  store i32 %71, ptr %3, align 4, !tbaa !9
  %72 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %73, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  %74 = load i32, ptr %3, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !9
  store i32 %77, ptr %13, align 4, !tbaa !9
  %78 = load i32, ptr %13, align 4, !tbaa !9
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = load i32, ptr %3, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  store i32 %78, ptr %82, align 4, !tbaa !9
  %83 = load i32, ptr %3, align 4, !tbaa !9
  %84 = add i32 %83, 1
  store i32 %84, ptr %3, align 4, !tbaa !9
  %85 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %86, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #2
  %87 = load i32, ptr %3, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  store i32 %90, ptr %15, align 4, !tbaa !9
  %91 = load i32, ptr %15, align 4, !tbaa !9
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = load i32, ptr %3, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds i32, ptr %92, i64 %94
  store i32 %91, ptr %95, align 4, !tbaa !9
  %96 = load i32, ptr %3, align 4, !tbaa !9
  %97 = add i32 %96, 1
  store i32 %97, ptr %3, align 4, !tbaa !9
  %98 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %99, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #2
  %100 = load i32, ptr %3, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !9
  store i32 %103, ptr %17, align 4, !tbaa !9
  %104 = load i32, ptr %17, align 4, !tbaa !9
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = load i32, ptr %3, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %105, i64 %107
  store i32 %104, ptr %108, align 4, !tbaa !9
  %109 = load i32, ptr %3, align 4, !tbaa !9
  %110 = add i32 %109, 1
  store i32 %110, ptr %3, align 4, !tbaa !9
  %111 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %112, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #2
  %113 = load i32, ptr %3, align 4, !tbaa !9
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds [8 x i32], ptr @Hacl_Hash_SHA2_h224, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !9
  store i32 %116, ptr %19, align 4, !tbaa !9
  %117 = load i32, ptr %19, align 4, !tbaa !9
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = load i32, ptr %3, align 4, !tbaa !9
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %118, i64 %120
  store i32 %117, ptr %121, align 4, !tbaa !9
  %122 = load i32, ptr %3, align 4, !tbaa !9
  %123 = add i32 %122, 1
  store i32 %123, ptr %3, align 4, !tbaa !9
  %124 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  br label %125

125:                                              ; preds = %20
  ret void
}

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 = { 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}


; 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_SHA2_h224 = external hidden local_unnamed_addr constant [8 x i32], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @Hacl_Hash_SHA2_sha224_init(ptr nocapture noundef writeonly %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @Hacl_Hash_SHA2_h224, align 16, !tbaa !5
  store i32 %2, ptr %0, align 4, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 4), align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %3, ptr %4, align 4, !tbaa !5
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 8), align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %5, ptr %6, align 4, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 12), align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %7, ptr %8, align 4, !tbaa !5
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 16), align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %9, ptr %10, align 4, !tbaa !5
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 20), align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %11, ptr %12, align 4, !tbaa !5
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 24), align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %13, ptr %14, align 4, !tbaa !5
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @Hacl_Hash_SHA2_h224, i64 28), align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %15, ptr %16, align 4, !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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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