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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4gem56ArmISA6Crypto16aesInvMixColumnsEPhS2_(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %1, ptr noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %87, %3
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 4
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  br label %90

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %83, %19
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = icmp slt i32 %21, 4
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  br label %86

24:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = mul nsw i32 %25, 4
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = add nsw i32 %26, %27
  store i32 %28, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = mul nsw i32 %29, 4
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  %33 = srem i32 %32, 4
  %34 = add nsw i32 %30, %33
  store i32 %34, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = mul nsw i32 %35, 4
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = add nsw i32 %37, 2
  %39 = srem i32 %38, 4
  %40 = add nsw i32 %36, %39
  store i32 %40, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = mul nsw i32 %41, 4
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = add nsw i32 %43, 3
  %45 = srem i32 %44, 4
  %46 = add nsw i32 %42, %45
  store i32 %46, ptr %13, align 4, !tbaa !9
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %47, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %14, i8 noundef zeroext 14, i8 noundef zeroext %51)
  %53 = zext i8 %52 to i32
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i8, ptr %54, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %14, i8 noundef zeroext 11, i8 noundef zeroext %58)
  %60 = zext i8 %59 to i32
  %61 = xor i32 %53, %60
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %62, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %14, i8 noundef zeroext 13, i8 noundef zeroext %66)
  %68 = zext i8 %67 to i32
  %69 = xor i32 %61, %68
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load i32, ptr %13, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %70, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %14, i8 noundef zeroext 9, i8 noundef zeroext %74)
  %76 = zext i8 %75 to i32
  %77 = xor i32 %69, %76
  %78 = trunc i32 %77 to i8
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  store i8 %78, ptr %82, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  br label %83

83:                                               ; preds = %24
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %9, align 4, !tbaa !9
  br label %20, !llvm.loop !12

86:                                               ; preds = %23
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %7, align 4, !tbaa !9
  br label %15, !llvm.loop !14

90:                                               ; preds = %18
  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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4gem56ArmISA6Crypto16aesInvMixColumnsEPhS2_(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 align 2 {
  br label %.preheader

.preheader:                                       ; preds = %3, %.preheader
  %indvars.iv = phi i64 [ 0, %3 ], [ %indvars.iv.next, %.preheader ]
  %4 = shl nuw nsw i64 %indvars.iv, 2
  %5 = or disjoint i64 %4, 1
  %6 = or disjoint i64 %4, 3
  %7 = getelementptr inbounds i8, ptr %2, i64 %4
  %8 = load i8, ptr %7, align 1, !tbaa !5
  %9 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 14, i8 noundef zeroext %8)
  %10 = getelementptr inbounds i8, ptr %2, i64 %5
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 11, i8 noundef zeroext %11)
  %13 = xor i8 %12, %9
  %14 = and i64 %4, 4294967292
  %15 = or disjoint i64 %14, 2
  %16 = getelementptr inbounds i8, ptr %2, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 13, i8 noundef zeroext %17)
  %19 = xor i8 %13, %18
  %20 = getelementptr inbounds i8, ptr %2, i64 %6
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 9, i8 noundef zeroext %21)
  %23 = xor i8 %19, %22
  %24 = getelementptr inbounds i8, ptr %1, i64 %4
  store i8 %23, ptr %24, align 1, !tbaa !5
  %25 = or disjoint i64 %4, 2
  %26 = load i8, ptr %10, align 1, !tbaa !5
  %27 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 14, i8 noundef zeroext %26)
  %28 = getelementptr inbounds i8, ptr %2, i64 %25
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 11, i8 noundef zeroext %29)
  %31 = xor i8 %30, %27
  %32 = and i64 %4, 4294967292
  %33 = or disjoint i64 %32, 3
  %34 = getelementptr inbounds i8, ptr %2, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 13, i8 noundef zeroext %35)
  %37 = xor i8 %31, %36
  %38 = load i8, ptr %7, align 1, !tbaa !5
  %39 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 9, i8 noundef zeroext %38)
  %40 = xor i8 %37, %39
  %41 = getelementptr inbounds i8, ptr %1, i64 %5
  store i8 %40, ptr %41, align 1, !tbaa !5
  %42 = load i8, ptr %28, align 1, !tbaa !5
  %43 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 14, i8 noundef zeroext %42)
  %44 = load i8, ptr %20, align 1, !tbaa !5
  %45 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 11, i8 noundef zeroext %44)
  %46 = xor i8 %45, %43
  %47 = and i64 %4, 4294967292
  %48 = getelementptr inbounds i8, ptr %2, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !5
  %50 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 13, i8 noundef zeroext %49)
  %51 = xor i8 %46, %50
  %52 = load i8, ptr %10, align 1, !tbaa !5
  %53 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 9, i8 noundef zeroext %52)
  %54 = xor i8 %51, %53
  %55 = getelementptr inbounds i8, ptr %1, i64 %25
  store i8 %54, ptr %55, align 1, !tbaa !5
  %56 = and i64 %6, 4294967293
  %57 = load i8, ptr %20, align 1, !tbaa !5
  %58 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 14, i8 noundef zeroext %57)
  %59 = load i8, ptr %7, align 1, !tbaa !5
  %60 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 11, i8 noundef zeroext %59)
  %61 = xor i8 %60, %58
  %62 = getelementptr inbounds i8, ptr %2, i64 %56
  %63 = load i8, ptr %62, align 1, !tbaa !5
  %64 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 13, i8 noundef zeroext %63)
  %65 = xor i8 %61, %64
  %66 = load i8, ptr %28, align 1, !tbaa !5
  %67 = tail call noundef zeroext i8 @_ZN4gem56ArmISA6Crypto8aesFFMulEhh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext 9, i8 noundef zeroext %66)
  %68 = xor i8 %65, %67
  %69 = getelementptr inbounds i8, ptr %1, i64 %6
  store i8 %68, ptr %69, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 4
  br i1 %exitcond.not, label %70, label %.preheader, !llvm.loop !8

70:                                               ; preds = %.preheader
  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" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass