#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_L(int dst_reg, int src_reg) {
  if (dst_reg & src_reg & 8) {
    addbyte(0x45);
    addbyte(0x31);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (dst_reg & 8) {
    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_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 <XOR_HOST_REG_L+0x55>
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    11ca <XOR_HOST_REG_L+0xaa>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11b9 <XOR_HOST_REG_L+0x99>
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    11c5 <XOR_HOST_REG_L+0xa5>
lea    0xe40(%rip),%rdi
call   1040 <fatal@plt>
jmp    11ca <XOR_HOST_REG_L+0xaa>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XOR_HOST_REG_L>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
mov    %edi,%eax
and    $0x8,%eax
test   %esi,%eax
je     1139 <XOR_HOST_REG_L+0x19>
mov    $0x45,%edi
jmp    1155 <XOR_HOST_REG_L+0x35>
test   %eax,%eax
jne    1150 <XOR_HOST_REG_L+0x30>
lea    0xebc(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fatal@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_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 49)
%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 %39
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 49)
%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 %38
36: ; preds = %21
%37 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %36, %25
br label %39
39: ; preds = %38, %10
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"!(dst_reg & src_reg & 8)\0A\00"
define void @XOR_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 49)
%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 %28
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 49)
%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 %28
26: ; preds = %15
%27 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %17, %26, %6
ret void
}