#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 *alocar(int);
int /*<<< orphan*/ imprimir(int *, int);
int /*<<< orphan*/ ler(int *, int);
int /*<<< orphan*/ liberar(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int n, i;
  int *p;
  printf("Informe a quantidade: ");
  scanf("%d", &n);
  p = alocar(n);
  if (p == NULL) {
    printf("Memoria insuficiente!\n");
  } else {
    ler(p, n);
    imprimir(p, n);
    liberar(p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <alocar@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11ba <main+0x5a>
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
jmp    11db <main+0x7b>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <ler@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <imprimir@plt>
mov    -0x20(%rbp),%rdi
call   1080 <liberar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
call   1060 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <alocar@plt>
test   %rax,%rax
je     11c5 <main+0x55>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
mov    %rax,%rdi
call   1030 <ler@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <imprimir@plt>
mov    %rbx,%rdi
call   1090 <liberar@plt>
jmp    11d1 <main+0x61>
lea    0xe4e(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Informe a quantidade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Memoria insuficiente!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%11 = load i32, i32* %6
%12 = call i32* @alocar(i32 %11)
store i32* %12, i32** %8
%13 = load i32*, i32** %8
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %26
17: ; preds = %2
%18 = load i32*, i32** %8
%19 = load i32, i32* %6
%20 = call i32 @ler(i32* %18, i32 %19)
%21 = load i32*, i32** %8
%22 = load i32, i32* %6
%23 = call i32 @imprimir(i32* %21, i32 %22)
%24 = load i32*, i32** %8
%25 = call i32 @liberar(i32* %24)
br label %26
26: ; preds = %17, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Informe a quantidade: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [22 x i8] c"Memoria insuficiente!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32* @alocar(i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %18
12: ; preds = %2
%13 = load i32, i32* %3
%14 = call i32 @ler(i32* %8, i32 %13)
%15 = load i32, i32* %3
%16 = call i32 @imprimir(i32* %8, i32 %15)
%17 = call i32 @liberar(i32* %8)
br label %18
18: ; preds = %12, %10
ret i32 0
}