#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ RotMxMultiply(int *, int const *, int const *);
void RotateCBMxR(const int *RMx, const int *InvRMx, int *CBMxR, int *InvCBMxR) {
  int i, BufMx[9];
  RotMxMultiply(BufMx, RMx, CBMxR);
  for (i = 0; i < 9; i++)
    CBMxR[i] = BufMx[i];
  RotMxMultiply(BufMx, InvCBMxR, InvRMx);
  for (i = 0; i < 9; i++)
    InvCBMxR[i] = BufMx[i];
}


x86 assembly (clang, -O0):
<RotateCBMxR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <RotMxMultiply@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x9,-0x24(%rbp)
jge    116b <RotateCBMxR+0x5b>
movslq -0x24(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1140 <RotateCBMxR+0x30>
lea    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <RotMxMultiply@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x9,-0x24(%rbp)
jge    11ae <RotateCBMxR+0x9e>
movslq -0x24(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1183 <RotateCBMxR+0x73>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RotateCBMxR>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rsi
mov    %rsp,%r12
mov    %r12,%rdi
call   1030 <RotMxMultiply@plt>
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movups %xmm0,(%rbx)
movups %xmm1,0x10(%rbx)
mov    0x20(%rsp),%eax
mov    %eax,0x20(%rbx)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <RotMxMultiply@plt>
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movups %xmm0,(%r14)
movups %xmm1,0x10(%r14)
mov    0x20(%rsp),%eax
mov    %eax,0x20(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @RotateCBMxR(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca [9 x i32]
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %10, i64 0, i64 0
%12 = load i32*, i32** %5
%13 = load i32*, i32** %7
%14 = call i32 @RotMxMultiply(i32* %11, i32* %12, i32* %13)
store i32 0, i32* %9
br label %15
15: ; preds = %27, %4
%16 = load i32, i32* %9
%17 = icmp slt i32 %16, 9
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [9 x i32], [9 x i32]* %10, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = load i32*, i32** %7
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
br label %27
27: ; preds = %18
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %9
br label %15
30: ; preds = %15
%31 = getelementptr inbounds [9 x i32], [9 x i32]* %10, i64 0, i64 0
%32 = load i32*, i32** %8
%33 = load i32*, i32** %6
%34 = call i32 @RotMxMultiply(i32* %31, i32* %32, i32* %33)
store i32 0, i32* %9
br label %35
35: ; preds = %47, %30
%36 = load i32, i32* %9
%37 = icmp slt i32 %36, 9
br i1 %37, label %38, label %50
38: ; preds = %35
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [9 x i32], [9 x i32]* %10, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32*, i32** %8
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
store i32 %42, i32* %46
br label %47
47: ; preds = %38
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %35
50: ; preds = %35
ret void
}

LLVM IR (-O2):
define void @RotateCBMxR(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = alloca [9 x i32]
%8 = bitcast [9 x i32]* %7 to i8*
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %7, i64 0, i64 0
%10 = call i32 @RotMxMultiply(i32* %9, i32* %0, i32* %2)
%11 = call i32 @RotMxMultiply(i32* %9, i32* %3, i32* %1)
ret void
}