; LLVM IR from gem5/gem5 :: src/arch/arm/insts/crypto.ll (ZN4gem56ArmISA6Crypto7sha1Su0EPhS2_S2_)

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZN4gem56ArmISA6Crypto8load3RegEPjS2_S2_PhS3_S3_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4gem56ArmISA6Crypto9store1RegEPhPj(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4gem56ArmISA6Crypto7sha1Su0EPhS2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [4 x i32], align 16
  %10 = alloca [4 x i32], align 16
  %11 = alloca [4 x i32], align 16
  %12 = alloca [4 x i32], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #3
  %14 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 0
  %15 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %16 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN4gem56ArmISA6Crypto8load3RegEPjS2_S2_PhS3_S3_(ptr noundef nonnull align 1 dereferenceable(1) %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18, ptr noundef %19)
  %20 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 1
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 3
  store i32 %21, ptr %22, align 4, !tbaa !9
  %23 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %24 = load i32, ptr %23, align 16, !tbaa !9
  %25 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 2
  store i32 %24, ptr %25, align 8, !tbaa !9
  %26 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 3
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 1
  store i32 %27, ptr %28, align 4, !tbaa !9
  %29 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 2
  %30 = load i32, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 0
  store i32 %30, ptr %31, align 16, !tbaa !9
  %32 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 3
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 3
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = xor i32 %33, %35
  %37 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 3
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = xor i32 %36, %38
  %40 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 3
  store i32 %39, ptr %40, align 4, !tbaa !9
  %41 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 2
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 2
  %44 = load i32, ptr %43, align 8, !tbaa !9
  %45 = xor i32 %42, %44
  %46 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 2
  %47 = load i32, ptr %46, align 8, !tbaa !9
  %48 = xor i32 %45, %47
  %49 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 2
  store i32 %48, ptr %49, align 8, !tbaa !9
  %50 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 1
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 1
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = xor i32 %51, %53
  %55 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 1
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = xor i32 %54, %56
  %58 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 1
  store i32 %57, ptr %58, align 4, !tbaa !9
  %59 = getelementptr inbounds [4 x i32], ptr %12, i64 0, i64 0
  %60 = load i32, ptr %59, align 16, !tbaa !9
  %61 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 0
  %62 = load i32, ptr %61, align 16, !tbaa !9
  %63 = xor i32 %60, %62
  %64 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  %65 = load i32, ptr %64, align 16, !tbaa !9
  %66 = xor i32 %63, %65
  %67 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 0
  store i32 %66, ptr %67, align 16, !tbaa !9
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds [4 x i32], ptr %9, i64 0, i64 0
  call void @_ZN4gem56ArmISA6Crypto9store1RegEPhPj(ptr noundef nonnull align 1 dereferenceable(1) %13, ptr noundef %68, ptr noundef %69)
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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"

; 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 nounwind uwtable
declare dso_local void @_ZN4gem56ArmISA6Crypto8load3RegEPjS2_S2_PhS3_S3_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4gem56ArmISA6Crypto9store1RegEPhPj(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4gem56ArmISA6Crypto7sha1Su0EPhS2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 align 2 {
  %5 = alloca [4 x i32], align 16
  %6 = alloca [4 x i32], align 16
  %7 = alloca [4 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #2
  call void @_ZN4gem56ArmISA6Crypto8load3RegEPjS2_S2_PhS3_S3_(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef %1, ptr noundef %2, ptr noundef %3)
  %8 = load <4 x i32>, ptr %6, align 16
  %9 = getelementptr inbounds i8, ptr %5, i64 8
  %10 = load <4 x i32>, ptr %5, align 16
  %11 = load <2 x i32>, ptr %9, align 8, !tbaa !5
  %12 = shufflevector <2 x i32> %11, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %13 = load <4 x i32>, ptr %7, align 16, !tbaa !5
  %14 = shufflevector <4 x i32> %10, <4 x i32> %8, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
  %15 = xor <4 x i32> %14, %13
  %16 = xor <4 x i32> %15, %12
  store <4 x i32> %16, ptr %5, align 16, !tbaa !5
  call void @_ZN4gem56ArmISA6Crypto9store1RegEPhPj(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %1, ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #2
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,VectorCombinePass