#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 ADD_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(0x01);
      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(0x00);
      addbyte(0xc0 | (dst_reg & 7));
    } else {
      addbyte(0x45);
      addbyte(0x00);
      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(0x01);
      addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
    } else {
      addbyte(0x41);
      addbyte(0x00);
      addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
    }
  } else
    fatal("!(dst_reg & src_reg & 8)\n");
}


x86 assembly (clang, -O0):
<ADD_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     12e6 <ADD_HOST_REG_B+0x1b6>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     121f <ADD_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 <ADD_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 <ADD_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    $0x1,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
jmp    12e1 <ADD_HOST_REG_B+0x1b1>
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     12af <ADD_HOST_REG_B+0x17f>
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>
xor    %edi,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
jmp    12dc <ADD_HOST_REG_B+0x1ac>
mov    $0x45,%edi
call   1040 <addbyte@plt>
xor    %edi,%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    12e1 <ADD_HOST_REG_B+0x1b1>
jmp    13b2 <ADD_HOST_REG_B+0x282>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     13a1 <ADD_HOST_REG_B+0x271>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     136f <ADD_HOST_REG_B+0x23f>
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    $0x1,%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    139c <ADD_HOST_REG_B+0x26c>
mov    $0x41,%edi
call   1040 <addbyte@plt>
xor    %edi,%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    13ad <ADD_HOST_REG_B+0x27d>
lea    0xc58(%rip),%rdi
call   1050 <fatal@plt>
jmp    13b2 <ADD_HOST_REG_B+0x282>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADD_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 <ADD_HOST_REG_B+0x2b>
test   $0x10,%r14b
jne    1172 <ADD_HOST_REG_B+0x42>
test   $0x10,%bl
jne    11f1 <ADD_HOST_REG_B+0xc1>
mov    $0x45,%edi
jmp    11e5 <ADD_HOST_REG_B+0xb5>
test   %eax,%eax
jne    11d6 <ADD_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    1253 <ADD_HOST_REG_B+0x123>
mov    $0xc1,%edi
call   1040 <addbyte@plt>
mov    $0xe0,%edi
call   1040 <addbyte@plt>
mov    $0x8,%edi
call   1040 <addbyte@plt>
jmp    1267 <ADD_HOST_REG_B+0x137>
test   $0x10,%r14b
jne    1295 <ADD_HOST_REG_B+0x165>
mov    $0x41,%edi
call   1040 <addbyte@plt>
xor    %edi,%edi
jmp    12d9 <ADD_HOST_REG_B+0x1a9>
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>
xor    %edi,%edi
jmp    1280 <ADD_HOST_REG_B+0x150>
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    $0x1,%edi
call   1040 <addbyte@plt>
and    $0x7,%r14d
or     $0xc0,%r14d
mov    %r14d,%edi
jmp    12ef <ADD_HOST_REG_B+0x1bf>
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    $0x1,%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 @ADD_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 1)
%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 0)
%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 0)
%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 1)
%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 0)
%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 @ADD_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 1)
%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 0)
%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 0)
%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 1)
%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 0)
%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
}