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

; 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_33 = 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_33PhS_(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 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 0
  call void @_ZN7_sha25610InitializeEPj(ptr noundef %6)
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 33
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %8, ptr align 16 @_ZN7_sha256L3padE, i64 23, i1 false)
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 56
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %10, ptr align 1 @_ZL11sizedesc_33, i64 8, i1 false)
  %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 i32, ptr %13, align 16, !tbaa !9
  %15 = call i32 @llvm.bswap.i32(i32 %14)
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %15, ptr %16, align 4, !tbaa !9
  %17 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 1
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = call i32 @llvm.bswap.i32(i32 %18)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  store i32 %19, ptr %21, align 4, !tbaa !9
  %22 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 2
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = call i32 @llvm.bswap.i32(i32 %23)
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  store i32 %24, ptr %26, align 4, !tbaa !9
  %27 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 3
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = call i32 @llvm.bswap.i32(i32 %28)
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 12
  store i32 %29, ptr %31, align 4, !tbaa !9
  %32 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 4
  %33 = load i32, ptr %32, align 16, !tbaa !9
  %34 = call i32 @llvm.bswap.i32(i32 %33)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store i32 %34, ptr %36, align 4, !tbaa !9
  %37 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 5
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = call i32 @llvm.bswap.i32(i32 %38)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 20
  store i32 %39, ptr %41, align 4, !tbaa !9
  %42 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 6
  %43 = load i32, ptr %42, align 8, !tbaa !9
  %44 = call i32 @llvm.bswap.i32(i32 %43)
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 24
  store i32 %44, ptr %46, align 4, !tbaa !9
  %47 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 7
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = call i32 @llvm.bswap.i32(i32 %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %50, i64 28
  store i32 %49, ptr %51, 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_33 = 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_33PhS_(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
  call void @_ZN7_sha25610InitializeEPj(ptr noundef nonnull %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 33
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(23) %4, ptr noundef nonnull align 16 dereferenceable(23) @_ZN7_sha256L3padE, i64 23, i1 false)
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load i64, ptr @_ZL11sizedesc_33, align 1
  store i64 %6, ptr %5, align 1
  call void @_ZN7_sha2569TransformEPjPKh(ptr noundef nonnull %3, ptr noundef %0)
  %7 = load <4 x i32>, ptr %3, align 16, !tbaa !5
  %8 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %7)
  store <4 x i32> %8, ptr %1, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %3, i64 16
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  %11 = load <4 x i32>, ptr %9, align 16, !tbaa !5
  %12 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %11)
  store <4 x i32> %12, ptr %10, 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