// File: /workspace/github_c_makefile_star2_O0/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd
int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **I, int **J, 
        double **val, MM_typecode *matcode)
{
    int ret_code;
    FILE *f;

    if (strcmp(fname, "stdin") == 0) f=stdin;
    else
    if ((f = fopen(fname, "r")) == NULL)
        return MM_COULD_NOT_READ_FILE;


    if ((ret_code = mm_read_banner(f, matcode)) != 0)
        return ret_code;

    if (!(mm_is_valid(*matcode) && mm_is_sparse(*matcode) && 
            mm_is_matrix(*matcode)))
        return MM_UNSUPPORTED_TYPE;

    if ((ret_code = mm_read_mtx_crd_size(f, M, N, nz)) != 0)
        return ret_code;


    *I = (int *)  malloc(*nz * sizeof(int));
    *J = (int *)  malloc(*nz * sizeof(int));
    *val = NULL;

    if (mm_is_complex(*matcode))
    {
        *val = (double *) malloc(*nz * 2 * sizeof(double));
        ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val, 
                *matcode);
        if (ret_code != 0) return ret_code;
    }
    else if (mm_is_real(*matcode))
    {
        *val = (double *) malloc(*nz * sizeof(double));
        ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val, 
                *matcode);
        if (ret_code != 0) return ret_code;
    }

    else if (mm_is_pattern(*matcode))
    {
        ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val, 
                *matcode);
        if (ret_code != 0) return ret_code;
    }

    if (f != stdin) fclose(f);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x20f9(%rip), %rsi      # 0x416c
callq 0x10e0
cmpl $0x0, %eax
jne 0x208d
movq 0x3f54(%rip), %rax      # 0x5fd8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x20b5
movq -0x10(%rbp), %rdi
leaq 0x2090(%rip), %rsi      # 0x4128
callq 0x1130
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jne 0x20b3
movl $0xb, -0x4(%rbp)
jmp 0x22eb
jmp 0x20b5
movq -0x48(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x14b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x20d5
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22eb
movq 0x18(%rbp), %rdi
callq 0x1b60
cmpl $0x0, %eax
je 0x20fc
movq 0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x43, %eax
jne 0x20fc
movq 0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0x2108
movl $0xf, -0x4(%rbp)
jmp 0x22eb
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x1a60
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x2130
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22eb
movq -0x28(%rbp), %rax
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq 0x18(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x43, %eax
jne 0x21f0
movq -0x28(%rbp), %rax
movl (%rax), %eax
shll %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %r8
movq -0x38(%rbp), %rax
movq (%rax), %r9
movq 0x10(%rbp), %rax
movq (%rax), %r10
movq 0x18(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1d80
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x21eb
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22eb
jmp 0x22cb
movq 0x18(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x52, %eax
jne 0x226a
movq -0x28(%rbp), %rax
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %r8
movq -0x38(%rbp), %rax
movq (%rax), %r9
movq 0x10(%rbp), %rax
movq (%rax), %r10
movq 0x18(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1d80
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x2268
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22eb
jmp 0x22c9
movq 0x18(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x50, %eax
jne 0x22c7
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %r8
movq -0x38(%rbp), %rax
movq (%rax), %r9
movq 0x10(%rbp), %rax
movq (%rax), %r10
movq 0x18(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1d80
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x22c5
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22eb
jmp 0x22c7
jmp 0x22c9
jmp 0x22cb
movq -0x48(%rbp), %rax
movq 0x3d02(%rip), %rcx      # 0x5fd8
cmpq (%rcx), %rax
je 0x22e4
movq -0x48(%rbp), %rdi
callq 0x1080
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)