// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
callq 0x3350
movq %rax, -0x18(%rbp)
movl $0x0, -0x134(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10c0
movb %al, -0x21(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x7c, %eax
je 0x42c6
movsbl -0x21(%rbp), %esi
leaq 0x3e3e(%rip), %rdi      # 0x80f0
movb $0x0, %al
callq 0x63e0
movq $0x0, -0x8(%rbp)
jmp 0x4477
jmp 0x42c8
movq -0x10(%rbp), %rdi
callq 0x10c0
movb %al, -0x21(%rbp)
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x135(%rbp)
je 0x42f4
movsbl -0x21(%rbp), %eax
cmpl $0x7c, %eax
setne %al
movb %al, -0x135(%rbp)
movb -0x135(%rbp), %al
testb $0x1, %al
jne 0x4303
jmp 0x4399
cmpl $0xff, -0x134(%rbp)
jne 0x432f
leaq 0x3df4(%rip), %rdi      # 0x810a
movl $0xff, %esi
movb $0x0, %al
callq 0x63e0
movq $0x0, -0x8(%rbp)
jmp 0x4477
movsbl -0x21(%rbp), %eax
cmpl $-0x1, %eax
jne 0x4353
leaq 0x3dfc(%rip), %rdi      # 0x813b
movb $0x0, %al
callq 0x63e0
movq $0x0, -0x8(%rbp)
jmp 0x4477
movsbl -0x21(%rbp), %eax
cmpl $0xa, %eax
jne 0x4377
leaq 0x3dfc(%rip), %rdi      # 0x815f
movb $0x0, %al
callq 0x63e0
movq $0x0, -0x8(%rbp)
jmp 0x4477
movb -0x21(%rbp), %cl
movl -0x134(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x134(%rbp)
cltq
movb %cl, -0x130(%rbp,%rax)
jmp 0x42c8
movslq -0x134(%rbp), %rax
movb $0x0, -0x130(%rbp,%rax)
leaq -0x130(%rbp), %rdi
callq 0x3dd0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x34c0
movb %al, -0x21(%rbp)
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x136(%rbp)
je 0x43fb
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, -0x136(%rbp)
je 0x43fb
movsbl -0x21(%rbp), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x136(%rbp)
movb -0x136(%rbp), %al
testb $0x1, %al
jne 0x4407
jmp 0x4434
movq -0x10(%rbp), %rdi
callq 0x4530
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x4425
movq $0x0, -0x8(%rbp)
jmp 0x4477
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4660
jmp 0x43be
movsbl -0x21(%rbp), %eax
cmpl $0xa, %eax
jne 0x4448
movq -0x10(%rbp), %rdi
callq 0x10c0
jmp 0x446f
movsbl -0x21(%rbp), %eax
cmpl $-0x1, %eax
je 0x446d
movsbl -0x21(%rbp), %esi
leaq 0x3c83(%rip), %rdi      # 0x80df
movb $0x0, %al
callq 0x63e0
movq $0x0, -0x8(%rbp)
jmp 0x4477
jmp 0x446f
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)