#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__ eca_malloc(size_t, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int *ivector(int Lo, int High) {
  int *temp;
  temp = (int *)eca_malloc((size_t)((High - Lo + 2) * sizeof(int)),
                           "(size_t) ((High - Lo + 2) * sizeof(int))");
  if (temp == NULL) {
    printf("\n\nivector failed to allocate to array of length %d",
           High - Lo + 2);
    exit(1);
  }
  return (temp - Lo + 1);
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x2,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
lea    0xeab(%rip),%rsi
call   1040 <eca_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1188 <ivector+0x58>
mov    -0x8(%rbp),%esi
sub    -0x4(%rbp),%esi
add    $0x2,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sub    %edi,%ebx
movslq %ebx,%rax
lea    0x8(,%rax,4),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <eca_malloc@plt>
test   %rax,%rax
je     116a <ivector+0x3a>
movslq %ebp,%rcx
shl    $0x2,%rcx
sub    %rcx,%rax
add    $0x4,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0x2,%ebx
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"(size_t) ((High - Lo + 2) * sizeof(int))\00"
@.str.1 = [51 x i8] c"\0A\0Aivector failed to allocate to array of length %d\00"
define i32* @ivector(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* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 2
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = call i64 @eca_malloc(i64 %11, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = load i32*, i32** %5
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = add nsw i32 %19, 2
%21 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i32*, i32** %5
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = sub i64 0, %26
%28 = getelementptr inbounds i32, i32* %24, i64 %27
%29 = getelementptr inbounds i32, i32* %28, i64 1
ret i32* %29
}

LLVM IR (-O2):
@.str = [41 x i8] c"(size_t) ((High - Lo + 2) * sizeof(int))\00"
@.str.1 = [51 x i8] c"\0A\0Aivector failed to allocate to array of length %d\00"
define i32* @ivector(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = add nsw i32 %3, 2
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 2
%7 = tail call i64 @eca_malloc(i64 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = inttoptr i64 %7 to i32*
%14 = sext i32 %0 to i64
%15 = sub nsw i64 0, %14
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = getelementptr inbounds i32, i32* %16, i64 1
ret i32* %17
}