#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int bits[32];
  int index, i;
  int number, num;
  for (num = 100; num <= 128; num++) {
    index = 0;
    number = num;
    printf("Binary of Decimal %3d = ", number);
    while (number > 0) {
      bits[index] = number % 2;
      number = number / 2;
      index++;
    }
    for (i = index - 1; i >= 0; i--) {
      printf(" %1d", bits[i]);
    }
    printf("\n");
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0xa0(%rbp)
cmpl   $0x80,-0xa0(%rbp)
jg     1235 <main+0x115>
movl   $0x0,-0x94(%rbp)
mov    -0xa0(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x9c(%rbp)
jle    11c7 <main+0xa7>
mov    -0x9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x94(%rbp),%rax
mov    %edx,-0x90(%rbp,%rax,4)
mov    -0x9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x9c(%rbp)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1176 <main+0x56>
mov    -0x94(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jl     1213 <main+0xf3>
movslq -0x98(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x98(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x98(%rbp)
jmp    11d6 <main+0xb6>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    113c <main+0x1c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    $0x64,%r15d
lea    0xeb4(%rip),%r14
lea    0xec6(%rip),%r12
jmp    1177 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    $0x81,%r15d
je     11ed <main+0xbd>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rbx
mov    $0x1,%edx
mov    %r15d,%ecx
mov    %r15d,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %rdx,%rbp
mov    %ecx,%esi
and    $0x1,%esi
mov    %esi,0x4(%rsp,%rbx,4)
shr    %eax
add    $0x1,%rbx
add    $0x1,%rdx
cmp    $0x1,%ecx
mov    %eax,%ecx
ja     11a0 <main+0x70>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     1160 <main+0x30>
nopl   0x0(%rax)
mov    -0x8(%rsp,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
jg     11d0 <main+0xa0>
jmp    1160 <main+0x30>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Binary of Decimal %3d = \00"
@.str.1 = [5 x i8] c" %1d\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %6
br label %7
7: ; preds = %44, %0
%8 = load i32, i32* %6
%9 = icmp sle i32 %8, 128
br i1 %9, label %10, label %47
10: ; preds = %7
store i32 0, i32* %3
%11 = load i32, i32* %6
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %17, %10
%15 = load i32, i32* %5
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %5
%19 = srem i32 %18, 2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %21
store i32 %19, i32* %22
%23 = load i32, i32* %5
%24 = sdiv i32 %23, 2
store i32 %24, i32* %5
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %14
27: ; preds = %14
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %39, %27
%31 = load i32, i32* %4
%32 = icmp sge i32 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
br label %30
42: ; preds = %30
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %7
47: ; preds = %7
%48 = call i32 (...) @getchar()
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str = [25 x i8] c"Binary of Decimal %3d = \00"
@.str.1 = [5 x i8] c" %1d\00"
define i32 @main() {
%1 = alloca [32 x i32]
%2 = bitcast [32 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %24
%4 = phi i32 [ 100, %0 ], [ %26, %24 ]
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %3, %6
%7 = phi i64 [ 0, %3 ], [ %12, %6 ]
%8 = phi i32 [ %4, %3 ], [ %11, %6 ]
%9 = and i32 %8, 1
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 %7
store i32 %9, i32* %10
%11 = lshr i32 %8, 1
%12 = add nuw nsw i64 %7, 1
%13 = icmp ult i32 %8, 2
br i1 %13, label %14, label %6
14: ; preds = %6
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%16 = icmp eq i64 %7, 0
br i1 %16, label %24, label %17
17: ; preds = %14, %17
%18 = phi i64 [ %19, %17 ], [ %7, %14 ]
%19 = add nsw i64 %18, -1
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = icmp sgt i64 %18, 1
br i1 %23, label %17, label %24
24: ; preds = %17, %14
%25 = tail call i32 @putchar(i32 10)
%26 = add nuw nsw i32 %4, 1
%27 = icmp eq i32 %26, 129
br i1 %27, label %28, label %3
28: ; preds = %24
%29 = tail call i32 (...) @getchar()
ret i32 0
}