; LLVM IR from albertobsd/keyhunt :: sha3 (keccak)

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

@keccakf1600.RC = external hidden constant [24 x i64], align 16

; Function Attrs: nounwind uwtable
define dso_local void @keccakf1600(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %4

4:                                                ; preds = %17, %1
  %5 = load i32, ptr %3, align 4, !tbaa !9
  %6 = icmp ult i32 %5, 24
  br i1 %6, label %7, label %20

7:                                                ; preds = %4
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  call void @keccakf1600_round(ptr noundef %8)
  %9 = load i32, ptr %3, align 4, !tbaa !9
  %10 = zext i32 %9 to i64
  %11 = getelementptr inbounds [24 x i64], ptr @keccakf1600.RC, i64 0, i64 %10
  %12 = load i64, ptr %11, align 8, !tbaa !11
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds i64, ptr %13, i64 0
  %15 = load i64, ptr %14, align 8, !tbaa !11
  %16 = xor i64 %15, %12
  store i64 %16, ptr %14, align 8, !tbaa !11
  br label %17

17:                                               ; preds = %7
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = add i32 %18, 1
  store i32 %19, ptr %3, align 4, !tbaa !9
  br label %4, !llvm.loop !13

20:                                               ; preds = %4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #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: nounwind uwtable
declare hidden void @keccakf1600_round(ptr noundef) #0

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

@keccakf1600.RC = external hidden local_unnamed_addr constant [24 x i64], align 16

; Function Attrs: nounwind uwtable
define dso_local void @keccakf1600(ptr noundef %0) local_unnamed_addr #0 {
  tail call void @keccakf1600_round(ptr noundef %0)
  %2 = load i64, ptr @keccakf1600.RC, align 16, !tbaa !5
  %3 = load i64, ptr %0, align 8, !tbaa !5
  %4 = xor i64 %3, %2
  store i64 %4, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %5 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 8), align 8, !tbaa !5
  %6 = load i64, ptr %0, align 8, !tbaa !5
  %7 = xor i64 %6, %5
  store i64 %7, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %8 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 16), align 16, !tbaa !5
  %9 = load i64, ptr %0, align 8, !tbaa !5
  %10 = xor i64 %9, %8
  store i64 %10, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %11 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 24), align 8, !tbaa !5
  %12 = load i64, ptr %0, align 8, !tbaa !5
  %13 = xor i64 %12, %11
  store i64 %13, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %14 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 32), align 16, !tbaa !5
  %15 = load i64, ptr %0, align 8, !tbaa !5
  %16 = xor i64 %15, %14
  store i64 %16, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %17 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 40), align 8, !tbaa !5
  %18 = load i64, ptr %0, align 8, !tbaa !5
  %19 = xor i64 %18, %17
  store i64 %19, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %20 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 48), align 16, !tbaa !5
  %21 = load i64, ptr %0, align 8, !tbaa !5
  %22 = xor i64 %21, %20
  store i64 %22, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 56), align 8, !tbaa !5
  %24 = load i64, ptr %0, align 8, !tbaa !5
  %25 = xor i64 %24, %23
  store i64 %25, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 64), align 16, !tbaa !5
  %27 = load i64, ptr %0, align 8, !tbaa !5
  %28 = xor i64 %27, %26
  store i64 %28, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %29 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 72), align 8, !tbaa !5
  %30 = load i64, ptr %0, align 8, !tbaa !5
  %31 = xor i64 %30, %29
  store i64 %31, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %32 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 80), align 16, !tbaa !5
  %33 = load i64, ptr %0, align 8, !tbaa !5
  %34 = xor i64 %33, %32
  store i64 %34, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %35 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 88), align 8, !tbaa !5
  %36 = load i64, ptr %0, align 8, !tbaa !5
  %37 = xor i64 %36, %35
  store i64 %37, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %38 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 96), align 16, !tbaa !5
  %39 = load i64, ptr %0, align 8, !tbaa !5
  %40 = xor i64 %39, %38
  store i64 %40, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %41 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 104), align 8, !tbaa !5
  %42 = load i64, ptr %0, align 8, !tbaa !5
  %43 = xor i64 %42, %41
  store i64 %43, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %44 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 112), align 16, !tbaa !5
  %45 = load i64, ptr %0, align 8, !tbaa !5
  %46 = xor i64 %45, %44
  store i64 %46, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %47 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 120), align 8, !tbaa !5
  %48 = load i64, ptr %0, align 8, !tbaa !5
  %49 = xor i64 %48, %47
  store i64 %49, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %50 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 128), align 16, !tbaa !5
  %51 = load i64, ptr %0, align 8, !tbaa !5
  %52 = xor i64 %51, %50
  store i64 %52, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef %0)
  %53 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 136), align 8, !tbaa !5
  %54 = load i64, ptr %0, align 8, !tbaa !5
  %55 = xor i64 %54, %53
  store i64 %55, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %56 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 144), align 16, !tbaa !5
  %57 = load i64, ptr %0, align 8, !tbaa !5
  %58 = xor i64 %57, %56
  store i64 %58, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %59 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 152), align 8, !tbaa !5
  %60 = load i64, ptr %0, align 8, !tbaa !5
  %61 = xor i64 %60, %59
  store i64 %61, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %62 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 160), align 16, !tbaa !5
  %63 = load i64, ptr %0, align 8, !tbaa !5
  %64 = xor i64 %63, %62
  store i64 %64, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %65 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 168), align 8, !tbaa !5
  %66 = load i64, ptr %0, align 8, !tbaa !5
  %67 = xor i64 %66, %65
  store i64 %67, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %68 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 176), align 16, !tbaa !5
  %69 = load i64, ptr %0, align 8, !tbaa !5
  %70 = xor i64 %69, %68
  store i64 %70, ptr %0, align 8, !tbaa !5
  tail call void @keccakf1600_round(ptr noundef nonnull %0)
  %71 = load i64, ptr getelementptr inbounds (i8, ptr @keccakf1600.RC, i64 184), align 8, !tbaa !5
  %72 = load i64, ptr %0, align 8, !tbaa !5
  %73 = xor i64 %72, %71
  store i64 %73, ptr %0, align 8, !tbaa !5
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @keccakf1600_round(ptr noundef) local_unnamed_addr #0

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

!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,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass