#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 *malloc(int);
int /*<<< orphan*/ mostra(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ revec(int *, int /*<<< orphan*/, int);
int scanf(char *, int *);
int main() {
  int *v = NULL, tam = 0;
  int lido = 0;
  v = malloc(sizeof(int) * 100);
  while (scanf("%d ", &lido) == 1) {
    v[tam] = lido;
    tam++;
  }
  mostra(v, tam);
  printf("O reverso é\n");
  revec(v, 0, tam - 1);
  mostra(v, tam);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x190,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe76(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11b8 <main+0x68>
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <main+0x33>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <mostra@plt>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1070 <revec@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <mostra@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
mov    $0x190,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xe8c(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
jne    11bc <main+0x6c>
xor    %ebx,%ebx
lea    0xe72(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x4(%rsp),%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     11a0 <main+0x50>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <mostra@plt>
lea    0xe37(%rip),%rdi
call   1030 <puts@plt>
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <revec@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <mostra@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [14 x i8] c"O reverso \C3\A9\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32* @malloc(i32 400)
store i32* %5, i32** %2
br label %6
6: ; preds = %9, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
store i32 %10, i32* %14
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = load i32*, i32** %2
%19 = load i32, i32* %3
%20 = call i32 @mostra(i32* %18, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32*, i32** %2
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 1
%25 = call i32 @revec(i32* %22, i32 0, i32 %24)
%26 = load i32*, i32** %2
%27 = load i32, i32* %3
%28 = call i32 @mostra(i32* %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@str = [13 x i8] c"O reverso \C3\A9\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32* @malloc(i32 400)
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %15
6: ; preds = %0, %6
%7 = phi i64 [ %10, %6 ], [ 0, %0 ]
%8 = load i32, i32* %1
%9 = getelementptr inbounds i32, i32* %3, i64 %7
store i32 %8, i32* %9
%10 = add nuw i64 %7, 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = icmp eq i32 %11, 1
br i1 %12, label %6, label %13
13: ; preds = %6
%14 = trunc i64 %10 to i32
br label %15
15: ; preds = %13, %0
%16 = phi i32 [ 0, %0 ], [ %14, %13 ]
%17 = call i32 @mostra(i32* %3, i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%19 = add nsw i32 %16, -1
%20 = call i32 @revec(i32* %3, i32 0, i32 %19)
%21 = call i32 @mostra(i32* %3, i32 %16)
ret i32 0
}