void readHB_newmat_double(filename, M, N, nonzeros, colptr, rowind,
                          val) char *filename;
int *M;
int *N;
int *nonzeros;
int **colptr;
int **rowind;
double **val;
{
  int nrhs;
  readHB_info(filename, M, N, nonzeros, &nrhs);
  *colptr = (int *)malloc((*N + 1) * sizeof(int));
  *rowind = (int *)malloc(*nonzeros * sizeof(int));
  *val = (double *)malloc(*nonzeros * sizeof(double));
  readHB_mat_double(filename, *colptr, *rowind, *val);
}


x86 assembly (clang, -O0):
<readHB_newmat_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x34(%rbp),%r8
mov    $0x0,%al
call   1030 <readHB_info@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movslq (%rax),%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movslq (%rax),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
mov    0x10(%rbp),%rax
mov    (%rax),%rcx
mov    $0x0,%al
call   1040 <readHB_mat_double@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readHB_newmat_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rdi,%r12
mov    0x40(%rsp),%rbp
lea    0x4(%rsp),%r8
xor    %eax,%eax
call   1030 <readHB_info@plt>
movslq (%rbx),%rax
lea    0x4(,%rax,4),%rdi
call   1050 <malloc@plt>
mov    %rax,(%r15)
movslq 0x0(%r13),%rbx
lea    0x0(,%rbx,4),%rdi
call   1050 <malloc@plt>
mov    %rax,(%r14)
shl    $0x3,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,0x0(%rbp)
mov    (%r15),%rsi
mov    (%r14),%rdx
mov    %r12,%rdi
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <readHB_mat_double@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @readHB_newmat_double(i8* %0, i32* %1, i32* %2, i32* %3, i32** %4, i32** %5, double** %6) {
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32**
%13 = alloca i32**
%14 = alloca double**
%15 = alloca i32
store i8* %0, i8** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i32** %4, i32*** %12
store i32** %5, i32*** %13
store double** %6, double*** %14
%16 = load i8*, i8** %8
%17 = load i32*, i32** %9
%18 = load i32*, i32** %10
%19 = load i32*, i32** %11
%20 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @readHB_info to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %16, i32* %17, i32* %18, i32* %19, i32* %15)
%21 = load i32*, i32** %10
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = mul i64 %24, 4
%26 = call i8* @malloc(i64 %25)
%27 = bitcast i8* %26 to i32*
%28 = load i32**, i32*** %12
store i32* %27, i32** %28
%29 = load i32*, i32** %11
%30 = load i32, i32* %29
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 4
%33 = call i8* @malloc(i64 %32)
%34 = bitcast i8* %33 to i32*
%35 = load i32**, i32*** %13
store i32* %34, i32** %35
%36 = load i32*, i32** %11
%37 = load i32, i32* %36
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 8
%40 = call i8* @malloc(i64 %39)
%41 = bitcast i8* %40 to double*
%42 = load double**, double*** %14
store double* %41, double** %42
%43 = load i8*, i8** %8
%44 = load i32**, i32*** %12
%45 = load i32*, i32** %44
%46 = load i32**, i32*** %13
%47 = load i32*, i32** %46
%48 = load double**, double*** %14
%49 = load double*, double** %48
%50 = call i32 (i8*, i32*, i32*, double*, ...) bitcast (i32 (...)* @readHB_mat_double to i32 (i8*, i32*, i32*, double*, ...)*)(i8* %43, i32* %45, i32* %47, double* %49)
ret void
}

LLVM IR (-O2):
define void @readHB_newmat_double(i8* %0, i32* %1, i32* %2, i32* %3, i32** nocapture %4, i32** nocapture %5, double** nocapture writeonly %6) {
%8 = alloca i32
%9 = bitcast i32* %8 to i8*
%10 = call i32 (i8*, i32*, i32*, i32*, i32*, ...) bitcast (i32 (...)* @readHB_info to i32 (i8*, i32*, i32*, i32*, i32*, ...)*)(i8* %0, i32* %1, i32* %2, i32* %3, i32* %8)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = shl nsw i64 %13, 2
%15 = call i8* @malloc(i64 %14)
%16 = bitcast i32** %4 to i8**
store i8* %15, i8** %16
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = shl nsw i64 %18, 2
%20 = call i8* @malloc(i64 %19)
%21 = bitcast i32** %5 to i8**
store i8* %20, i8** %21
%22 = shl nsw i64 %18, 3
%23 = call i8* @malloc(i64 %22)
%24 = bitcast i8* %23 to double*
%25 = bitcast double** %6 to i8**
store i8* %23, i8** %25
%26 = load i32*, i32** %4
%27 = load i32*, i32** %5
%28 = call i32 (i8*, i32*, i32*, double*, ...) bitcast (i32 (...)* @readHB_mat_double to i32 (i8*, i32*, i32*, double*, ...)*)(i8* %0, i32* %26, i32* %27, double* %24)
ret void
}