// File: /workspace/github_c_makefile_star2_O0/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_banner
int mm_read_banner(FILE *f, MM_typecode *matcode)
{
    char line[MM_MAX_LINE_LENGTH];
    char banner[MM_MAX_TOKEN_LENGTH];
    char mtx[MM_MAX_TOKEN_LENGTH]; 
    char crd[MM_MAX_TOKEN_LENGTH];
    char data_type[MM_MAX_TOKEN_LENGTH];
    char storage_scheme[MM_MAX_TOKEN_LENGTH];
    char *p;


    mm_clear_typecode(matcode);  

    if (fgets(line, MM_MAX_LINE_LENGTH, f) == NULL) 
        return MM_PREMATURE_EOF;

    if (sscanf(line, "%s %s %s %s %s", banner, mtx, crd, data_type, 
        storage_scheme) != 5)
        return MM_PREMATURE_EOF;

    for (p=mtx; *p!='\0'; *p=tolower(*p),p++);  /* convert to lower case */
    for (p=crd; *p!='\0'; *p=tolower(*p),p++);  
    for (p=data_type; *p!='\0'; *p=tolower(*p),p++);
    for (p=storage_scheme; *p!='\0'; *p=tolower(*p),p++);

    /* check for banner */
    if (strncmp(banner, MatrixMarketBanner, strlen(MatrixMarketBanner)) != 0)
        return MM_NO_HEADER;

    /* first field should be "mtx" */
    if (strcmp(mtx, MM_MTX_STR) != 0)
        return  MM_UNSUPPORTED_TYPE;
    mm_set_matrix(matcode);


    /* second field describes whether this is a sparse matrix (in coordinate
            storgae) or a dense array */


    if (strcmp(crd, MM_SPARSE_STR) == 0)
        mm_set_sparse(matcode);
    else
    if (strcmp(crd, MM_DENSE_STR) == 0)
            mm_set_dense(matcode);
    else
        return MM_UNSUPPORTED_TYPE;
    

    /* third field */

    if (strcmp(data_type, MM_REAL_STR) == 0)
        mm_set_real(matcode);
    else
    if (strcmp(data_type, MM_COMPLEX_STR) == 0)
        mm_set_complex(matcode);
    else
    if (strcmp(data_type, MM_PATTERN_STR) == 0)
        mm_set_pattern(matcode);
    else
    if (strcmp(data_type, MM_INT_STR) == 0)
        mm_set_integer(matcode);
    else
        return MM_UNSUPPORTED_TYPE;
    

    /* fourth field */

    if (strcmp(storage_scheme, MM_GENERAL_STR) == 0)
        mm_set_general(matcode);
    else
    if (strcmp(storage_scheme, MM_SYMM_STR) == 0)
        mm_set_symmetric(matcode);
    else
    if (strcmp(storage_scheme, MM_HERM_STR) == 0)
        mm_set_hermitian(matcode);
    else
    if (strcmp(storage_scheme, MM_SKEW_STR) == 0)
        mm_set_skew(matcode);
    else
        return MM_UNSUPPORTED_TYPE;
        

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x570, %rsp            # imm = 0x570
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $0x20, 0x2(%rax)
movq -0x18(%rbp), %rax
movb $0x20, 0x1(%rax)
movq -0x18(%rbp), %rax
movb $0x20, (%rax)
movq -0x18(%rbp), %rax
movb $0x47, 0x3(%rax)
leaq -0x420(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x401, %esi            # imm = 0x401
callq 0x10c0
cmpq $0x0, %rax
jne 0x1509
movl $0xc, -0x4(%rbp)
jmp 0x1868
leaq -0x420(%rbp), %rdi
leaq -0x460(%rbp), %rdx
leaq -0x4a0(%rbp), %rcx
leaq -0x4e0(%rbp), %r8
leaq -0x520(%rbp), %r9
leaq -0x560(%rbp), %rax
leaq 0x2b9d(%rip), %rsi      # 0x40d7
movq %rax, (%rsp)
movb $0x0, %al
callq 0x1120
cmpl $0x5, %eax
je 0x1556
movl $0xc, -0x4(%rbp)
jmp 0x1868
leaq -0x4a0(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x15a3
jmp 0x1575
movq -0x568(%rbp), %rax
movsbl (%rax), %edi
callq 0x1100
movb %al, %cl
movq -0x568(%rbp), %rax
movb %cl, (%rax)
movq -0x568(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x568(%rbp)
jmp 0x1564
leaq -0x4e0(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x15f0
jmp 0x15c2
movq -0x568(%rbp), %rax
movsbl (%rax), %edi
callq 0x1100
movb %al, %cl
movq -0x568(%rbp), %rax
movb %cl, (%rax)
movq -0x568(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x568(%rbp)
jmp 0x15b1
leaq -0x520(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x163d
jmp 0x160f
movq -0x568(%rbp), %rax
movsbl (%rax), %edi
callq 0x1100
movb %al, %cl
movq -0x568(%rbp), %rax
movb %cl, (%rax)
movq -0x568(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x568(%rbp)
jmp 0x15fe
leaq -0x560(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x168a
jmp 0x165c
movq -0x568(%rbp), %rax
movsbl (%rax), %edi
callq 0x1100
movb %al, %cl
movq -0x568(%rbp), %rax
movb %cl, (%rax)
movq -0x568(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x568(%rbp)
jmp 0x164b
leaq -0x460(%rbp), %rdi
leaq 0x2a4e(%rip), %rsi      # 0x40e6
movl $0xe, %edx
callq 0x1040
cmpl $0x0, %eax
je 0x16b3
movl $0xe, -0x4(%rbp)
jmp 0x1868
leaq -0x4a0(%rbp), %rdi
leaq 0x2a34(%rip), %rsi      # 0x40f5
callq 0x10e0
cmpl $0x0, %eax
je 0x16d7
movl $0xf, -0x4(%rbp)
jmp 0x1868
movq -0x18(%rbp), %rax
movb $0x4d, (%rax)
leaq -0x4e0(%rbp), %rdi
leaq 0x2a10(%rip), %rsi      # 0x40fc
callq 0x10e0
cmpl $0x0, %eax
jne 0x1700
movq -0x18(%rbp), %rax
movb $0x43, 0x1(%rax)
jmp 0x1730
leaq -0x4e0(%rbp), %rdi
leaq 0x29f9(%rip), %rsi      # 0x4107
callq 0x10e0
cmpl $0x0, %eax
jne 0x1722
movq -0x18(%rbp), %rax
movb $0x41, 0x1(%rax)
jmp 0x172e
movl $0xf, -0x4(%rbp)
jmp 0x1868
jmp 0x1730
leaq -0x520(%rbp), %rdi
leaq 0x29cf(%rip), %rsi      # 0x410d
callq 0x10e0
cmpl $0x0, %eax
jne 0x1752
movq -0x18(%rbp), %rax
movb $0x52, 0x2(%rax)
jmp 0x17ca
leaq -0x520(%rbp), %rdi
leaq 0x29b2(%rip), %rsi      # 0x4112
callq 0x10e0
cmpl $0x0, %eax
jne 0x1774
movq -0x18(%rbp), %rax
movb $0x43, 0x2(%rax)
jmp 0x17c8
leaq -0x520(%rbp), %rdi
leaq 0x2998(%rip), %rsi      # 0x411a
callq 0x10e0
cmpl $0x0, %eax
jne 0x1796
movq -0x18(%rbp), %rax
movb $0x50, 0x2(%rax)
jmp 0x17c6
leaq -0x520(%rbp), %rdi
leaq 0x297e(%rip), %rsi      # 0x4122
callq 0x10e0
cmpl $0x0, %eax
jne 0x17b8
movq -0x18(%rbp), %rax
movb $0x49, 0x2(%rax)
jmp 0x17c4
movl $0xf, -0x4(%rbp)
jmp 0x1868
jmp 0x17c6
jmp 0x17c8
jmp 0x17ca
leaq -0x560(%rbp), %rdi
leaq 0x2952(%rip), %rsi      # 0x412a
callq 0x10e0
cmpl $0x0, %eax
jne 0x17ec
movq -0x18(%rbp), %rax
movb $0x47, 0x3(%rax)
jmp 0x1861
leaq -0x560(%rbp), %rdi
leaq 0x2947(%rip), %rsi      # 0x4141
callq 0x10e0
cmpl $0x0, %eax
jne 0x180e
movq -0x18(%rbp), %rax
movb $0x53, 0x3(%rax)
jmp 0x185f
leaq -0x560(%rbp), %rdi
leaq 0x2916(%rip), %rsi      # 0x4132
callq 0x10e0
cmpl $0x0, %eax
jne 0x1830
movq -0x18(%rbp), %rax
movb $0x48, 0x3(%rax)
jmp 0x185d
leaq -0x560(%rbp), %rdi
leaq 0x28fe(%rip), %rsi      # 0x413c
callq 0x10e0
cmpl $0x0, %eax
jne 0x1852
movq -0x18(%rbp), %rax
movb $0x4b, 0x3(%rax)
jmp 0x185b
movl $0xf, -0x4(%rbp)
jmp 0x1868
jmp 0x185d
jmp 0x185f
jmp 0x1861
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x570, %rsp            # imm = 0x570
popq %rbp
retq
nopw %cs:(%rax,%rax)