; LLVM IR from albertobsd/keyhunt :: hash/sha256.ll (Z9sha256_65PhS_)

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

@_ZL11sizedesc_65 = external hidden constant [8 x i8], align 1
@_ZN7_sha256L3padE = external hidden constant <{ i8, [63 x i8] }>, align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7_sha25610InitializeEPj(ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7_sha2569TransformEPjPKh(ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.bswap.i32(i32) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; 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) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9sha256_65PhS_(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [8 x i32], align 16
  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) #5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 65
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %7, ptr align 16 @_ZN7_sha256L3padE, i64 55, i1 false)
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 120
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 @_ZL11sizedesc_65, i64 8, i1 false)
  %10 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 0
  call void @_ZN7_sha25610InitializeEPj(ptr noundef %10)
  %11 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 0
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN7_sha2569TransformEPjPKh(ptr noundef %11, ptr noundef %12)
  %13 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 0
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 64
  call void @_ZN7_sha2569TransformEPjPKh(ptr noundef %13, ptr noundef %15)
  %16 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 0
  %17 = load i32, ptr %16, align 16, !tbaa !9
  %18 = call i32 @llvm.bswap.i32(i32 %17)
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %18, ptr %19, align 4, !tbaa !9
  %20 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 1
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = call i32 @llvm.bswap.i32(i32 %21)
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  store i32 %22, ptr %24, align 4, !tbaa !9
  %25 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 2
  %26 = load i32, ptr %25, align 8, !tbaa !9
  %27 = call i32 @llvm.bswap.i32(i32 %26)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  store i32 %27, ptr %29, align 4, !tbaa !9
  %30 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 3
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = call i32 @llvm.bswap.i32(i32 %31)
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 12
  store i32 %32, ptr %34, align 4, !tbaa !9
  %35 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 4
  %36 = load i32, ptr %35, align 16, !tbaa !9
  %37 = call i32 @llvm.bswap.i32(i32 %36)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store i32 %37, ptr %39, align 4, !tbaa !9
  %40 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 5
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = call i32 @llvm.bswap.i32(i32 %41)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 20
  store i32 %42, ptr %44, align 4, !tbaa !9
  %45 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 6
  %46 = load i32, ptr %45, align 8, !tbaa !9
  %47 = call i32 @llvm.bswap.i32(i32 %46)
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 24
  store i32 %47, ptr %49, align 4, !tbaa !9
  %50 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 7
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = call i32 @llvm.bswap.i32(i32 %51)
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 28
  store i32 %52, ptr %54, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  ret void
}

attributes #0 = { mustprogress 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 = { mustprogress 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple 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"

@_ZL11sizedesc_65 = external hidden local_unnamed_addr constant [8 x i8], align 1
@_ZN7_sha256L3padE = external hidden local_unnamed_addr constant <{ i8, [63 x i8] }>, align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7_sha25610InitializeEPj(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7_sha2569TransformEPjPKh(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; 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) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9sha256_65PhS_(ptr noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  %3 = alloca [8 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  %4 = getelementptr inbounds i8, ptr %0, i64 65
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(55) %4, ptr noundef nonnull align 16 dereferenceable(55) @_ZN7_sha256L3padE, i64 55, i1 false)
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  %6 = load i64, ptr @_ZL11sizedesc_65, align 1
  store i64 %6, ptr %5, align 1
  call void @_ZN7_sha25610InitializeEPj(ptr noundef nonnull %3)
  call void @_ZN7_sha2569TransformEPjPKh(ptr noundef nonnull %3, ptr noundef %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  call void @_ZN7_sha2569TransformEPjPKh(ptr noundef nonnull %3, ptr noundef nonnull %7)
  %8 = load <4 x i32>, ptr %3, align 16, !tbaa !5
  %9 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %8)
  store <4 x i32> %9, ptr %1, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = load <4 x i32>, ptr %10, align 16, !tbaa !5
  %13 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %12)
  store <4 x i32> %13, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>) #4

attributes #0 = { mustprogress 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 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass