#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*/ addbyte(int);
int /*<<< orphan*/ fatal(char *);
void ADD_HOST_REG_L(int dst_reg, int src_reg) {
  if (dst_reg & src_reg & 8) {
    addbyte(0x45);
    addbyte(0x01);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (dst_reg & 8) {
    addbyte(0x41);
    addbyte(0x01);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (src_reg & 8) {
    addbyte(0x44);
    addbyte(0x01);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else
    fatal("!(dst_reg & src_reg & 8)\n");
}


x86 assembly (clang, -O0):
<ADD_HOST_REG_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1175 <ADD_HOST_REG_L+0x55>
mov    $0x45,%edi
call   1030 <addbyte@plt>
mov    $0x1,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    1213 <ADD_HOST_REG_L+0xf3>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11b9 <ADD_HOST_REG_L+0x99>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x1,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    120e <ADD_HOST_REG_L+0xee>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11fd <ADD_HOST_REG_L+0xdd>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x1,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    1209 <ADD_HOST_REG_L+0xe9>
lea    0xdfc(%rip),%rdi
call   1040 <fatal@plt>
jmp    120e <ADD_HOST_REG_L+0xee>
jmp    1213 <ADD_HOST_REG_L+0xf3>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADD_HOST_REG_L>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%eax
and    $0x8,%eax
test   %esi,%eax
je     1139 <ADD_HOST_REG_L+0x19>
mov    $0x45,%edi
jmp    1161 <ADD_HOST_REG_L+0x41>
test   %eax,%eax
jne    1155 <ADD_HOST_REG_L+0x35>
test   $0x8,%bl
jne    115c <ADD_HOST_REG_L+0x3c>
lea    0xeb7(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fatal@plt>
mov    $0x41,%edi
jmp    1161 <ADD_HOST_REG_L+0x41>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x1,%edi
call   1030 <addbyte@plt>
and    $0x7,%r14d
and    $0x1f,%ebx
lea    (%r14,%rbx,8),%edi
or     $0xc0,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"!(dst_reg & src_reg & 8)\0A\00"
define void @ADD_HOST_REG_L(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = and i32 %5, %6
%8 = and i32 %7, 8
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = call i32 @addbyte(i32 69)
%12 = call i32 @addbyte(i32 1)
%13 = load i32, i32* %3
%14 = and i32 %13, 7
%15 = or i32 192, %14
%16 = load i32, i32* %4
%17 = and i32 %16, 7
%18 = shl i32 %17, 3
%19 = or i32 %15, %18
%20 = call i32 @addbyte(i32 %19)
br label %55
21: ; preds = %2
%22 = load i32, i32* %3
%23 = and i32 %22, 8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = call i32 @addbyte(i32 65)
%27 = call i32 @addbyte(i32 1)
%28 = load i32, i32* %3
%29 = and i32 %28, 7
%30 = or i32 192, %29
%31 = load i32, i32* %4
%32 = and i32 %31, 7
%33 = shl i32 %32, 3
%34 = or i32 %30, %33
%35 = call i32 @addbyte(i32 %34)
br label %54
36: ; preds = %21
%37 = load i32, i32* %4
%38 = and i32 %37, 8
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = call i32 @addbyte(i32 68)
%42 = call i32 @addbyte(i32 1)
%43 = load i32, i32* %3
%44 = and i32 %43, 7
%45 = or i32 192, %44
%46 = load i32, i32* %4
%47 = and i32 %46, 7
%48 = shl i32 %47, 3
%49 = or i32 %45, %48
%50 = call i32 @addbyte(i32 %49)
br label %53
51: ; preds = %36
%52 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %53
53: ; preds = %51, %40
br label %54
54: ; preds = %53, %25
br label %55
55: ; preds = %54, %10
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"!(dst_reg & src_reg & 8)\0A\00"
define void @ADD_HOST_REG_L(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = tail call i32 @addbyte(i32 69)
%8 = tail call i32 @addbyte(i32 1)
%9 = and i32 %0, 7
%10 = shl i32 %1, 3
%11 = and i32 %10, 56
%12 = or i32 %9, %11
%13 = or i32 %12, 192
%14 = tail call i32 @addbyte(i32 %13)
br label %40
15: ; preds = %2
%16 = icmp eq i32 %3, 0
br i1 %16, label %26, label %17
17: ; preds = %15
%18 = tail call i32 @addbyte(i32 65)
%19 = tail call i32 @addbyte(i32 1)
%20 = and i32 %0, 7
%21 = shl i32 %1, 3
%22 = and i32 %21, 56
%23 = or i32 %20, %22
%24 = or i32 %23, 192
%25 = tail call i32 @addbyte(i32 %24)
br label %40
26: ; preds = %15
%27 = and i32 %1, 8
%28 = icmp eq i32 %27, 0
br i1 %28, label %38, label %29
29: ; preds = %26
%30 = tail call i32 @addbyte(i32 68)
%31 = tail call i32 @addbyte(i32 1)
%32 = and i32 %0, 7
%33 = shl i32 %1, 3
%34 = and i32 %33, 56
%35 = or i32 %32, %34
%36 = or i32 %35, 192
%37 = tail call i32 @addbyte(i32 %36)
br label %40
38: ; preds = %26
%39 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %17, %38, %29, %6
ret void
}