#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);
unsigned short strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  unsigned short n = strtol(argv[1], NULL, 10);
  for (char i = sizeof(unsigned short) * 8 - 1; i >= 0; i--) {
    putchar('0' + ((n >> i) & 1));
    if (i % 8 == 0)
      putchar(' ');
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %ax,-0x12(%rbp)
movb   $0xf,-0x13(%rbp)
movsbl -0x13(%rbp),%eax
cmp    $0x0,%eax
jl     11aa <main+0x8a>
movzwl -0x12(%rbp),%eax
movsbl -0x13(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
add    $0x30,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movsbl -0x13(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1198 <main+0x78>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    119d <main+0x7d>
mov    -0x13(%rbp),%al
add    $0xff,%al
mov    %al,-0x13(%rbp)
jmp    1154 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
movzwl %ax,%ebp
mov    $0xf,%ebx
jmp    1145 <main+0x25>
nopl   (%rax)
add    $0xffffffff,%ebx
jae    1168 <main+0x48>
mov    %ebp,%eax
mov    %ebx,%ecx
shr    %cl,%eax
and    $0x1,%al
or     $0x30,%al
movzbl %al,%edi
call   1030 <putchar@plt>
test   $0x7,%bl
jne    1140 <main+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call zeroext i16 @strtol(i8* %10, i32* null, i32 10)
store i16 %11, i16* %6
store i8 15, i8* %7
br label %12
12: ; preds = %33, %2
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load i16, i16* %6
%18 = zext i16 %17 to i32
%19 = load i8, i8* %7
%20 = sext i8 %19 to i32
%21 = ashr i32 %18, %20
%22 = and i32 %21, 1
%23 = add nsw i32 48, %22
%24 = trunc i32 %23 to i8
%25 = call i32 @putchar(i8 signext %24)
%26 = load i8, i8* %7
%27 = sext i8 %26 to i32
%28 = srem i32 %27, 8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %16
%31 = call i32 @putchar(i8 signext 32)
br label %32
32: ; preds = %30, %16
br label %33
33: ; preds = %32
%34 = load i8, i8* %7
%35 = add i8 %34, -1
store i8 %35, i8* %7
br label %12
36: ; preds = %12
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call zeroext i16 @strtol(i8* nocapture %4, i32* null, i32 10)
%6 = zext i16 %5 to i32
br label %8
7: ; preds = %19
ret i32 0
8: ; preds = %2, %19
%9 = phi i32 [ 15, %2 ], [ %20, %19 ]
%10 = lshr i32 %6, %9
%11 = trunc i32 %10 to i8
%12 = and i8 %11, 1
%13 = or i8 %12, 48
%14 = tail call i32 @putchar(i8 signext %13)
%15 = and i32 %9, 7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = tail call i32 @putchar(i8 signext 32)
br label %19
19: ; preds = %8, %17
%20 = add nsw i32 %9, -1
%21 = icmp eq i32 %9, 0
br i1 %21, label %7, label %8
}