#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 XOR_HOST_REG_W(int dst_reg, int src_reg) {
  if (dst_reg & src_reg & 8) {
    addbyte(0x66);
    addbyte(0x45);
    addbyte(0x31);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (dst_reg & 8) {
    addbyte(0x66);
    addbyte(0x41);
    addbyte(0x31);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else
    fatal("!(dst_reg & src_reg & 8)\n");
}


x86 assembly (clang, -O0):
<XOR_HOST_REG_W>:
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     117f <XOR_HOST_REG_W+0x5f>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0x45,%edi
call   1030 <addbyte@plt>
mov    $0x31,%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    11de <XOR_HOST_REG_W+0xbe>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11cd <XOR_HOST_REG_W+0xad>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x31,%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    11d9 <XOR_HOST_REG_W+0xb9>
lea    0xe2c(%rip),%rdi
call   1040 <fatal@plt>
jmp    11de <XOR_HOST_REG_W+0xbe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XOR_HOST_REG_W>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
mov    %edi,%eax
and    $0x8,%eax
test   %esi,%eax
je     1143 <XOR_HOST_REG_W+0x23>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0x45,%edi
jmp    1169 <XOR_HOST_REG_W+0x49>
test   %eax,%eax
jne    115a <XOR_HOST_REG_W+0x3a>
lea    0xeb2(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fatal@plt>
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x31,%edi
call   1030 <addbyte@plt>
and    $0x7,%ebx
and    $0x1f,%r14d
lea    (%rbx,%r14,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 @XOR_HOST_REG_W(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 %22
10: ; preds = %2
%11 = call i32 @addbyte(i32 102)
%12 = call i32 @addbyte(i32 69)
%13 = call i32 @addbyte(i32 49)
%14 = load i32, i32* %3
%15 = and i32 %14, 7
%16 = or i32 192, %15
%17 = load i32, i32* %4
%18 = and i32 %17, 7
%19 = shl i32 %18, 3
%20 = or i32 %16, %19
%21 = call i32 @addbyte(i32 %20)
br label %41
22: ; preds = %2
%23 = load i32, i32* %3
%24 = and i32 %23, 8
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %38
26: ; preds = %22
%27 = call i32 @addbyte(i32 102)
%28 = call i32 @addbyte(i32 65)
%29 = call i32 @addbyte(i32 49)
%30 = load i32, i32* %3
%31 = and i32 %30, 7
%32 = or i32 192, %31
%33 = load i32, i32* %4
%34 = and i32 %33, 7
%35 = shl i32 %34, 3
%36 = or i32 %32, %35
%37 = call i32 @addbyte(i32 %36)
br label %40
38: ; preds = %22
%39 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %38, %26
br label %41
41: ; preds = %40, %10
ret void
}

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