#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);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int temp, i, n, a[100];
  scanf("%d", &n);
  i = 0;
  while (n != 0) {
    temp = n % 10;
    n = n / 10;
    a[i] = temp;
    i++;
  }
  n = i;
  i = 0;
  while (i < n) {
    printf("%d", a[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
lea    0xece(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1184 <main+0x64>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x22>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c2 <main+0xa2>
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x71>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11ba <main+0x9a>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,0x10(%rsp,%rcx,4)
add    $0x1,%rcx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1150 <main+0x30>
mov    %ecx,0xc(%rsp)
test   %ecx,%ecx
jle    11ba <main+0x9a>
xor    %ebx,%ebx
lea    0xe6e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11a0 <main+0x80>
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
ret

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

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