#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 ZERO_EXTEND_W_B(int reg) {
  if (reg & 0x10) {
    addbyte(0x44);
    addbyte(0x89);
    addbyte(0xc0 | (reg << 3));
    addbyte(0x0f);
    addbyte(0xb6);
    addbyte(0xc4);
    return 0;
  }
  if (reg & 8)
    addbyte(0x41);
  addbyte(0x0f);
  addbyte(0xb6);
  addbyte(0xc0 | (reg & 7));
  return 0;
}


x86 assembly (clang, -O0):
<ZERO_EXTEND_W_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1179 <ZERO_EXTEND_W_B+0x69>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x89,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xb6,%edi
call   1030 <addbyte@plt>
mov    $0xc4,%edi
call   1030 <addbyte@plt>
movl   $0x0,-0x4(%rbp)
jmp    11be <ZERO_EXTEND_W_B+0xae>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1192 <ZERO_EXTEND_W_B+0x82>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xb6,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1030 <addbyte@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZERO_EXTEND_W_B>:
push   %rbx
mov    %edi,%ebx
test   $0x10,%bl
jne    1146 <ZERO_EXTEND_W_B+0x36>
test   $0x8,%bl
je     1127 <ZERO_EXTEND_W_B+0x17>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xb6,%edi
call   1030 <addbyte@plt>
and    $0x7,%ebx
or     $0xc0,%ebx
jmp    1180 <ZERO_EXTEND_W_B+0x70>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x89,%edi
call   1030 <addbyte@plt>
or     $0x18,%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xb6,%edi
call   1030 <addbyte@plt>
mov    $0xc4,%ebx
mov    %ebx,%edi
call   1030 <addbyte@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ZERO_EXTEND_W_B(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 16
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = call i32 @addbyte(i32 68)
%9 = call i32 @addbyte(i32 137)
%10 = load i32, i32* %3
%11 = shl i32 %10, 3
%12 = or i32 192, %11
%13 = call i32 @addbyte(i32 %12)
%14 = call i32 @addbyte(i32 15)
%15 = call i32 @addbyte(i32 182)
%16 = call i32 @addbyte(i32 196)
store i32 0, i32* %2
br label %30
17: ; preds = %1
%18 = load i32, i32* %3
%19 = and i32 %18, 8
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @addbyte(i32 65)
br label %23
23: ; preds = %21, %17
%24 = call i32 @addbyte(i32 15)
%25 = call i32 @addbyte(i32 182)
%26 = load i32, i32* %3
%27 = and i32 %26, 7
%28 = or i32 192, %27
%29 = call i32 @addbyte(i32 %28)
store i32 0, i32* %2
br label %30
30: ; preds = %23, %7
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @ZERO_EXTEND_W_B(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i32 @addbyte(i32 68)
%6 = tail call i32 @addbyte(i32 137)
%7 = shl i32 %0, 3
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
%10 = tail call i32 @addbyte(i32 15)
%11 = tail call i32 @addbyte(i32 182)
br label %22
12: ; preds = %1
%13 = and i32 %0, 8
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @addbyte(i32 65)
br label %17
17: ; preds = %15, %12
%18 = tail call i32 @addbyte(i32 15)
%19 = tail call i32 @addbyte(i32 182)
%20 = and i32 %0, 7
%21 = or i32 %20, 192
br label %22
22: ; preds = %17, %4
%23 = phi i32 [ %21, %17 ], [ 196, %4 ]
%24 = tail call i32 @addbyte(i32 %23)
ret i32 0
}