#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*/ addword(int);
int /*<<< orphan*/ fatal(char *);
void XOR_HOST_REG_B(int dst_reg, int src_reg) {
  if (dst_reg & src_reg & 8) {
    if (dst_reg & 0x10) {
      addbyte(0x66);
      addbyte(0x44);
      addbyte(0x89);
      addbyte(0xc0 | ((src_reg & 7) << 3));
      if (!(src_reg & 0x10)) {
        addbyte(0x66);
        addbyte(0xc1);
        addbyte(0xe0);
        addbyte(8);
      } else {
        addbyte(0x66);
        addbyte(0x25);
        addword(0xff00);
      }
      addbyte(0x66);
      addbyte(0x41);
      addbyte(0x31);
      addbyte(0xc0 | (dst_reg & 7));
    } else if (src_reg & 0x10) {
      addbyte(0x66);
      addbyte(0x44);
      addbyte(0x89);
      addbyte(0xc0 | ((src_reg & 7) << 3));
      addbyte(0x66);
      addbyte(0xc1);
      addbyte(0xe8);
      addbyte(8);
      addbyte(0x41);
      addbyte(0x30);
      addbyte(0xc0 | (dst_reg & 7));
    } else {
      addbyte(0x45);
      addbyte(0x30);
      addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
    }
  } else if (dst_reg & 8) {
    if (dst_reg & 0x10) {
      addbyte(0x66);
      addbyte(0xc1);
      addbyte(0xe0 | src_reg);
      addbyte(0x08);
      addbyte(0x66);
      addbyte(0x41);
      addbyte(0x31);
      addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
    } else {
      addbyte(0x41);
      addbyte(0x30);
      addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
    }
  } else
    fatal("!(dst_reg & src_reg & 8)\n");
}


