#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*/ nrerror(char *);
scalar_t__ realloc(void **, size_t);
void **realloc_vvector(void **v, long nl, long nh, long n) {
  v += nl;
  v -= 0;
  v = (void **)realloc(v, (size_t)((nh - nl + 1 + n + 0) * sizeof(void *)));
  if (!v)
    nrerror("allocation failure in realloc vvector()");
  return v - nl + 0;
}


x86 assembly (clang, -O0):
<realloc_vvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
add    $0x1,%rsi
add    -0x20(%rbp),%rsi
add    $0x0,%rsi
shl    $0x3,%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    118c <realloc_vvector+0x6c>
lea    0xe79(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc_vvector>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    (%rdi,%rsi,8),%rdi
sub    %rsi,%rdx
add    %rcx,%rdx
lea    0x8(,%rdx,8),%rsi
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1152 <realloc_vvector+0x32>
lea    0xeb3(%rip),%rdi
call   1030 <nrerror@plt>
shl    $0x3,%r14
sub    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"allocation failure in realloc vvector()\00"
define i8** @realloc_vvector(i8** %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8** %0, i8*** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %6
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 %9
store i8** %11, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
store i8** %13, i8*** %5
%14 = load i8**, i8*** %5
%15 = load i64, i64* %7
%16 = load i64, i64* %6
%17 = sub nsw i64 %15, %16
%18 = add nsw i64 %17, 1
%19 = load i64, i64* %8
%20 = add nsw i64 %18, %19
%21 = add nsw i64 %20, 0
%22 = mul i64 %21, 8
%23 = call i64 @realloc(i8** %14, i64 %22)
%24 = inttoptr i64 %23 to i8**
store i8** %24, i8*** %5
%25 = load i8**, i8*** %5
%26 = icmp ne i8** %25, null
br i1 %26, label %29, label %27
27: ; preds = %4
%28 = call i32 @nrerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %4
%30 = load i8**, i8*** %5
%31 = load i64, i64* %6
%32 = sub i64 0, %31
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = getelementptr inbounds i8*, i8** %33, i64 0
ret i8** %34
}

LLVM IR (-O2):
@.str = [40 x i8] c"allocation failure in realloc vvector()\00"
define i8** @realloc_vvector(i8** %0, i64 %1, i64 %2, i64 %3) {
%5 = getelementptr inbounds i8*, i8** %0, i64 %1
%6 = sub i64 1, %1
%7 = add i64 %6, %2
%8 = add i64 %7, %3
%9 = shl i64 %8, 3
%10 = tail call i64 @realloc(i8** %5, i64 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = tail call i32 @nrerror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %4
%15 = sub i64 0, %1
%16 = inttoptr i64 %10 to i8**
%17 = getelementptr inbounds i8*, i8** %16, i64 %15
ret i8** %17
}