#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int *reservaVector(int nCol) {
  int *v;
  if ((v = (int *)calloc(nCol, sizeof(int))) == NULL) {
    printf("\nError en la reserva de memoria\n");
    exit(-1);
  } else {
    printf("\nLa reserva para %i elementos se ha realizado correctamente",
           nCol);
  }
  return (v);
}


x86 assembly (clang, -O0):
<reservaVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    116e <reservaVector+0x3e>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reservaVector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%esi
call   1050 <calloc@plt>
test   %rax,%rax
je     1171 <reservaVector+0x31>
mov    %rax,%rbx
lea    0xea2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0AError en la reserva de memoria\0A\00"
@.str.1 = [60 x i8] c"\0ALa reserva para %i elementos se ha realizado correctamente\00"
define i32* @reservaVector(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @calloc(i32 %4, i32 4)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11
%15 = load i32*, i32** %3
ret i32* %15
}

LLVM IR (-O2):
@.str.1 = [60 x i8] c"\0ALa reserva para %i elementos se ha realizado correctamente\00"
@str = [32 x i8] c"\0AError en la reserva de memoria\00"
define i32* @reservaVector(i32 %0) {
%2 = tail call i64 @calloc(i32 %0, i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
%8 = inttoptr i64 %2 to i32*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret i32* %8
}