#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int n, temp, i;
  int bin[10];
  printf("Enter The Number: \n");
  scanf("%d", &n);
  for (i = 0; i < 7; i++)
    bin[i] = 0;
  i = 0;
  temp = n;
  while (temp != 0) {
    bin[i] = temp % 2;
    temp = temp / 2;
    i++;
  }
  printf("Number In Binary: ");
  for (i = 6; i >= 0; i--)
    printf("%d", bin[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    1171 <main+0x51>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x2d>
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11b7 <main+0x97>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0xc(%rbp),%rax
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <main+0x5e>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x6,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11fa <main+0xda>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11cc <main+0xac>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movups %xmm0,0x1c(%rsp)
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11c9 <main+0x99>
lea    0x10(%rsp),%rcx
mov    %eax,%edx
nopw   0x0(%rax,%rax,1)
shr    $0x1f,%edx
add    %eax,%edx
mov    %edx,%esi
and    $0xfffffffe,%esi
mov    %eax,%edi
sub    %esi,%edi
mov    %edi,(%rcx)
sar    %edx
add    $0x1,%eax
add    $0x4,%rcx
cmp    $0x2,%eax
mov    %edx,%eax
ja     1180 <main+0x50>
mov    0x28(%rsp),%r15d
mov    0x24(%rsp),%ebp
mov    0x20(%rsp),%ebx
mov    0x1c(%rsp),%r13d
mov    0x18(%rsp),%r12d
mov    0x10(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x4(%rsp)
jmp    11e6 <main+0xb6>
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
lea    0xe16(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe05(%rip),%r14
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Number In Binary: \00"
@str = [19 x i8] c"Enter The Number: \00"
define void @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %33, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %15, %9 ], [ 0, %0 ]
%11 = phi i32 [ %14, %9 ], [ %7, %0 ]
%12 = srem i32 %11, 2
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %10
store i32 %12, i32* %13
%14 = sdiv i32 %11, 2
%15 = add nuw i64 %10, 1
%16 = add i32 %11, 1
%17 = icmp ult i32 %16, 3
br i1 %17, label %18, label %9
18: ; preds = %9
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%20 = load i32, i32* %19
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%22 = load i32, i32* %21
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%26 = load i32, i32* %25
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%28 = load i32, i32* %27
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%30 = load i32, i32* %29
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %31
br label %33
33: ; preds = %18, %0
%34 = phi i32 [ %32, %18 ], [ 0, %0 ]
%35 = phi i32 [ %30, %18 ], [ 0, %0 ]
%36 = phi i32 [ %28, %18 ], [ 0, %0 ]
%37 = phi i32 [ %26, %18 ], [ 0, %0 ]
%38 = phi i32 [ %24, %18 ], [ 0, %0 ]
%39 = phi i32 [ %22, %18 ], [ 0, %0 ]
%40 = phi i32 [ %20, %18 ], [ 0, %0 ]
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
ret void
}