x86 assembly (clang, -O0):
<XOR_HOST_REG_B>:
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     12ec <XOR_HOST_REG_B+0x1bc>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     121f <XOR_HOST_REG_B+0xef>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%edi
and    $0x7,%edi
shl    $0x3,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    11cd <XOR_HOST_REG_B+0x9d>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    $0xe0,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
jmp    11eb <XOR_HOST_REG_B+0xbb>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x25,%edi
call   1040 <addbyte@plt>
mov    $0xff00,%edi
call   1030 <addword@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x31,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
jmp    12e7 <XOR_HOST_REG_B+0x1b7>
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     12b2 <XOR_HOST_REG_B+0x182>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%edi
and    $0x7,%edi
shl    $0x3,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    $0xe8,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x30,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
jmp    12e2 <XOR_HOST_REG_B+0x1b2>
mov    $0x45,%edi
call   1040 <addbyte@plt>
mov    $0x30,%edi
call   1040 <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   1040 <addbyte@plt>
jmp    12e7 <XOR_HOST_REG_B+0x1b7>
jmp    13bb <XOR_HOST_REG_B+0x28b>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     13aa <XOR_HOST_REG_B+0x27a>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1375 <XOR_HOST_REG_B+0x245>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%edi
or     $0xe0,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x31,%edi
call   1040 <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   1040 <addbyte@plt>
jmp    13a5 <XOR_HOST_REG_B+0x275>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x30,%edi
call   1040 <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   1040 <addbyte@plt>
jmp    13b6 <XOR_HOST_REG_B+0x286>
lea    0xc4f(%rip),%rdi
call   1050 <fatal@plt>
jmp    13bb <XOR_HOST_REG_B+0x28b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XOR_HOST_REG_B>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%eax
and    $0x8,%eax
test   %esi,%eax
je     115b <XOR_HOST_REG_B+0x2b>
test   $0x10,%r14b
jne    1172 <XOR_HOST_REG_B+0x42>
test   $0x10,%bl
jne    11f4 <XOR_HOST_REG_B+0xc4>
mov    $0x45,%edi
jmp    11e5 <XOR_HOST_REG_B+0xb5>
test   %eax,%eax
jne    11d6 <XOR_HOST_REG_B+0xa6>
lea    0xe9a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fatal@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
mov    %ebx,%eax
or     $0x18,%eax
shl    $0x3,%eax
movzbl %al,%edi
call   1040 <addbyte@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
test   $0x10,%bl
jne    1259 <XOR_HOST_REG_B+0x129>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    $0xe0,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
jmp    126d <XOR_HOST_REG_B+0x13d>
test   $0x10,%r14b
jne    129b <XOR_HOST_REG_B+0x16b>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x30,%edi
jmp    12df <XOR_HOST_REG_B+0x1af>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
or     $0x18,%ebx
shl    $0x3,%ebx
movzbl %bl,%edi
call   1040 <addbyte@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    $0xe8,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x30,%edi
jmp    1286 <XOR_HOST_REG_B+0x156>
mov    $0x25,%edi
call   1040 <addbyte@plt>
mov    $0xff00,%edi
call   1030 <addword@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x31,%edi
call   1040 <addbyte@plt>
and    $0x7,%r14d
or     $0xc0,%r14d
mov    %r14d,%edi
jmp    12f5 <XOR_HOST_REG_B+0x1c5>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    %ebx,%edi
or     $0xe0,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
mov    $0x66,%edi
call   1040 <addbyte@plt>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x31,%edi
call   1040 <addbyte@plt>
and    $0x7,%r14d
and    $0x1f,%ebx
lea    (%r14,%rbx,8),%edi
or     $0xc0,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <addbyte@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"!(dst_reg & src_reg & 8)\0A\00"
define void @XOR_HOST_REG_B(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 %79
10: ; preds = %2
%11 = load i32, i32* %3
%12 = and i32 %11, 16
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %43
14: ; preds = %10
%15 = call i32 @addbyte(i32 102)
%16 = call i32 @addbyte(i32 68)
%17 = call i32 @addbyte(i32 137)
%18 = load i32, i32* %4
%19 = and i32 %18, 7
%20 = shl i32 %19, 3
%21 = or i32 192, %20
%22 = call i32 @addbyte(i32 %21)
%23 = load i32, i32* %4
%24 = and i32 %23, 16
%25 = icmp ne i32 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %14
%27 = call i32 @addbyte(i32 102)
%28 = call i32 @addbyte(i32 193)
%29 = call i32 @addbyte(i32 224)
%30 = call i32 @addbyte(i32 8)
br label %35
31: ; preds = %14
%32 = call i32 @addbyte(i32 102)
%33 = call i32 @addbyte(i32 37)
%34 = call i32 @addword(i32 65280)
br label %35
35: ; preds = %31, %26
%36 = call i32 @addbyte(i32 102)
%37 = call i32 @addbyte(i32 65)
%38 = call i32 @addbyte(i32 49)
%39 = load i32, i32* %3
%40 = and i32 %39, 7
%41 = or i32 192, %40
%42 = call i32 @addbyte(i32 %41)
br label %78
43: ; preds = %10
%44 = load i32, i32* %4
%45 = and i32 %44, 16
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %66
47: ; preds = %43
%48 = call i32 @addbyte(i32 102)
%49 = call i32 @addbyte(i32 68)
%50 = call i32 @addbyte(i32 137)
%51 = load i32, i32* %4
%52 = and i32 %51, 7
%53 = shl i32 %52, 3
%54 = or i32 192, %53
%55 = call i32 @addbyte(i32 %54)
%56 = call i32 @addbyte(i32 102)
%57 = call i32 @addbyte(i32 193)
%58 = call i32 @addbyte(i32 232)
%59 = call i32 @addbyte(i32 8)
%60 = call i32 @addbyte(i32 65)
%61 = call i32 @addbyte(i32 48)
%62 = load i32, i32* %3
%63 = and i32 %62, 7
%64 = or i32 192, %63
%65 = call i32 @addbyte(i32 %64)
br label %77
66: ; preds = %43
%67 = call i32 @addbyte(i32 69)
%68 = call i32 @addbyte(i32 48)
%69 = load i32, i32* %3
%70 = and i32 %69, 7
%71 = or i32 192, %70
%72 = load i32, i32* %4
%73 = and i32 %72, 7
%74 = shl i32 %73, 3
%75 = or i32 %71, %74
%76 = call i32 @addbyte(i32 %75)
br label %77
77: ; preds = %66, %47
br label %78
78: ; preds = %77, %35
br label %120
79: ; preds = %2
%80 = load i32, i32* %3
%81 = and i32 %80, 8
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %117
83: ; preds = %79
%84 = load i32, i32* %3
%85 = and i32 %84, 16
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %105
87: ; preds = %83
%88 = call i32 @addbyte(i32 102)
%89 = call i32 @addbyte(i32 193)
%90 = load i32, i32* %4
%91 = or i32 224, %90
%92 = call i32 @addbyte(i32 %91)
%93 = call i32 @addbyte(i32 8)
%94 = call i32 @addbyte(i32 102)
%95 = call i32 @addbyte(i32 65)
%96 = call i32 @addbyte(i32 49)
%97 = load i32, i32* %3
%98 = and i32 %97, 7
%99 = or i32 192, %98
%100 = load i32, i32* %4
%101 = and i32 %100, 7
%102 = shl i32 %101, 3
%103 = or i32 %99, %102
%104 = call i32 @addbyte(i32 %103)
br label %116
105: ; preds = %83
%106 = call i32 @addbyte(i32 65)
%107 = call i32 @addbyte(i32 48)
%108 = load i32, i32* %3
%109 = and i32 %108, 7
%110 = or i32 192, %109
%111 = load i32, i32* %4
%112 = and i32 %111, 7
%113 = shl i32 %112, 3
%114 = or i32 %110, %113
%115 = call i32 @addbyte(i32 %114)
br label %116
116: ; preds = %105, %87
br label %119
117: ; preds = %79
%118 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %119
119: ; preds = %117, %116
br label %120
120: ; preds = %119, %78
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"!(dst_reg & src_reg & 8)\0A\00"
define void @XOR_HOST_REG_B(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %63, label %6
6: ; preds = %2
%7 = and i32 %0, 16
%8 = icmp eq i32 %7, 0
br i1 %8, label %34, label %9
9: ; preds = %6
%10 = tail call i32 @addbyte(i32 102)
%11 = tail call i32 @addbyte(i32 68)
%12 = tail call i32 @addbyte(i32 137)
%13 = shl i32 %1, 3
%14 = and i32 %13, 56
%15 = or i32 %14, 192
%16 = tail call i32 @addbyte(i32 %15)
%17 = and i32 %1, 16
%18 = icmp eq i32 %17, 0
%19 = tail call i32 @addbyte(i32 102)
br i1 %18, label %20, label %24
20: ; preds = %9
%21 = tail call i32 @addbyte(i32 193)
%22 = tail call i32 @addbyte(i32 224)
%23 = tail call i32 @addbyte(i32 8)
br label %27
24: ; preds = %9
%25 = tail call i32 @addbyte(i32 37)
%26 = tail call i32 @addword(i32 65280)
br label %27
27: ; preds = %24, %20
%28 = tail call i32 @addbyte(i32 102)
%29 = tail call i32 @addbyte(i32 65)
%30 = tail call i32 @addbyte(i32 49)
%31 = and i32 %0, 7
%32 = or i32 %31, 192
%33 = tail call i32 @addbyte(i32 %32)
br label %94
34: ; preds = %6
%35 = and i32 %1, 16
%36 = icmp eq i32 %35, 0
br i1 %36, label %54, label %37
37: ; preds = %34
%38 = tail call i32 @addbyte(i32 102)
%39 = tail call i32 @addbyte(i32 68)
%40 = tail call i32 @addbyte(i32 137)
%41 = shl i32 %1, 3
%42 = and i32 %41, 56
%43 = or i32 %42, 192
%44 = tail call i32 @addbyte(i32 %43)
%45 = tail call i32 @addbyte(i32 102)
%46 = tail call i32 @addbyte(i32 193)
%47 = tail call i32 @addbyte(i32 232)
%48 = tail call i32 @addbyte(i32 8)
%49 = tail call i32 @addbyte(i32 65)
%50 = tail call i32 @addbyte(i32 48)
%51 = and i32 %0, 7
%52 = or i32 %51, 192
%53 = tail call i32 @addbyte(i32 %52)
br label %94
54: ; preds = %34
%55 = tail call i32 @addbyte(i32 69)
%56 = tail call i32 @addbyte(i32 48)
%57 = and i32 %0, 7
%58 = shl i32 %1, 3
%59 = and i32 %58, 56
%60 = or i32 %57, %59
%61 = or i32 %60, 192
%62 = tail call i32 @addbyte(i32 %61)
br label %94
63: ; preds = %2
%64 = icmp eq i32 %3, 0
br i1 %64, label %92, label %65
65: ; preds = %63
%66 = and i32 %0, 16
%67 = icmp eq i32 %66, 0
br i1 %67, label %83, label %68
68: ; preds = %65
%69 = tail call i32 @addbyte(i32 102)
%70 = tail call i32 @addbyte(i32 193)
%71 = or i32 %1, 224
%72 = tail call i32 @addbyte(i32 %71)
%73 = tail call i32 @addbyte(i32 8)
%74 = tail call i32 @addbyte(i32 102)
%75 = tail call i32 @addbyte(i32 65)
%76 = tail call i32 @addbyte(i32 49)
%77 = and i32 %0, 7
%78 = shl i32 %1, 3
%79 = and i32 %78, 56
%80 = or i32 %77, %79
%81 = or i32 %80, 192
%82 = tail call i32 @addbyte(i32 %81)
br label %94
83: ; preds = %65
%84 = tail call i32 @addbyte(i32 65)
%85 = tail call i32 @addbyte(i32 48)
%86 = and i32 %0, 7
%87 = shl i32 %1, 3
%88 = and i32 %87, 56
%89 = or i32 %86, %88
%90 = or i32 %89, 192
%91 = tail call i32 @addbyte(i32 %90)
br label %94
92: ; preds = %63
%93 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %94
94: ; preds = %92, %83, %68, %27, %54, %37
ret void
}