#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 *);
int main() {
  int numero, vetor[8], inverte[8], i, add, divide = 10000000, troca = 4;
  scanf("%d", &numero);
  for (i = 0; i < 8; i++) {
    vetor[i] = 0;
    add = numero / divide;
    numero %= divide;
    vetor[i] = add;
    divide /= 10;
  }
  for (i = 0; i < 8; i++) {
    inverte[i] = 0;
    inverte[i] = vetor[troca];
    if (troca == 7) {
      troca = -1;
    }
    troca++;
  }
  printf("Vetor na ordem digitada:\n");
  for (i = 0; i < 8; i++) {
    printf("posição: %d %d\n", i, vetor[i]);
  }
  printf("\nVetor na posição invertida:\n");
  for (i = 0; i < 8; i++) {
    printf("Posição: %d %d\n", i, inverte[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x989680,-0x5c(%rbp)
movl   $0x4,-0x60(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
jge    11a7 <main+0x87>
movslq -0x54(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x5c(%rbp)
mov    %eax,-0x58(%rbp)
mov    -0x5c(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x58(%rbp),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x5c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1154 <main+0x34>
movl   $0x0,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
jge    11fc <main+0xdc>
movslq -0x54(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
movslq -0x60(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
cmpl   $0x7,-0x60(%rbp)
jne    11e5 <main+0xc5>
movl   $0xffffffff,-0x60(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11ae <main+0x8e>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
jge    1242 <main+0x122>
mov    -0x54(%rbp),%esi
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1211 <main+0xf1>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
jge    1288 <main+0x168>
mov    -0x54(%rbp),%esi
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1257 <main+0x137>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0x6b5fca6b,%rax,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x36,%rdx
add    %ecx,%edx
mov    %rdx,0x10(%rsp)
imul   $0x989680,%edx,%ecx
sub    %ecx,%eax
cltq
imul   $0x431bde83,%rax,%r15
mov    %r15,%rcx
shr    $0x3f,%rcx
sar    $0x32,%r15
add    %ecx,%r15d
imul   $0xf4240,%r15d,%ecx
mov    %r15,0x20(%rsp)
sub    %ecx,%eax
cltq
imul   $0x14f8b589,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x2d,%rbx
add    %ecx,%ebx
imul   $0x186a0,%ebx,%ecx
mov    %rbx,0x18(%rsp)
sub    %ecx,%eax
cltq
imul   $0x68db8bad,%rax,%r14
mov    %r14,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%r14
add    %ecx,%r14d
imul   $0x2710,%r14d,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8313,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x9,%edx
add    %ecx,%edx
movswl %dx,%ecx
mov    %ecx,0xc(%rsp)
imul   $0x3e8,%edx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0x147b,%ecx,%ebp
mov    %ebp,%ecx
shr    $0x1f,%ecx
sar    $0x13,%ebp
add    %ecx,%ebp
imul   $0x64,%ebp,%ecx
sub    %ecx,%eax
movsbl %al,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
shr    $0xa,%edx
add    %cl,%dl
movsbl %dl,%r12d
movzbl %r12b,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%eax
mov    %eax,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xdce(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9e(%rip),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x2,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x3,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x4,%esi
mov    0xc(%rsp),%r15d
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x5,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x6,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    $0x7,%esi
mov    0x8(%rsp),%r13d
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xd06(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    0x20(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [26 x i8] c"Vetor na ordem digitada:\0A\00"
@.str.2 = [18 x i8] c"posi\C3\A7\C3\A3o: %d %d\0A\00"
@.str.3 = [32 x i8] c"\0AVetor na posi\C3\A7\C3\A3o invertida:\0A\00"
@.str.4 = [18 x i8] c"Posi\C3\A7\C3\A3o: %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i32]
%4 = alloca [8 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 10000000, i32* %7
store i32 4, i32* %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %10
10: ; preds = %29, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %15
store i32 0, i32* %16
%17 = load i32, i32* %2
%18 = load i32, i32* %7
%19 = sdiv i32 %17, %18
store i32 %19, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %2
%22 = srem i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %25
store i32 %23, i32* %26
%27 = load i32, i32* %7
%28 = sdiv i32 %27, 10
store i32 %28, i32* %7
br label %29
29: ; preds = %13
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %10
32: ; preds = %10
store i32 0, i32* %5
br label %33
33: ; preds = %53, %32
%34 = load i32, i32* %5
%35 = icmp slt i32 %34, 8
br i1 %35, label %36, label %56
36: ; preds = %33
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 %38
store i32 0, i32* %39
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 %45
store i32 %43, i32* %46
%47 = load i32, i32* %8
%48 = icmp eq i32 %47, 7
br i1 %48, label %49, label %50
49: ; preds = %36
store i32 -1, i32* %8
br label %50
50: ; preds = %49, %36
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
br label %53
53: ; preds = %50
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %33
56: ; preds = %33
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %58
58: ; preds = %68, %56
%59 = load i32, i32* %5
%60 = icmp slt i32 %59, 8
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = load i32, i32* %5
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %62, i32 %66)
br label %68
68: ; preds = %61
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %5
br label %58
71: ; preds = %58
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %73
73: ; preds = %83, %71
%74 = load i32, i32* %5
%75 = icmp slt i32 %74, 8
br i1 %75, label %76, label %86
76: ; preds = %73
%77 = load i32, i32* %5
%78 = load i32, i32* %5
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %77, i32 %81)
br label %83
83: ; preds = %76
%84 = load i32, i32* %5
%85 = add nsw i32 %84, 1
store i32 %85, i32* %5
br label %73
86: ; preds = %73
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"posi\C3\A7\C3\A3o: %d %d\0A\00"
@.str.4 = [18 x i8] c"Posi\C3\A7\C3\A3o: %d %d\0A\00"
@str = [25 x i8] c"Vetor na ordem digitada:\00"
@str.5 = [31 x i8] c"\0AVetor na posi\C3\A7\C3\A3o invertida:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = sdiv i32 %4, 10000000
%6 = srem i32 %4, 10000000
%7 = sdiv i32 %6, 1000000
%8 = srem i32 %6, 1000000
%9 = sdiv i32 %8, 100000
%10 = srem i32 %8, 100000
%11 = sdiv i32 %10, 10000
%12 = srem i32 %10, 10000
%13 = trunc i32 %12 to i16
%14 = sdiv i16 %13, 1000
%15 = sext i16 %14 to i32
%16 = trunc i32 %12 to i16
%17 = srem i16 %16, 1000
%18 = sdiv i16 %17, 100
%19 = sext i16 %18 to i32
%20 = srem i16 %17, 100
%21 = trunc i16 %20 to i8
%22 = sdiv i8 %21, 10
%23 = sext i8 %22 to i32
%24 = trunc i16 %20 to i8
%25 = srem i8 %24, 10
%26 = sext i8 %25 to i32
store i32 0, i32* %1
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %5)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %7)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %9)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %11)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %15)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %19)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %23)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %26)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.5, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 %15)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 %19)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 %23)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 3, i32 %26)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 %5)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 5, i32 %7)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 6, i32 %9)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 7, i32 %11)
ret i32 0
}