#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);
void NEG_HOST_REG_B(int reg) {
  if (reg & 0x10) {
    if (reg & 8)
      addbyte(0x44);
    addbyte(0x89);
    addbyte(0xc3 | ((reg & 7) << 3));
    addbyte(0xf6);
    addbyte(0xdf);
    if (reg & 8)
      addbyte(0x41);
    addbyte(0x89);
    addbyte(0xd8 | (reg & 7));
  } else {
    if (reg & 8)
      addbyte(0x41);
    addbyte(0xf6);
    addbyte(0xd8 | (reg & 7));
  }
}


x86 assembly (clang, -O0):
<NEG_HOST_REG_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11ae <NEG_HOST_REG_B+0x9e>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1143 <NEG_HOST_REG_B+0x33>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x89,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
shl    $0x3,%edi
or     $0xc3,%edi
call   1030 <addbyte@plt>
mov    $0xf6,%edi
call   1030 <addbyte@plt>
mov    $0xdf,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     118e <NEG_HOST_REG_B+0x7e>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x89,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xd8,%edi
call   1030 <addbyte@plt>
jmp    11e2 <NEG_HOST_REG_B+0xd2>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11c7 <NEG_HOST_REG_B+0xb7>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xf6,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xd8,%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NEG_HOST_REG_B>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   $0x10,%bl
jne    1138 <NEG_HOST_REG_B+0x28>
test   $0x8,%bl
je     1129 <NEG_HOST_REG_B+0x19>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xf6,%edi
call   1030 <addbyte@plt>
and    $0x7,%ebx
jmp    1190 <NEG_HOST_REG_B+0x80>
test   $0x8,%bl
je     1147 <NEG_HOST_REG_B+0x37>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    %ebx,%ebp
mov    $0x89,%edi
call   1030 <addbyte@plt>
and    $0x7,%ebx
lea    0xc3(,%rbx,8),%edi
call   1030 <addbyte@plt>
mov    $0xf6,%edi
call   1030 <addbyte@plt>
mov    $0xdf,%edi
call   1030 <addbyte@plt>
test   $0x8,%bpl
je     1186 <NEG_HOST_REG_B+0x76>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x89,%edi
call   1030 <addbyte@plt>
or     $0xd8,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @NEG_HOST_REG_B(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 16
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %32
6: ; preds = %1
%7 = load i32, i32* %2
%8 = and i32 %7, 8
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @addbyte(i32 68)
br label %12
12: ; preds = %10, %6
%13 = call i32 @addbyte(i32 137)
%14 = load i32, i32* %2
%15 = and i32 %14, 7
%16 = shl i32 %15, 3
%17 = or i32 195, %16
%18 = call i32 @addbyte(i32 %17)
%19 = call i32 @addbyte(i32 246)
%20 = call i32 @addbyte(i32 223)
%21 = load i32, i32* %2
%22 = and i32 %21, 8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %12
%25 = call i32 @addbyte(i32 65)
br label %26
26: ; preds = %24, %12
%27 = call i32 @addbyte(i32 137)
%28 = load i32, i32* %2
%29 = and i32 %28, 7
%30 = or i32 216, %29
%31 = call i32 @addbyte(i32 %30)
br label %44
32: ; preds = %1
%33 = load i32, i32* %2
%34 = and i32 %33, 8
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @addbyte(i32 65)
br label %38
38: ; preds = %36, %32
%39 = call i32 @addbyte(i32 246)
%40 = load i32, i32* %2
%41 = and i32 %40, 7
%42 = or i32 216, %41
%43 = call i32 @addbyte(i32 %42)
br label %44
44: ; preds = %38, %26
ret void
}

LLVM IR (-O2):
define void @NEG_HOST_REG_B(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 8
%5 = icmp eq i32 %4, 0
br i1 %3, label %21, label %6
6: ; preds = %1
br i1 %5, label %9, label %7
7: ; preds = %6
%8 = tail call i32 @addbyte(i32 68)
br label %9
9: ; preds = %7, %6
%10 = tail call i32 @addbyte(i32 137)
%11 = and i32 %0, 7
%12 = shl nuw nsw i32 %11, 3
%13 = or i32 %12, 195
%14 = tail call i32 @addbyte(i32 %13)
%15 = tail call i32 @addbyte(i32 246)
%16 = tail call i32 @addbyte(i32 223)
br i1 %5, label %19, label %17
17: ; preds = %9
%18 = tail call i32 @addbyte(i32 65)
br label %19
19: ; preds = %17, %9
%20 = tail call i32 @addbyte(i32 137)
br label %27
21: ; preds = %1
br i1 %5, label %24, label %22
22: ; preds = %21
%23 = tail call i32 @addbyte(i32 65)
br label %24
24: ; preds = %22, %21
%25 = tail call i32 @addbyte(i32 246)
%26 = and i32 %0, 7
br label %27
27: ; preds = %24, %19
%28 = phi i32 [ %26, %24 ], [ %11, %19 ]
%29 = or i32 %28, 216
%30 = tail call i32 @addbyte(i32 %29)
ret void
}