#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 *, ...);
void imprimir(int vet[10], int *topo) {
  if (*topo == -1) {
    printf("\n\a\tA pilha esta vazia!\n");
    return;
  }
  printf("\n\tPilha:\n");
  int i;
  for (i = *topo; i >= 0; --i)
    printf("\t\t%d\n", vet[i]);
  return;
}


x86 assembly (clang, -O0):
<imprimir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1140 <imprimir+0x30>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118d <imprimir+0x7d>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1188 <imprimir+0x78>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <imprimir+0x47>
jmp    118d <imprimir+0x7d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimir>:
push   %r15
push   %r14
push   %rbx
cmpl   $0xffffffff,(%rsi)
je     116a <imprimir+0x4a>
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%ebx
test   %ebx,%ebx
js     1164 <imprimir+0x44>
lea    0xeb6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jb     1150 <imprimir+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe9e(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0A\07\09A pilha esta vazia!\0A\00"
@.str.1 = [10 x i8] c"\0A\09Pilha:\0A\00"
@.str.2 = [6 x i8] c"\09\09%d\0A\00"
define void @imprimir(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %29
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
store i32 %14, i32* %5
br label %15
15: ; preds = %25, %11
%16 = load i32, i32* %5
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32*, i32** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = add nsw i32 %26, -1
store i32 %27, i32* %5
br label %15
28: ; preds = %15
br label %29
29: ; preds = %28, %9
ret void
}

LLVM IR (-O2):
@.str.2 = [6 x i8] c"\09\09%d\0A\00"
@str = [9 x i8] c"\0A\09Pilha:\00"
@str.3 = [23 x i8] c"\0A\07\09A pilha esta vazia!\00"
define void @imprimir(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
br label %20
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, -1
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = zext i32 %9 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ %12, %11 ], [ %18, %13 ]
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nsw i64 %14, -1
%19 = icmp eq i64 %14, 0
br i1 %19, label %20, label %13
20: ; preds = %13, %7, %5
ret void
}