// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/processtab/tabparser.c
// Function: parseCourse
ASTCourse *
parseCourse(FILE *in)
    {
    ASTCourse *c = newASTCourse();
    ASTMeasure *m;
    char ch;
    char buffer[AST_COURSE_NAME_LENGTH_MAX];
    int index = 0;
    
    /* expect and consume first pipe character */
    ch = fgetc(in);
    if (ch != '|')
        {
        Fatal("expected '|', found '%c'\n", ch);
        return 0;
        }
    
    while ((ch = fgetc(in)) && ch != '|')
        {
            if (index == AST_COURSE_NAME_LENGTH_MAX - 1)
                {
                Fatal("course name cannot be longer than %i characters\n", AST_COURSE_NAME_LENGTH_MAX - 1);
                return 0;
                }
            if (ch == EOF)
                {
                Fatal("unexpected EOF reading course name\n");
                return 0;
                }
            if (ch == '\n')
                {
                Fatal("unexpected newline reading course name\n");
                return 0;
                }

            buffer[index++] = ch;
        }
        
    buffer[index] = '\0';
    c->name = trimWhiteSpace(buffer);
    
    /* loop over measures */
    while ((ch = peekChar(in)) && ch != EOF && ch != '\n')
        {
        m = parseMeasure(in);
        if (m == 0) return 0;
        
        addASTMeasureToASTCourse(m, c);              
        }
    
    /* expect newline or EOF, and consume newline */
    if (ch == '\n') fgetc(in);
    else if (ch != EOF)
        {
        Fatal("unexpected '%c'\n", ch);
        return 0;
        }
     
    return c;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r14
callq 0x2b1b
movq %rax, %rbx
movq %r14, %rdi
callq 0x10e0
shll $0x18, %eax
cmpl $0x7c000000, %eax       # imm = 0x7C000000
jne 0x33d2
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x10e0
movl %eax, %ecx
shll $0x18, %ecx
je 0x33ec
cmpl $0x7c000000, %ecx       # imm = 0x7C000000
je 0x33ec
cmpq $0xff, %r15
je 0x3486
cmpl $0xa000000, %ecx        # imm = 0xA000000
je 0x3499
cmpl $0xff000000, %ecx       # imm = 0xFF000000
je 0x34a2
movb %al, (%rsp,%r15)
incq %r15
jmp 0x338d
sarl $0x18, %eax
leaq 0x2cf3(%rip), %rdi      # 0x60cf
xorl %ebx, %ebx
movl %eax, %esi
xorl %eax, %eax
callq 0x4610
jmp 0x34d0
movb $0x0, (%rsp,%r15)
movq %rsp, %rdi
callq 0x30ee
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2bfa
testb %al, %al
je 0x34b4
movzbl %al, %eax
cmpl $0xa, %eax
je 0x34c4
cmpl $0xff, %eax
je 0x34d0
movq %r14, %rdi
callq 0x34e2
testq %rax, %rax
je 0x34ce
movq %rax, %r15
movq 0x8(%rbx), %r12
movl 0x10(%rbx), %eax
leal 0x8(,%rax,8), %edi
callq 0x47c5
movq %rax, 0x8(%rbx)
movslq 0x10(%rbx), %rax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x3474
movq (%r12,%rdx,8), %rsi
movq 0x8(%rbx), %rdi
movq %rsi, (%rdi,%rdx,8)
incq %rdx
jmp 0x345e
movq 0x8(%rbx), %rcx
movq %r15, (%rcx,%rax,8)
incl %eax
movl %eax, 0x10(%rbx)
jmp 0x33fc
leaq 0x2c5c(%rip), %rdi      # 0x60e9
xorl %ebx, %ebx
movl $0xff, %esi
jmp 0x33e0
leaq 0x2c9e(%rip), %rdi      # 0x613e
jmp 0x34a9
leaq 0x2c71(%rip), %rdi      # 0x611a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4610
jmp 0x34d0
leaq 0x2c03(%rip), %rdi      # 0x60be
xorl %ebx, %ebx
xorl %esi, %esi
jmp 0x33e0
movq %r14, %rdi
callq 0x10e0
jmp 0x34d0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r14
popq %r15
retq