#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 dump_binary(int x) {
  unsigned int z, i;
  for (z = 1 << 31, i = 1; z > 0; z >>= 1, i++) {
    putchar(((x & z) == z) ? '1' : '0');
    if (i % 8 == 0)
      putchar(' ');
  }
}


x86 assembly (clang, -O0):
<dump_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x80000000,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    1188 <dump_binary+0x78>
mov    -0x4(%rbp),%edx
and    -0x8(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    116c <dump_binary+0x5c>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1171 <dump_binary+0x61>
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <dump_binary+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_binary>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0x80000000,%ebp
mov    $0x1,%ebx
not    %r14d
jmp    113a <dump_binary+0x2a>
cs nopw 0x0(%rax,%rax,1)
shr    %ebp
add    $0x1,%ebx
cmp    $0x21,%ebx
je     115c <dump_binary+0x4c>
xor    %edi,%edi
test   %r14d,%ebp
sete   %dil
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7,%bl
jne    1130 <dump_binary+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1130 <dump_binary+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @dump_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 -2147483648, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i32, i32* %3
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = and i32 %9, %10
%12 = load i32, i32* %3
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 49, i32 48
%16 = trunc i32 %15 to i8
%17 = call i32 @putchar(i8 signext %16)
%18 = load i32, i32* %4
%19 = urem i32 %18, 8
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %8
%22 = call i32 @putchar(i8 signext 32)
br label %23
23: ; preds = %21, %8
br label %24
24: ; preds = %23
%25 = load i32, i32* %3
%26 = lshr i32 %25, 1
store i32 %26, i32* %3
%27 = load i32, i32* %4
%28 = add i32 %27, 1
store i32 %28, i32* %4
br label %5
29: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @dump_binary(i32 %0) {
br label %2
2: ; preds = %1, %13
%3 = phi i32 [ 1, %1 ], [ %15, %13 ]
%4 = phi i32 [ -2147483648, %1 ], [ %14, %13 ]
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, %4
%7 = select i1 %6, i8 49, i8 48
%8 = tail call i32 @putchar(i8 signext %7)
%9 = and i32 %3, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @putchar(i8 signext 32)
br label %13
13: ; preds = %2, %11
%14 = lshr i32 %4, 1
%15 = add nuw nsw i32 %3, 1
%16 = icmp eq i32 %15, 33
br i1 %16, label %17, label %2
17: ; preds = %13
ret void
}