#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*/ Wc(char);
int /*<<< orphan*/ Wd(int, int);
void Wbits(int byte) {
  if (byte < 0) {
    Wd(byte, 1);
  } else
    for (int i = 7; i >= 0; i--) {
      Wc(((byte >> i) & 1) ? '1' : '0');
    }
}


x86 assembly (clang, -O0):
<Wbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1147 <Wbits+0x27>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <Wd@plt>
jmp    118e <Wbits+0x6e>
movl   $0x7,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1189 <Wbits+0x69>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
and    $0x1,%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <Wc@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <Wbits+0x2e>
jmp    118e <Wbits+0x6e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Wbits>:
test   %edi,%edi
js     121c <Wbits+0xfc>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movd   %edi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0xebc(%rip),%xmm1
pand   %xmm0,%xmm1
pand   0xec0(%rip),%xmm0
pxor   %xmm2,%xmm2
pcmpeqd %xmm2,%xmm0
pcmpeqd %xmm2,%xmm1
packssdw %xmm0,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ebx
mov    %ebx,%eax
and    $0x2,%al
shr    %al
mov    %al,0x7(%rsp)
mov    %ebx,%r14d
and    $0x4,%r14b
shr    $0x2,%r14b
mov    %ebx,%r15d
and    $0x8,%r15b
shr    $0x3,%r15b
mov    %ebx,%r12d
and    $0x10,%r12b
shr    $0x4,%r12b
mov    %ebx,%r13d
and    $0x20,%r13b
shr    $0x5,%r13b
mov    %ebx,%ebp
and    $0x40,%bpl
shr    $0x6,%bpl
mov    %ebx,%eax
shr    $0x7,%al
movzbl %al,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl %bpl,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl %r13b,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl %r12b,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl %r15b,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl %r14b,%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
movzbl 0x7(%rsp),%edi
xor    $0x31,%edi
call   1030 <Wc@plt>
and    $0x1,%ebx
xor    $0x31,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <Wc@plt>
mov    $0x1,%esi
jmp    1040 <Wd@plt>

LLVM IR (-O0):
define void @Wbits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @Wd(i32 %7, i32 1)
br label %27
9: ; preds = %1
store i32 7, i32* %3
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = ashr i32 %14, %15
%17 = and i32 %16, 1
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 49, i32 48
%21 = trunc i32 %20 to i8
%22 = call i32 @Wc(i8 signext %21)
br label %23
23: ; preds = %13
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
store i32 %25, i32* %3
br label %10
26: ; preds = %10
br label %27
27: ; preds = %26, %6
ret void
}

LLVM IR (-O2):
define void @Wbits(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %32, label %3
3: ; preds = %1
%4 = insertelement <8 x i32> poison, i32 %0, i64 0
%5 = shufflevector <8 x i32> %4, <8 x i32> poison, <8 x i32> zeroinitializer
%6 = and <8 x i32> %5, <i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128>
%7 = icmp eq <8 x i32> %6, zeroinitializer
%8 = extractelement <8 x i1> %7, i64 7
%9 = select i1 %8, i8 48, i8 49
%10 = tail call i32 @Wc(i8 signext %9)
%11 = extractelement <8 x i1> %7, i64 6
%12 = select i1 %11, i8 48, i8 49
%13 = tail call i32 @Wc(i8 signext %12)
%14 = extractelement <8 x i1> %7, i64 5
%15 = select i1 %14, i8 48, i8 49
%16 = tail call i32 @Wc(i8 signext %15)
%17 = extractelement <8 x i1> %7, i64 4
%18 = select i1 %17, i8 48, i8 49
%19 = tail call i32 @Wc(i8 signext %18)
%20 = extractelement <8 x i1> %7, i64 3
%21 = select i1 %20, i8 48, i8 49
%22 = tail call i32 @Wc(i8 signext %21)
%23 = extractelement <8 x i1> %7, i64 2
%24 = select i1 %23, i8 48, i8 49
%25 = tail call i32 @Wc(i8 signext %24)
%26 = extractelement <8 x i1> %7, i64 1
%27 = select i1 %26, i8 48, i8 49
%28 = tail call i32 @Wc(i8 signext %27)
%29 = extractelement <8 x i1> %7, i64 0
%30 = select i1 %29, i8 48, i8 49
%31 = tail call i32 @Wc(i8 signext %30)
br label %34
32: ; preds = %1
%33 = tail call i32 @Wd(i32 %0, i32 1)
br label %34
34: ; preds = %3, %32
ret void
}