#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 pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int decimal, n, n1, n2, n3, n4, n5, n6, n7, n8;
  printf("enter the number");
  scanf("%d", &n);
  n8 = n % 10;
  n7 = (n % 100 - n % 10) / 10;
  n6 = (n % 1000 - n % 100) / 100;
  n5 = (n % 10000 - n % 1000) / 1000;
  n4 = (n % 100000 - n % 10000) / 10000;
  n3 = (n % 1000000 - n % 100000) / 100000;
  n2 = (n % 10000000 - n % 1000000) / 1000000;
  n1 = (n % 100000000 - n % 10000000) / 10000000;
  printf("\n%d ==> %d %d %d %d %d %d %d %d", n, n1, n2, n3, n4, n5, n6, n7, n8);
  decimal = n1 * pow(2, 7) + n2 * pow(2, 6) + n3 * pow(2, 5) + n4 * pow(2, 4) +
            n5 * pow(2, 3) + n6 * pow(2, 2) + n7 * pow(2, 1) + n8 * pow(2, 0);
  printf("\ndecimal equavalent = %d", decimal);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xa8,%rsp
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x88(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x88(%rbp),%eax
sub    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x84(%rbp),%eax
sub    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x80(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    -0x80(%rbp),%eax
sub    %edx,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %edx,-0x7c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    -0x7c(%rbp),%eax
sub    %edx,%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,-0x78(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    -0x78(%rbp),%eax
sub    %edx,%eax
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x989680,%ecx
cltd
idiv   %ecx
mov    %edx,-0x74(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    -0x74(%rbp),%eax
sub    %edx,%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x5f5e100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x70(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x989680,%ecx
cltd
idiv   %ecx
mov    -0x70(%rbp),%eax
sub    %edx,%eax
mov    $0x989680,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x24(%rbp),%ebx
mov    -0x28(%rbp),%r11d
mov    -0x2c(%rbp),%r10d
mov    -0x30(%rbp),%eax
lea    0xd58(%rip),%rdi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    $0x2,%edi
mov    $0x7,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x64(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    $0x2,%edi
mov    $0x6,%esi
call   1050 <pow@plt>
mov    -0x68(%rbp),%ecx
mov    %eax,%edx
mov    -0x64(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    $0x2,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
mov    -0x60(%rbp),%ecx
mov    %eax,%edx
mov    -0x5c(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
mov    -0x58(%rbp),%ecx
mov    %eax,%edx
mov    -0x54(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
mov    -0x50(%rbp),%ecx
mov    %eax,%edx
mov    -0x4c(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1050 <pow@plt>
mov    -0x48(%rbp),%ecx
mov    %eax,%edx
mov    -0x44(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    $0x2,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    -0x40(%rbp),%ecx
mov    %eax,%edx
mov    -0x3c(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <pow@plt>
mov    -0x38(%rbp),%ecx
mov    %eax,%edx
mov    -0x34(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %esi,%ecx
sub    %eax,%ecx
mov    %rcx,%r11
mov    %rcx,0x8(%rsp)
imul   $0x51eb851f,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%ecx
mov    %esi,%r8d
sub    %ecx,%r8d
imul   $0x10624dd3,%rsi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%edx
mov    %esi,%r9d
sub    %edx,%r9d
imul   $0x68db8bad,%rsi,%rdx
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x2c,%rdx
add    %edi,%edx
imul   $0x2710,%edx,%edi
mov    %esi,%edx
sub    %edi,%edx
imul   $0x14f8b589,%rsi,%rdi
mov    %rdi,%rbp
shr    $0x3f,%rbp
sar    $0x2d,%rdi
add    %ebp,%edi
imul   $0x186a0,%edi,%ebp
mov    %esi,%edi
sub    %ebp,%edi
imul   $0x431bde83,%rsi,%rbp
mov    %rbp,%rbx
shr    $0x3f,%rbx
sar    $0x32,%rbp
add    %ebx,%ebp
imul   $0xf4240,%ebp,%ebx
mov    %esi,%ebp
sub    %ebx,%ebp
imul   $0x6b5fca6b,%rsi,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x36,%rbx
add    %eax,%ebx
imul   $0x989680,%ebx,%eax
mov    %esi,%ecx
sub    %eax,%ecx
imul   $0x55e63b89,%rsi,%rax
mov    %rax,%rbx
shr    $0x3f,%rbx
sar    $0x39,%rax
add    %ebx,%eax
imul   $0x5f5e100,%eax,%eax
mov    %esi,%ebx
sub    %eax,%ebx
sub    %ecx,%ebx
sub    %ebp,%ecx
mov    %ebp,%r10d
sub    %edi,%r10d
sub    %edx,%edi
sub    %r9d,%edx
sub    %r8d,%r9d
sub    %r11d,%r8d
movsbl %r8b,%ebp
imul   $0x67,%ebp,%ebp
movzwl %bp,%ebp
movswl %bp,%eax
shr    $0xf,%ebp
shr    $0xa,%eax
add    %bpl,%al
movsbl %al,%r11d
mov    %r11,0x10(%rsp)
movswl %r9w,%eax
imul   $0x147b,%eax,%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
sar    $0x13,%eax
add    %ebp,%eax
movswl %ax,%ebp
movswl %dx,%eax
imul   $0xffff8313,%eax,%eax
shr    $0x10,%eax
add    %edx,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
sar    $0x9,%edx
add    %eax,%edx
movswl %dx,%r14d
movslq %edi,%rax
imul   $0x68db8bad,%rax,%r15
mov    %r15,%rax
shr    $0x3f,%rax
sar    $0x2c,%r15
add    %eax,%r15d
movslq %r10d,%rax
imul   $0x14f8b589,%rax,%r12
mov    %r12,%rax
shr    $0x3f,%rax
sar    $0x2d,%r12
add    %eax,%r12d
movslq %ecx,%rax
imul   $0x431bde83,%rax,%r13
mov    %r13,%rax
shr    $0x3f,%rax
sar    $0x32,%r13
add    %eax,%r13d
movslq %ebx,%rax
imul   $0x6b5fca6b,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x36,%rbx
add    %eax,%ebx
lea    0xce6(%rip),%rdi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r12d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
push   0x8(%rsp)
push   %r11
push   %rbp
push   %r14
call   1030 <printf@plt>
add    $0x20,%rsp
mov    $0x2,%edi
mov    $0x7,%esi
call   1050 <pow@plt>
imul   %eax,%ebx
mov    $0x2,%edi
mov    $0x6,%esi
call   1050 <pow@plt>
imul   %eax,%r13d
add    %ebx,%r13d
mov    $0x2,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
imul   %eax,%r12d
add    %r13d,%r12d
mov    $0x2,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
imul   %eax,%r15d
add    %r12d,%r15d
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
imul   %eax,%r14d
add    %r15d,%r14d
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %rbp,%rcx
imul   %eax,%ecx
add    %r14d,%ecx
mov    %rcx,%rbx
mov    $0x2,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    0x10(%rsp),%rcx
imul   %eax,%ecx
add    %ebx,%ecx
mov    %rcx,%rbx
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <pow@plt>
mov    0x8(%rsp),%rsi
imul   %eax,%esi
add    %ebx,%esi
lea    0xc29(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"enter the number\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0A%d ==> %d %d %d %d %d %d %d %d\00"
@.str.3 = [25 x i8] c"\0Adecimal equavalent = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = srem i32 %13, 10
store i32 %14, i32* %10
%15 = load i32, i32* %2
%16 = srem i32 %15, 100
%17 = load i32, i32* %2
%18 = srem i32 %17, 10
%19 = sub nsw i32 %16, %18
%20 = sdiv i32 %19, 10
store i32 %20, i32* %9
%21 = load i32, i32* %2
%22 = srem i32 %21, 1000
%23 = load i32, i32* %2
%24 = srem i32 %23, 100
%25 = sub nsw i32 %22, %24
%26 = sdiv i32 %25, 100
store i32 %26, i32* %8
%27 = load i32, i32* %2
%28 = srem i32 %27, 10000
%29 = load i32, i32* %2
%30 = srem i32 %29, 1000
%31 = sub nsw i32 %28, %30
%32 = sdiv i32 %31, 1000
store i32 %32, i32* %7
%33 = load i32, i32* %2
%34 = srem i32 %33, 100000
%35 = load i32, i32* %2
%36 = srem i32 %35, 10000
%37 = sub nsw i32 %34, %36
%38 = sdiv i32 %37, 10000
store i32 %38, i32* %6
%39 = load i32, i32* %2
%40 = srem i32 %39, 1000000
%41 = load i32, i32* %2
%42 = srem i32 %41, 100000
%43 = sub nsw i32 %40, %42
%44 = sdiv i32 %43, 100000
store i32 %44, i32* %5
%45 = load i32, i32* %2
%46 = srem i32 %45, 10000000
%47 = load i32, i32* %2
%48 = srem i32 %47, 1000000
%49 = sub nsw i32 %46, %48
%50 = sdiv i32 %49, 1000000
store i32 %50, i32* %4
%51 = load i32, i32* %2
%52 = srem i32 %51, 100000000
%53 = load i32, i32* %2
%54 = srem i32 %53, 10000000
%55 = sub nsw i32 %52, %54
%56 = sdiv i32 %55, 10000000
store i32 %56, i32* %3
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %57, i32 %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 %65)
%67 = load i32, i32* %3
%68 = call i32 @pow(i32 2, i32 7)
%69 = mul nsw i32 %67, %68
%70 = load i32, i32* %4
%71 = call i32 @pow(i32 2, i32 6)
%72 = mul nsw i32 %70, %71
%73 = add nsw i32 %69, %72
%74 = load i32, i32* %5
%75 = call i32 @pow(i32 2, i32 5)
%76 = mul nsw i32 %74, %75
%77 = add nsw i32 %73, %76
%78 = load i32, i32* %6
%79 = call i32 @pow(i32 2, i32 4)
%80 = mul nsw i32 %78, %79
%81 = add nsw i32 %77, %80
%82 = load i32, i32* %7
%83 = call i32 @pow(i32 2, i32 3)
%84 = mul nsw i32 %82, %83
%85 = add nsw i32 %81, %84
%86 = load i32, i32* %8
%87 = call i32 @pow(i32 2, i32 2)
%88 = mul nsw i32 %86, %87
%89 = add nsw i32 %85, %88
%90 = load i32, i32* %9
%91 = call i32 @pow(i32 2, i32 1)
%92 = mul nsw i32 %90, %91
%93 = add nsw i32 %89, %92
%94 = load i32, i32* %10
%95 = call i32 @pow(i32 2, i32 0)
%96 = mul nsw i32 %94, %95
%97 = add nsw i32 %93, %96
store i32 %97, i32* %1
%98 = load i32, i32* %1
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %98)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"enter the number\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0A%d ==> %d %d %d %d %d %d %d %d\00"
@.str.3 = [25 x i8] c"\0Adecimal equavalent = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = srem i32 %5, 10
%7 = srem i32 %5, 100
%8 = sub nsw i32 %7, %6
%9 = trunc i32 %8 to i8
%10 = sdiv i8 %9, 10
%11 = sext i8 %10 to i32
%12 = srem i32 %5, 1000
%13 = sub nsw i32 %12, %7
%14 = trunc i32 %13 to i16
%15 = sdiv i16 %14, 100
%16 = sext i16 %15 to i32
%17 = srem i32 %5, 10000
%18 = sub nsw i32 %17, %12
%19 = trunc i32 %18 to i16
%20 = sdiv i16 %19, 1000
%21 = sext i16 %20 to i32
%22 = srem i32 %5, 100000
%23 = sub nsw i32 %22, %17
%24 = sdiv i32 %23, 10000
%25 = srem i32 %5, 1000000
%26 = sub nsw i32 %25, %22
%27 = sdiv i32 %26, 100000
%28 = srem i32 %5, 10000000
%29 = sub nsw i32 %28, %25
%30 = sdiv i32 %29, 1000000
%31 = srem i32 %5, 100000000
%32 = sub nsw i32 %31, %28
%33 = sdiv i32 %32, 10000000
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %33, i32 %30, i32 %27, i32 %24, i32 %21, i32 %16, i32 %11, i32 %6)
%35 = call i32 @pow(i32 2, i32 7)
%36 = mul nsw i32 %33, %35
%37 = call i32 @pow(i32 2, i32 6)
%38 = mul nsw i32 %30, %37
%39 = add nsw i32 %36, %38
%40 = call i32 @pow(i32 2, i32 5)
%41 = mul nsw i32 %40, %27
%42 = add nsw i32 %39, %41
%43 = call i32 @pow(i32 2, i32 4)
%44 = mul nsw i32 %43, %24
%45 = add nsw i32 %42, %44
%46 = call i32 @pow(i32 2, i32 3)
%47 = mul nsw i32 %46, %21
%48 = add nsw i32 %45, %47
%49 = call i32 @pow(i32 2, i32 2)
%50 = mul nsw i32 %49, %16
%51 = add nsw i32 %48, %50
%52 = call i32 @pow(i32 2, i32 1)
%53 = mul nsw i32 %52, %11
%54 = add nsw i32 %51, %53
%55 = call i32 @pow(i32 2, i32 0)
%56 = mul nsw i32 %55, %6
%57 = add nsw i32 %54, %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %57)
ret i32 0
}