#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*/ assert(int);
int /*<<< orphan*/ emit_u(int);
void emit_arith_reg(unsigned opcode, unsigned flg, unsigned ra, unsigned rb,
                    unsigned rd, unsigned cond) {
  assert((opcode & ~0x7U) == 0);
  assert((flg & ~0x1U) == 0);
  emit_u(0x04000000U | (opcode << 28) | (flg << 27) | (ra << 12) | (rb << 8) |
         (rd << 4) | cond);
}


x86 assembly (clang, -O0):
<emit_arith_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffff8,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
and    $0xfffffffe,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
shl    $0x1c,%edi
or     $0x4000000,%edi
mov    -0x8(%rbp),%eax
shl    $0x1b,%eax
or     %eax,%edi
mov    -0xc(%rbp),%eax
shl    $0xc,%eax
or     %eax,%edi
mov    -0x10(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
or     %eax,%edi
or     -0x18(%rbp),%edi
call   1040 <emit_u@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_arith_reg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r12d
mov    %esi,%r15d
mov    %edi,%r13d
xor    %edi,%edi
cmp    $0x8,%r13d
setb   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x2,%r15d
setb   %dil
call   1030 <assert@plt>
shl    $0x1c,%r13d
shl    $0x1b,%r15d
or     %r13d,%r15d
shl    $0xc,%r12d
shl    $0x8,%ebp
or     %r12d,%ebp
or     %r15d,%ebp
shl    $0x4,%ebx
or     %r14d,%ebx
or     %ebp,%ebx
or     $0x4000000,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <emit_u@plt>

LLVM IR (-O0):
define void @emit_arith_reg(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = and i32 %13, -8
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %8
%19 = and i32 %18, -2
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %7
%24 = shl i32 %23, 28
%25 = or i32 67108864, %24
%26 = load i32, i32* %8
%27 = shl i32 %26, 27
%28 = or i32 %25, %27
%29 = load i32, i32* %9
%30 = shl i32 %29, 12
%31 = or i32 %28, %30
%32 = load i32, i32* %10
%33 = shl i32 %32, 8
%34 = or i32 %31, %33
%35 = load i32, i32* %11
%36 = shl i32 %35, 4
%37 = or i32 %34, %36
%38 = load i32, i32* %12
%39 = or i32 %37, %38
%40 = call i32 @emit_u(i32 %39)
ret void
}

LLVM IR (-O2):
define void @emit_arith_reg(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp ult i32 %0, 8
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ult i32 %1, 2
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = shl i32 %0, 28
%14 = shl i32 %1, 27
%15 = shl i32 %2, 12
%16 = shl i32 %3, 8
%17 = shl i32 %4, 4
%18 = or i32 %13, %14
%19 = or i32 %18, %15
%20 = or i32 %19, %16
%21 = or i32 %20, %17
%22 = or i32 %21, %5
%23 = or i32 %22, 67108864
%24 = tail call i32 @emit_u(i32 %23)
ret void
}