int *ivector(nl, nh)
int nl, nh;
{
  int *v;
  v = (int *)(memset(malloc((unsigned)(nh - nl + 1) * sizeof(int)), 0,
                     (unsigned)(nh - nl + 1) * sizeof(int)));
  if (!v) {
    nrerror("allocation failure in ivector()");
    return (0);
  } else
    return v - nl;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %rdi,-0x20(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a1 <ivector+0x71>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <ivector+0x89>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
sub    %edi,%esi
add    $0x1,%esi
shl    $0x2,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
test   %rax,%rax
je     114c <ivector+0x2c>
mov    %rax,%rbx
movslq %ebp,%rax
shl    $0x2,%rax
sub    %rax,%rbx
jmp    115c <ivector+0x3c>
lea    0xead(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <nrerror@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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