#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(unsigned int, int);
int /*<<< orphan*/ errorHandler(char *);
scalar_t__ malloc(unsigned int);
unsigned int *uintVector(unsigned int LENGTH, unsigned int INIT) {
  unsigned int *V;
  if (!INIT) {
    if ((V = (unsigned int *)malloc(LENGTH * sizeof(unsigned int))) == NULL)
      errorHandler("Error - In uintVector(): Can't allocate memory");
  } else {
    if ((V = (unsigned int *)calloc(LENGTH, sizeof(unsigned int))) == NULL)
      errorHandler("Error - In uintVector(): Can't allocate memory");
  }
  return V;
}


x86 assembly (clang, -O0):
<uintVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1175 <uintVector+0x45>
mov    -0x4(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1170 <uintVector+0x40>
lea    0xe95(%rip),%rdi
call   1050 <errorHandler@plt>
jmp    11a1 <uintVector+0x71>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    119c <uintVector+0x6c>
lea    0xe69(%rip),%rdi
call   1050 <errorHandler@plt>
jmp    11a1 <uintVector+0x71>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uintVector>:
push   %rax
test   %esi,%esi
je     1146 <uintVector+0x16>
mov    $0x4,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1153 <uintVector+0x23>
pop    %rcx
ret
shl    $0x2,%edi
call   1040 <malloc@plt>
test   %rax,%rax
jne    1144 <uintVector+0x14>
lea    0xea6(%rip),%rdi
call   1050 <errorHandler@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Error - In uintVector(): Can't allocate memory\00"
define i32* @uintVector(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 = icmp ne i32 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %5
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = call i32 @errorHandler(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %8
br label %27
19: ; preds = %2
%20 = load i32, i32* %3
%21 = call i64 @calloc(i32 %20, i32 4)
%22 = inttoptr i64 %21 to i32*
store i32* %22, i32** %5
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @errorHandler(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %19
br label %27
27: ; preds = %26, %18
%28 = load i32*, i32** %5
ret i32* %28
}

LLVM IR (-O2):
@.str = [47 x i8] c"Error - In uintVector(): Can't allocate memory\00"
define i32* @uintVector(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = shl i32 %0, 2
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i32*
%8 = icmp eq i64 %6, 0
br i1 %8, label %13, label %15
9: ; preds = %2
%10 = tail call i64 @calloc(i32 %0, i32 4)
%11 = inttoptr i64 %10 to i32*
%12 = icmp eq i64 %10, 0
br i1 %12, label %13, label %15
13: ; preds = %9, %4
%14 = tail call i32 @errorHandler(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9, %4
%16 = phi i32* [ %11, %9 ], [ %7, %4 ], [ null, %13 ]
ret i32* %16
}