#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*/ brm_create_cmd(unsigned short *, int, int /*<<< orphan*/,
                                  int /*<<< orphan*/, unsigned short,
                                  int /*<<< orphan*/, unsigned short,
                                  int /*<<< orphan*/, int /*<<< orphan*/, int);
void brm_rtbc(unsigned short *addr, unsigned short dp, unsigned short rtaddr,
              unsigned short sa, unsigned short wc, int bus) {
  unsigned short cw = (rtaddr << 11) | (1 << 10) | (sa << 5) | (wc & 0x1F);
  brm_create_cmd(addr, 4, 0, 0, cw, 0, dp, 0, 0, bus);
}


x86 assembly (clang, -O0):
<brm_rtbc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8w,%ax
mov    %rdi,-0x8(%rbp)
mov    %si,-0xa(%rbp)
mov    %dx,-0xc(%rbp)
mov    %cx,-0xe(%rbp)
mov    %ax,-0x10(%rbp)
mov    %r9d,-0x14(%rbp)
movzwl -0xc(%rbp),%eax
shl    $0xb,%eax
or     $0x400,%eax
movzwl -0xe(%rbp),%ecx
shl    $0x5,%ecx
or     %ecx,%eax
movzwl -0x10(%rbp),%ecx
and    $0x1f,%ecx
or     %ecx,%eax
mov    %ax,-0x16(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x16(%rbp),%r8w
mov    -0xa(%rbp),%r10w
mov    -0x14(%rbp),%eax
mov    $0x4,%esi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
movzwl %r8w,%r8d
movzwl %r10w,%r10d
mov    %r10d,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <brm_create_cmd@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brm_rtbc>:
push   %rax
mov    %r9d,%eax
mov    %esi,%r10d
shl    $0xb,%edx
shl    $0x5,%ecx
or     %edx,%ecx
and    $0x1f,%r8d
or     %ecx,%r8d
or     $0x400,%r8d
movzwl %r8w,%r8d
mov    $0x4,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r9d,%r9d
push   %rax
push   $0x0
push   $0x0
push   %r10
call   1030 <brm_create_cmd@plt>
add    $0x20,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @brm_rtbc(i16* %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3, i16 zeroext %4, i32 %5) {
%7 = alloca i16*
%8 = alloca i16
%9 = alloca i16
%10 = alloca i16
%11 = alloca i16
%12 = alloca i32
%13 = alloca i16
store i16* %0, i16** %7
store i16 %1, i16* %8
store i16 %2, i16* %9
store i16 %3, i16* %10
store i16 %4, i16* %11
store i32 %5, i32* %12
%14 = load i16, i16* %9
%15 = zext i16 %14 to i32
%16 = shl i32 %15, 11
%17 = or i32 %16, 1024
%18 = load i16, i16* %10
%19 = zext i16 %18 to i32
%20 = shl i32 %19, 5
%21 = or i32 %17, %20
%22 = load i16, i16* %11
%23 = zext i16 %22 to i32
%24 = and i32 %23, 31
%25 = or i32 %21, %24
%26 = trunc i32 %25 to i16
store i16 %26, i16* %13
%27 = load i16*, i16** %7
%28 = load i16, i16* %13
%29 = load i16, i16* %8
%30 = load i32, i32* %12
%31 = call i32 @brm_create_cmd(i16* %27, i32 4, i32 0, i32 0, i16 zeroext %28, i32 0, i16 zeroext %29, i32 0, i32 0, i32 %30)
ret void
}

LLVM IR (-O2):
define void @brm_rtbc(i16* %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3, i16 zeroext %4, i32 %5) {
%7 = shl i16 %2, 11
%8 = shl i16 %3, 5
%9 = and i16 %4, 31
%10 = or i16 %7, %8
%11 = or i16 %10, %9
%12 = or i16 %11, 1024
%13 = tail call i32 @brm_create_cmd(i16* %0, i32 4, i32 0, i32 0, i16 zeroext %12, i32 0, i16 zeroext %1, i32 0, i32 0, i32 %5)
ret void
}