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

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Hash_SHA3_loadState(i32 noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [200 x i8], align 16
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 200, ptr %7) #5
  call void @llvm.memset.p0.i64(ptr align 16 %7, i8 0, i64 200, i1 false)
  %11 = getelementptr inbounds [200 x i8], ptr %7, i64 0, i64 0
  %12 = load ptr, ptr %5, align 8, !tbaa !9
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = zext i32 %13 to i64
  %15 = mul i64 %14, 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 1 %12, i64 %15, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %40, %3
  %17 = load i32, ptr %8, align 4, !tbaa !5
  %18 = icmp ult i32 %17, 25
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %43

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %21 = getelementptr inbounds [200 x i8], ptr %7, i64 0, i64 0
  %22 = load i32, ptr %8, align 4, !tbaa !5
  %23 = mul i32 %22, 8
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds i8, ptr %21, i64 %24
  %26 = call i64 @load64(ptr noundef %25)
  %27 = call i64 @__uint64_identity(i64 noundef %26)
  store i64 %27, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %28 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %28, ptr %10, align 8, !tbaa !11
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i64, ptr %29, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = load i64, ptr %10, align 8, !tbaa !11
  %35 = xor i64 %33, %34
  %36 = load ptr, ptr %6, align 8, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds i64, ptr %36, i64 %38
  store i64 %35, ptr %39, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %40

40:                                               ; preds = %20
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = add i32 %41, 1
  store i32 %42, ptr %8, align 4, !tbaa !5
  br label %16, !llvm.loop !13

43:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 200, ptr %7) #5
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @load64(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local void @Hacl_Hash_SHA3_loadState(i32 noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef %2) local_unnamed_addr #3 {
  %4 = alloca [200 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %4) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %4, i8 0, i64 200, i1 false)
  %5 = zext i32 %0 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %4, ptr align 1 %1, i64 %5, i1 false)
  %6 = call i64 @load64(ptr noundef nonnull %4)
  %7 = call i64 @__uint64_identity(i64 noundef %6)
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = xor i64 %8, %7
  store i64 %9, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  %11 = call i64 @load64(ptr noundef nonnull %10)
  %12 = call i64 @__uint64_identity(i64 noundef %11)
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  %14 = load i64, ptr %13, align 8, !tbaa !5
  %15 = xor i64 %14, %12
  store i64 %15, ptr %13, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %4, i64 16
  %17 = call i64 @load64(ptr noundef nonnull %16)
  %18 = call i64 @__uint64_identity(i64 noundef %17)
  %19 = getelementptr inbounds i8, ptr %2, i64 16
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = xor i64 %20, %18
  store i64 %21, ptr %19, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %4, i64 24
  %23 = call i64 @load64(ptr noundef nonnull %22)
  %24 = call i64 @__uint64_identity(i64 noundef %23)
  %25 = getelementptr inbounds i8, ptr %2, i64 24
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = xor i64 %26, %24
  store i64 %27, ptr %25, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %4, i64 32
  %29 = call i64 @load64(ptr noundef nonnull %28)
  %30 = call i64 @__uint64_identity(i64 noundef %29)
  %31 = getelementptr inbounds i8, ptr %2, i64 32
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = xor i64 %32, %30
  store i64 %33, ptr %31, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %4, i64 40
  %35 = call i64 @load64(ptr noundef nonnull %34)
  %36 = call i64 @__uint64_identity(i64 noundef %35)
  %37 = getelementptr inbounds i8, ptr %2, i64 40
  %38 = load i64, ptr %37, align 8, !tbaa !5
  %39 = xor i64 %38, %36
  store i64 %39, ptr %37, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %4, i64 48
  %41 = call i64 @load64(ptr noundef nonnull %40)
  %42 = call i64 @__uint64_identity(i64 noundef %41)
  %43 = getelementptr inbounds i8, ptr %2, i64 48
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = xor i64 %44, %42
  store i64 %45, ptr %43, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %4, i64 56
  %47 = call i64 @load64(ptr noundef nonnull %46)
  %48 = call i64 @__uint64_identity(i64 noundef %47)
  %49 = getelementptr inbounds i8, ptr %2, i64 56
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = xor i64 %50, %48
  store i64 %51, ptr %49, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %4, i64 64
  %53 = call i64 @load64(ptr noundef nonnull %52)
  %54 = call i64 @__uint64_identity(i64 noundef %53)
  %55 = getelementptr inbounds i8, ptr %2, i64 64
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = xor i64 %56, %54
  store i64 %57, ptr %55, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %4, i64 72
  %59 = call i64 @load64(ptr noundef nonnull %58)
  %60 = call i64 @__uint64_identity(i64 noundef %59)
  %61 = getelementptr inbounds i8, ptr %2, i64 72
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = xor i64 %62, %60
  store i64 %63, ptr %61, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %4, i64 80
  %65 = call i64 @load64(ptr noundef nonnull %64)
  %66 = call i64 @__uint64_identity(i64 noundef %65)
  %67 = getelementptr inbounds i8, ptr %2, i64 80
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = xor i64 %68, %66
  store i64 %69, ptr %67, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %4, i64 88
  %71 = call i64 @load64(ptr noundef nonnull %70)
  %72 = call i64 @__uint64_identity(i64 noundef %71)
  %73 = getelementptr inbounds i8, ptr %2, i64 88
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = xor i64 %74, %72
  store i64 %75, ptr %73, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %4, i64 96
  %77 = call i64 @load64(ptr noundef nonnull %76)
  %78 = call i64 @__uint64_identity(i64 noundef %77)
  %79 = getelementptr inbounds i8, ptr %2, i64 96
  %80 = load i64, ptr %79, align 8, !tbaa !5
  %81 = xor i64 %80, %78
  store i64 %81, ptr %79, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %4, i64 104
  %83 = call i64 @load64(ptr noundef nonnull %82)
  %84 = call i64 @__uint64_identity(i64 noundef %83)
  %85 = getelementptr inbounds i8, ptr %2, i64 104
  %86 = load i64, ptr %85, align 8, !tbaa !5
  %87 = xor i64 %86, %84
  store i64 %87, ptr %85, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %4, i64 112
  %89 = call i64 @load64(ptr noundef nonnull %88)
  %90 = call i64 @__uint64_identity(i64 noundef %89)
  %91 = getelementptr inbounds i8, ptr %2, i64 112
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = xor i64 %92, %90
  store i64 %93, ptr %91, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %4, i64 120
  %95 = call i64 @load64(ptr noundef nonnull %94)
  %96 = call i64 @__uint64_identity(i64 noundef %95)
  %97 = getelementptr inbounds i8, ptr %2, i64 120
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = xor i64 %98, %96
  store i64 %99, ptr %97, align 8, !tbaa !5
  %100 = getelementptr inbounds i8, ptr %4, i64 128
  %101 = call i64 @load64(ptr noundef nonnull %100)
  %102 = call i64 @__uint64_identity(i64 noundef %101)
  %103 = getelementptr inbounds i8, ptr %2, i64 128
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = xor i64 %104, %102
  store i64 %105, ptr %103, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %4, i64 136
  %107 = call i64 @load64(ptr noundef nonnull %106)
  %108 = call i64 @__uint64_identity(i64 noundef %107)
  %109 = getelementptr inbounds i8, ptr %2, i64 136
  %110 = load i64, ptr %109, align 8, !tbaa !5
  %111 = xor i64 %110, %108
  store i64 %111, ptr %109, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %4, i64 144
  %113 = call i64 @load64(ptr noundef nonnull %112)
  %114 = call i64 @__uint64_identity(i64 noundef %113)
  %115 = getelementptr inbounds i8, ptr %2, i64 144
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = xor i64 %116, %114
  store i64 %117, ptr %115, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %4, i64 152
  %119 = call i64 @load64(ptr noundef nonnull %118)
  %120 = call i64 @__uint64_identity(i64 noundef %119)
  %121 = getelementptr inbounds i8, ptr %2, i64 152
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = xor i64 %122, %120
  store i64 %123, ptr %121, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %4, i64 160
  %125 = call i64 @load64(ptr noundef nonnull %124)
  %126 = call i64 @__uint64_identity(i64 noundef %125)
  %127 = getelementptr inbounds i8, ptr %2, i64 160
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = xor i64 %128, %126
  store i64 %129, ptr %127, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %4, i64 168
  %131 = call i64 @load64(ptr noundef nonnull %130)
  %132 = call i64 @__uint64_identity(i64 noundef %131)
  %133 = getelementptr inbounds i8, ptr %2, i64 168
  %134 = load i64, ptr %133, align 8, !tbaa !5
  %135 = xor i64 %134, %132
  store i64 %135, ptr %133, align 8, !tbaa !5
  %136 = getelementptr inbounds i8, ptr %4, i64 176
  %137 = call i64 @load64(ptr noundef nonnull %136)
  %138 = call i64 @__uint64_identity(i64 noundef %137)
  %139 = getelementptr inbounds i8, ptr %2, i64 176
  %140 = load i64, ptr %139, align 8, !tbaa !5
  %141 = xor i64 %140, %138
  store i64 %141, ptr %139, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %4, i64 184
  %143 = call i64 @load64(ptr noundef nonnull %142)
  %144 = call i64 @__uint64_identity(i64 noundef %143)
  %145 = getelementptr inbounds i8, ptr %2, i64 184
  %146 = load i64, ptr %145, align 8, !tbaa !5
  %147 = xor i64 %146, %144
  store i64 %147, ptr %145, align 8, !tbaa !5
  %148 = getelementptr inbounds i8, ptr %4, i64 192
  %149 = call i64 @load64(ptr noundef nonnull %148)
  %150 = call i64 @__uint64_identity(i64 noundef %149)
  %151 = getelementptr inbounds i8, ptr %2, i64 192
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = xor i64 %152, %150
  store i64 %153, ptr %151, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %4) #5
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @load64(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass