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


x86 assembly (clang, -O0):
<dvector>:
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    $0x3,%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    $0x3,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a1 <dvector+0x71>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <dvector+0x89>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
sub    %edi,%esi
add    $0x1,%esi
shl    $0x3,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
test   %rax,%rax
je     114c <dvector+0x2c>
mov    %rax,%rbx
movslq %ebp,%rax
shl    $0x3,%rax
sub    %rax,%rbx
jmp    115c <dvector+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 dvector()\00"
define double* @dvector(i32 %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
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, 8
%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, 8
%20 = bitcast i8* %13 to double*
store double* %20, double** %6
%21 = load double*, double** %6
%22 = icmp ne double* %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 double* null, double** %3
br label %31
25: ; preds = %2
%26 = load double*, double** %6
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = sub i64 0, %28
%30 = getelementptr inbounds double, double* %26, i64 %29
store double* %30, double** %3
br label %31
31: ; preds = %25, %23
%32 = load double*, double** %3
ret double* %32
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in dvector()\00"
define double* @dvector(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, 3
%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 double*
%13 = sext i32 %0 to i64
%14 = sub nsw i64 0, %13
%15 = getelementptr inbounds double, double* %12, i64 %14
br label %16
16: ; preds = %11, %9
%17 = phi double* [ %15, %11 ], [ null, %9 ]
ret double* %17
}