#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ inttob(int, int, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s [integer].\n", argv[0]);
    return -1;
  }
  int number = atoi(argv[1]);
  char result[sizeof(int) * 8 + 1] = {0};
  inttob(number, sizeof(int) * 8, result);
  printf("%d's binary is ", number);
  for (int i = 0; i <= sizeof(int) * 8; i++) {
    if (i % 4 == 0)
      putchar(' ');
    putchar(result[i]);
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1248 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    $0x20,%esi
call   1040 <inttob@plt>
mov    -0x14(%rbp),%esi
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
cmp    $0x20,%rax
ja     1237 <main+0xd7>
mov    -0x44(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    121b <main+0xbb>
mov    $0x20,%edi
call   1030 <putchar@plt>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11ef <main+0x8f>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
cmp    $0x2,%edi
jne    11c4 <main+0x74>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movb   $0x0,0x20(%rsp)
mov    %rsp,%rdx
mov    %eax,%edi
mov    $0x20,%esi
call   1040 <inttob@plt>
lea    0xe8a(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %ebx,%ebx
jmp    11b3 <main+0x63>
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x21,%rbx
je     11e3 <main+0x93>
test   $0x3,%bl
jne    11a0 <main+0x50>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x50>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe29(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    11ef <main+0x9f>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s [integer].\0A\00"
@.str.1 = [16 x i8] c"%d's binary is \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [33 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 -1, i32* %3
br label %49
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = bitcast [33 x i8]* %7 to i8*
%23 = load i32, i32* %6
%24 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%25 = call i32 @inttob(i32 %23, i32 32, i8* %24)
%26 = load i32, i32* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %26)
store i32 0, i32* %8
br label %28
28: ; preds = %44, %17
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = icmp ule i64 %30, 32
br i1 %31, label %32, label %47
32: ; preds = %28
%33 = load i32, i32* %8
%34 = srem i32 %33, 4
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @putchar(i8 signext 32)
br label %38
38: ; preds = %36, %32
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = call i32 @putchar(i8 signext %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %28
47: ; preds = %28
%48 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %3
br label %49
49: ; preds = %47, %11
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s [integer].\0A\00"
@.str.1 = [16 x i8] c"%d's binary is \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [33 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %30
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%14 = call i32 @inttob(i32 %12, i32 32, i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %18
16: ; preds = %24
%17 = call i32 @putchar(i8 signext 10)
br label %30
18: ; preds = %9, %24
%19 = phi i64 [ 0, %9 ], [ %28, %24 ]
%20 = and i64 %19, 3
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @putchar(i8 signext 32)
br label %24
24: ; preds = %22, %18
%25 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 %19
%26 = load i8, i8* %25
%27 = call i32 @putchar(i8 signext %26)
%28 = add nuw nsw i64 %19, 1
%29 = icmp eq i64 %28, 33
br i1 %29, label %16, label %18
30: ; preds = %16, %5
%31 = phi i32 [ -1, %5 ], [ 0, %16 ]
ret i32 %31
}