// File: /workspace/github_c_makefile_star2_O0/gregtour[P]minimal-compiler/grammar.c
// Function: LoadGrammar
int LoadGrammar(const char*    file,
                GRAMMAR_TABLE* table)
{
    FILE* input;
    char* buffer;
    int   size;
    int   i, r, start, end;
    int   rhs, symbol, token;
    int   read, line, col;

    // initialize table
    table->numSymbols = 0;
    table->symbols = (char*)malloc(SYMBOL_BUFFER_SIZE);
    table->symbols[SYMBOL_BUFFER_SIZE - 1] = 0;
    table->numTokens = 0;
    table->tokens = (char*)malloc(TOKEN_BUFFER_SIZE);
    table->tokens[TOKEN_BUFFER_SIZE - 1] = 0;
    table->numRules = 0;
    table->rules = 0;

    // add built in symbols
    gSymbolRoot       = 0;
    gSymbolGoal       = K_SYMBOL + table->numSymbols + 1;
    gSymbolEpsilon    = AddToken("<epsilon>", 9, table);
    gSymbolEOF        = AddToken("<$>", 3, table);
    gSymbolEndLine    = AddToken("<endl>", 6, table);
    gSymbolInteger    = AddToken("<integer>", 9, table);
    gSymbolFloat      = AddToken("<float>", 7, table);
    gSymbolString     = AddToken("<string>", 8, table);
    gSymbolIdentifier = AddToken("<identifier>", 12, table);

    // read grammar file
    printf("Loading context free grammar from %s...\n", file);
    input = fopen(file, "rb");
    if (input == 0) {
        printf("Could not open grammar file.\n");
        return 1;
    }
    fseek(input, 0, SEEK_END);
    size = ftell(input);
    rewind(input);
    buffer = (char*)malloc(size+2);
    read = fread(buffer, 1, size, input);
    buffer[size] = '\n';
    buffer[size+1] = 0;
    fclose(input);
    
    printf("Read %i of %i bytes.\n", read, size);

    if (size == 0) {
        printf("Unable to read grammar rules.\n");
        return 1;
    }

    // count rules
    table->numRules = 0; col = 0;
    for (i = 0; i < size; i++)
    {
        // don't count comments or new lines
        if (col == 0 &&
            (buffer[i] == ';' || buffer[i] == '\r' || buffer[i] == '\n'))
        {
            while (i < size && buffer[i] != '\n')
                i++;
            continue;
        }
        col++;
        if (buffer[i] == '\r') buffer[i] = 0;
        else if (buffer[i] == '\n') { table->numRules++; col = 0; }
    }
    printf("Loaded %i grammar rules.\n", table->numRules);
    table->numRules++;

    // S' -> S
    table->rules = (RULE*)malloc(sizeof(RULE) * table->numRules);
    table->rules[0].lhs = gSymbolRoot;
    table->rules[0].rhs = (int*)malloc(sizeof(int) * RULE_RHS_SIZE);
    table->rules[0].rhs[0] = gSymbolGoal;
    table->rules[0].rhs[1] = 0;
    table->rules[0].rhsLength = 1;

    // parse rules
    start = 0; end = 0; line = 0;
    for (r = 1; r < table->numRules; r++)
    {
        // skip comments or blank lines
        while (start < size &&
                (buffer[start] == ';' || buffer[start] == '\n'
                 || buffer[start] == 0))
        {
            while (start < symbol && buffer[start] != '\n')
                start++;
            start++;
            line++;
        }
        // left hand symbol
        while (start < size && buffer[start] != '<')
            start++;
        end = start;
        while (start < size && buffer[end] != '>')
            end++;
        symbol = AddSymbol(&buffer[start], end - start + 1, table);
        if (symbol == 0) {
            printf("Could not identify left hand symbol in rule %i ", r+1);
            printf("on line %i.\n", line);
            return 1;
        }
        table->rules[r].lhs = symbol;
        start = end + 1;

        // ::= operator
        while (start < size - 2)
        {
            if (buffer[start] == ':' &&
                buffer[start+1] == ':' &&
                buffer[start+2] == '=')
            {
                break;
            }
            start++;
        }
        start = start + 3;

        // right hand side
        table->rules[r].rhs = (int*)malloc(sizeof(int) * RULE_RHS_SIZE);
        rhs = 0;
        while (start < size &&
               buffer[start] != '\n' &&
               buffer[start] != 0 &&
               rhs < RULE_RHS_SIZE)
        {
            if (buffer[start] == '<')
            {
                // symbol
                end = start;
                while (buffer[end] != '>' &&
                       end < size)
                {
                    end++;
                }

                symbol = FindToken(&buffer[start], end - start + 1, *table);
                if (symbol == 0)
                    symbol = AddSymbol(&buffer[start], end - start + 1, table);
                if (symbol == 0)
                {
                    printf("Could not identify right hand symbol in rule %i ", r+1);
                    printf("on line %i.\n", line);
                    return 1;
                }
                table->rules[r].rhs[rhs] = symbol;
                rhs++;
                start = end + 1;
            }
            else if (buffer[start] != ' ')
            {
                // token
                end = start;
                while (buffer[end] != ' ' &&
                      (buffer[end] != '<' ||
                       buffer[end-1] == '\\') &&
                       buffer[end] != '\n' &&
                       buffer[end] != 0 &&
                       end < size)
                {
                    end++;
                }

                token = AddToken(&buffer[start], end - start, table);
                if (token == 0)
                {
                    printf("Could not identify right hand token in rule %i ", r+1);
                    printf("on line %i.\n", line);
                    return 1;
                }
                table->rules[r].rhs[rhs] = token;
                rhs++;
                start = end;
            }
            else
            {
                // whitespace
                start++;
            }
        }
        table->rules[r].rhs[rhs] = 0;
        table->rules[r].rhsLength = rhs;
        if (rhs == 0) {
            printf("Rule %i on line %i has no right hand side.\n", r, line);
            return 1;
        } else if (rhs == RULE_RHS_SIZE) {
            printf("Rule %i on line %i may be too long.\n", r, line);
        }
    }

    if (gSymbolGoal == 0)
    {
        printf("Grammar is missing a goal symbol.\n");
        return 1;
    }

    printf("Parsed %i of %i rules.\n\n", r, table->numRules);

    free(buffer);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movl $0x1000, %edi           # imm = 0x1000
callq 0x20e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0xfff(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
movl $0x1000, %edi           # imm = 0x1000
callq 0x20e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x0, 0xfff(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x28(%rax)
movl $0x0, 0x178a7(%rip)     # 0x1c2e8
movq -0x18(%rbp), %rax
movl (%rax), %eax
addl $0x1000, %eax           # imm = 0x1000
addl $0x1, %eax
movl %eax, 0xa64b(%rip)      # 0xf0a0
movq -0x18(%rbp), %rdx
leaq 0x677d(%rip), %rdi      # 0xb1dd
movl $0x9, %esi
callq 0x45f0
movl %eax, 0xa634(%rip)      # 0xf0a4
movq -0x18(%rbp), %rdx
leaq 0x676c(%rip), %rdi      # 0xb1e7
movl $0x3, %esi
callq 0x45f0
movl %eax, 0xa61d(%rip)      # 0xf0a8
movq -0x18(%rbp), %rdx
leaq 0x6755(%rip), %rdi      # 0xb1eb
movl $0x6, %esi
callq 0x45f0
movl %eax, 0xa606(%rip)      # 0xf0ac
movq -0x18(%rbp), %rdx
leaq 0x6741(%rip), %rdi      # 0xb1f2
movl $0x9, %esi
callq 0x45f0
movl %eax, 0xa5ef(%rip)      # 0xf0b0
movq -0x18(%rbp), %rdx
leaq 0x6730(%rip), %rdi      # 0xb1fc
movl $0x7, %esi
callq 0x45f0
movl %eax, 0xa5d8(%rip)      # 0xf0b4
movq -0x18(%rbp), %rdx
leaq 0x671d(%rip), %rdi      # 0xb204
movl $0x8, %esi
callq 0x45f0
movl %eax, 0xa5c1(%rip)      # 0xf0b8
movq -0x18(%rbp), %rdx
leaq 0x670b(%rip), %rdi      # 0xb20d
movl $0xc, %esi
callq 0x45f0
movl %eax, 0xa5aa(%rip)      # 0xf0bc
movq -0x10(%rbp), %rsi
leaq 0x66fd(%rip), %rdi      # 0xb21a
movb $0x0, %al
callq 0x2070
movq -0x10(%rbp), %rdi
leaq 0x6613(%rip), %rsi      # 0xb142
callq 0x2100
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x4b59
leaq 0x66fd(%rip), %rdi      # 0xb243
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x20f0
movq -0x20(%rbp), %rdi
callq 0x20d0
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2080
movl -0x2c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rdi
callq 0x20e0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x2c(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x1, %esi
callq 0x2040
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0xa, (%rax,%rcx)
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rdi
callq 0x2050
movl -0x4c(%rbp), %esi
movl -0x2c(%rbp), %edx
leaq 0x6683(%rip), %rdi      # 0xb261
movb $0x0, %al
callq 0x2070
cmpl $0x0, -0x2c(%rbp)
jne 0x4c05
leaq 0x6685(%rip), %rdi      # 0xb277
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movq -0x18(%rbp), %rax
movl $0x0, 0x20(%rax)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x4cfc
cmpl $0x0, -0x54(%rbp)
jne 0x4c9d
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
je 0x4c63
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
je 0x4c63
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x4c9d
jmp 0x4c65
movl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x55(%rbp)
jge 0x4c87
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x4c90
jmp 0x4c9b
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4c65
jmp 0x4cee
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x4cc5
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x4cec
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x4cea
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movl $0x0, -0x54(%rbp)
jmp 0x4cec
jmp 0x4cee
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4c1e
movq -0x18(%rbp), %rax
movl 0x20(%rax), %esi
leaq 0x658c(%rip), %rdi      # 0xb296
movb $0x0, %al
callq 0x2070
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
movslq 0x20(%rax), %rdi
shlq $0x4, %rdi
callq 0x20e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movl 0x175a8(%rip), %ecx     # 0x1c2e8
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl %ecx, (%rax)
movl $0x60, %edi
callq 0x20e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x8(%rax)
movl 0xa337(%rip), %ecx      # 0xf0a0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl $0x1, 0x4(%rax)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0x5324
jmp 0x4dc7
movl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x56(%rbp)
jge 0x4e1b
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0x3b, %ecx
movb %al, -0x57(%rbp)
je 0x4e15
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0x57(%rbp)
je 0x4e15
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x57(%rbp)
movb -0x57(%rbp), %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
testb $0x1, %al
jne 0x4e24
jmp 0x4e73
jmp 0x4e26
movl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl -0x44(%rbp), %ecx
movb %al, -0x58(%rbp)
jge 0x4e48
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x58(%rbp)
movb -0x58(%rbp), %al
testb $0x1, %al
jne 0x4e51
jmp 0x4e5c
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e26
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x4dc7
jmp 0x4e75
movl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x59(%rbp)
jge 0x4e97
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3c, %eax
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x4ea0
jmp 0x4eab
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e75
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x5a(%rbp)
jge 0x4ed3
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
setne %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0x4edc
jmp 0x4ee7
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4eb1
movq -0x28(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %esi
subl -0x38(%rbp), %esi
addl $0x1, %esi
movq -0x18(%rbp), %rdx
callq 0x4450
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x4f3e
movl -0x34(%rbp), %esi
addl $0x1, %esi
leaq 0x6396(%rip), %rdi      # 0xb2b0
movb $0x0, %al
callq 0x2070
movl -0x50(%rbp), %esi
leaq 0x63b5(%rip), %rdi      # 0xb2e0
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x2c(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x4fb6
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3a, %eax
jne 0x4fab
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3a, %eax
jne 0x4fab
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x4fab
jmp 0x4fb6
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4f5f
movl -0x38(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x38(%rbp)
movl $0x60, %edi
callq 0x20e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x40(%rbp)
movl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x5b(%rbp)
jge 0x502d
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x5b(%rbp)
je 0x502d
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5b(%rbp)
je 0x502d
cmpl $0x18, -0x40(%rbp)
setl %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0x5039
jmp 0x529a
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3c, %eax
jne 0x5158
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x3e, %ecx
movb %al, -0x5c(%rbp)
je 0x5076
movl -0x3c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
setl %al
movb %al, -0x5c(%rbp)
movb -0x5c(%rbp), %al
testb $0x1, %al
jne 0x507f
jmp 0x508a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5054
movq -0x28(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %esi
subl -0x38(%rbp), %esi
addl $0x1, %esi
movq -0x18(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x47d0
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x50e9
movq -0x28(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %esi
subl -0x38(%rbp), %esi
addl $0x1, %esi
movq -0x18(%rbp), %rdx
callq 0x4450
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x5120
movl -0x34(%rbp), %esi
addl $0x1, %esi
leaq 0x61f1(%rip), %rdi      # 0xb2ed
movb $0x0, %al
callq 0x2070
movl -0x50(%rbp), %esi
leaq 0x61d3(%rip), %rdi      # 0xb2e0
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movl -0x44(%rbp), %edx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5295
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x528a
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x5d(%rbp)
je 0x51ed
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3c, %eax
jne 0x51b5
movq -0x28(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x5c, %ecx
movb %al, -0x5d(%rbp)
jne 0x51ed
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x5d(%rbp)
je 0x51ed
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5d(%rbp)
je 0x51ed
movl -0x3c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
setl %al
movb %al, -0x5d(%rbp)
movb -0x5d(%rbp), %al
testb $0x1, %al
jne 0x51f6
jmp 0x5204
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5173
movq -0x28(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %esi
subl -0x38(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x45f0
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jne 0x5258
movl -0x34(%rbp), %esi
addl $0x1, %esi
leaq 0x60ea(%rip), %rdi      # 0xb31e
movb $0x0, %al
callq 0x2070
movl -0x50(%rbp), %esi
leaq 0x609b(%rip), %rdi      # 0xb2e0
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movl -0x48(%rbp), %edx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x5293
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5295
jmp 0x4fea
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x40(%rbp), %ecx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
cmpl $0x0, -0x40(%rbp)
jne 0x52f8
movl -0x34(%rbp), %esi
movl -0x50(%rbp), %edx
leaq 0x6066(%rip), %rdi      # 0xb34e
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
cmpl $0x18, -0x40(%rbp)
jne 0x5312
movl -0x34(%rbp), %esi
movl -0x50(%rbp), %edx
leaq 0x606f(%rip), %rdi      # 0xb37a
movb $0x0, %al
callq 0x2070
jmp 0x5314
jmp 0x5316
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4db5
cmpl $0x0, 0x9d75(%rip)      # 0xf0a0
jne 0x5344
leaq 0x606b(%rip), %rdi      # 0xb39f
movb $0x0, %al
callq 0x2070
movl $0x1, -0x4(%rbp)
jmp 0x536c
movl -0x34(%rbp), %esi
movq -0x18(%rbp), %rax
movl 0x20(%rax), %edx
leaq 0x606d(%rip), %rdi      # 0xb3c2
movb $0x0, %al
callq 0x2070
movq -0x28(%rbp), %rdi
callq 0x2030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)