#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 *);
int main() {
  int i = 0, k = 0, numero, inverso, vetor[100];
  scanf("%d", &numero);
  while (numero > 0) {
    vetor[i] = 0;
    inverso = numero % 10;
    numero /= 10;
    vetor[i] = inverso;
    printf("Indice %d = %d\n", i, inverso);
    i++;
    k = i;
  }
  for (i = 0; i < k; i++) {
    printf("%d\n", vetor[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jle    11bb <main+0x9b>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x1b0(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f5 <main+0xd5>
movslq -0x8(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c2 <main+0xa2>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11c7 <main+0xa7>
mov    $0xcccccccd,%r15d
lea    0xead(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %edx,%eax
imul   %r15,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edx
mov    %eax,0xc(%rsp)
mov    %edx,0x10(%rsp,%rbx,4)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
mov    0xc(%rsp),%edx
test   %edx,%edx
jg     1160 <main+0x40>
test   %ebx,%ebx
je     11c7 <main+0xa7>
mov    %ebx,%r15d
lea    0xe6f(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11b0 <main+0x90>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Indice %d = %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @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 sgt i32 %6, 0
br i1 %7, label %13, label %31
8: ; preds = %13
%9 = trunc i64 %21 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %8
%12 = and i64 %21, 4294967295
br label %24
13: ; preds = %0, %13
%14 = phi i64 [ %21, %13 ], [ 0, %0 ]
%15 = phi i32 [ %22, %13 ], [ %6, %0 ]
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %14
%17 = urem i32 %15, 10
%18 = udiv i32 %15, 10
store i32 %18, i32* %1
store i32 %17, i32* %16
%19 = trunc i64 %14 to i32
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %17)
%21 = add nuw i64 %14, 1
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 0
br i1 %23, label %13, label %8
24: ; preds = %11, %24
%25 = phi i64 [ 0, %11 ], [ %29, %24 ]
%26 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i64 %25, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %31, label %24
31: ; preds = %24, %0, %8
ret i32 0
}