#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*/ putchar(char);
void printb(int a) {
  if (a & 0x80)
    putchar('1');
  else
    putchar('0');
  if (a & 0x40)
    putchar('1');
  else
    putchar('0');
  if (a & 0x20)
    putchar('1');
  else
    putchar('0');
  if (a & 0x10)
    putchar('1');
  else
    putchar('0');
  if (a & 0x08)
    putchar('1');
  else
    putchar('0');
  if (a & 0x04)
    putchar('1');
  else
    putchar('0');
  if (a & 0x02)
    putchar('1');
  else
    putchar('0');
  if (a & 0x01)
    putchar('1');
  else
    putchar('0');
}


x86 assembly (clang, -O0):
<printb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     113b <printb+0x2b>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1145 <printb+0x35>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1163 <printb+0x53>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    116d <printb+0x5d>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     118b <printb+0x7b>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1195 <printb+0x85>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11b3 <printb+0xa3>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    11bd <printb+0xad>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11db <printb+0xcb>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    11e5 <printb+0xd5>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1203 <printb+0xf3>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    120d <printb+0xfd>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     122b <printb+0x11b>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1235 <printb+0x125>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1253 <printb+0x143>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    125d <printb+0x14d>
mov    $0x30,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movd   %edi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0xed4(%rip),%xmm1
pand   %xmm0,%xmm1
pand   0xed8(%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 <putchar@plt>
movzbl %bpl,%edi
xor    $0x31,%edi
call   1030 <putchar@plt>
movzbl %r13b,%edi
xor    $0x31,%edi
call   1030 <putchar@plt>
movzbl %r12b,%edi
xor    $0x31,%edi
call   1030 <putchar@plt>
movzbl %r15b,%edi
xor    $0x31,%edi
call   1030 <putchar@plt>
movzbl %r14b,%edi
xor    $0x31,%edi
call   1030 <putchar@plt>
movzbl 0x7(%rsp),%edi
xor    $0x31,%edi
call   1030 <putchar@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 <putchar@plt>

LLVM IR (-O0):
define void @printb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @putchar(i8 signext 49)
br label %10
8: ; preds = %1
%9 = call i32 @putchar(i8 signext 48)
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
%12 = and i32 %11, 64
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @putchar(i8 signext 49)
br label %18
16: ; preds = %10
%17 = call i32 @putchar(i8 signext 48)
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %2
%20 = and i32 %19, 32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @putchar(i8 signext 49)
br label %26
24: ; preds = %18
%25 = call i32 @putchar(i8 signext 48)
br label %26
26: ; preds = %24, %22
%27 = load i32, i32* %2
%28 = and i32 %27, 16
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @putchar(i8 signext 49)
br label %34
32: ; preds = %26
%33 = call i32 @putchar(i8 signext 48)
br label %34
34: ; preds = %32, %30
%35 = load i32, i32* %2
%36 = and i32 %35, 8
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @putchar(i8 signext 49)
br label %42
40: ; preds = %34
%41 = call i32 @putchar(i8 signext 48)
br label %42
42: ; preds = %40, %38
%43 = load i32, i32* %2
%44 = and i32 %43, 4
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @putchar(i8 signext 49)
br label %50
48: ; preds = %42
%49 = call i32 @putchar(i8 signext 48)
br label %50
50: ; preds = %48, %46
%51 = load i32, i32* %2
%52 = and i32 %51, 2
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @putchar(i8 signext 49)
br label %58
56: ; preds = %50
%57 = call i32 @putchar(i8 signext 48)
br label %58
58: ; preds = %56, %54
%59 = load i32, i32* %2
%60 = and i32 %59, 1
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 @putchar(i8 signext 49)
br label %66
64: ; preds = %58
%65 = call i32 @putchar(i8 signext 48)
br label %66
66: ; preds = %64, %62
ret void
}

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