// File: nilnilnil[P]autocomplete/src/main.cpp
// Function: InputLineParser::start_parsing()
void
    start_parsing() {
        int i = 0;
        int n = 0;
        const char *p_start = NULL, *s_start = NULL;
        int p_len = 0, s_len = 0;

        while (this->buff[i]) {
            char ch = this->buff[i];
            DCERR("State: "<<this->state<<", read: "<<ch<<"\n");

            switch (this->state) {
            case ILP_BEFORE_NON_WS:
                if (!isspace(ch)) {
                    this->state = ILP_WEIGHT;
                }
                else {
                    ++i;
                }
                break;

            case ILP_WEIGHT:
                if (isdigit(ch)) {
                    n *= 10;
                    n += (ch - '0');
                    ++i;
                }
                else {
                    this->state = ILP_BEFORE_PTAB;
                    on_weight(n);
                }
                break;

            case ILP_BEFORE_PTAB:
                if (ch == '\t') {
                    this->state = ILP_AFTER_PTAB;
                }
                ++i;
                break;

            case ILP_AFTER_PTAB:
                if (isspace(ch)) {
                    ++i;
                }
                else {
                    p_start = this->buff + i;
                    this->state = ILP_PHRASE;
                }
                break;

            case ILP_PHRASE:
                // DCERR("State: ILP_PHRASE: "<<buff[i]<<endl);
                if (ch != '\t') {
                    ++p_len;
                }
                else {
                    // Note: Skip to ILP_SNIPPET since the snippet may
                    // start with a white-space that we wish to
                    // preserve.
                    // 
                    // this->state = ILP_AFTER_STAB;
                    this->state = ILP_SNIPPET;
                    s_start = this->buff + i + 1;
                }
                ++i;
                break;

            case ILP_AFTER_STAB:
                if (isspace(ch)) {
                    this->state = ILP_SNIPPET;
                    s_start = this->buff + i;
                }
                else {
                    ++i;
                }
                break;

            case ILP_SNIPPET:
                ++i;
                ++s_len;
                break;

            };
        }
        on_phrase(p_start, p_len);
        on_snippet(s_start, s_len);
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x3c(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xed2d
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
movslq 0x3c(%rsp), %rdx
movb (%rcx,%rdx), %cl
movb %cl, 0x1f(%rsp)
movl (%rax), %eax
movq %rax, 0x8(%rsp)
subq $0x6, %rax
ja 0xed28
movq 0x8(%rsp), %rax
leaq 0x13455(%rip), %rcx     # 0x22004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbl 0x1f(%rsp), %edi
callq 0x5090
cmpl $0x0, %eax
jne 0xebd4
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
jmp 0xebdf
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xed28
movsbl 0x1f(%rsp), %edi
callq 0x54c0
cmpl $0x0, %eax
je 0xec19
imull $0xa, 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movsbl 0x1f(%rsp), %eax
subl $0x30, %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xec2d
movq 0x10(%rsp), %rdi
movl $0x2, (%rdi)
movl 0x38(%rsp), %esi
callq 0x13d50
jmp 0xed28
movsbl 0x1f(%rsp), %eax
cmpl $0x9, %eax
jne 0xec47
movq 0x10(%rsp), %rax
movl $0x3, (%rax)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xed28
movsbl 0x1f(%rsp), %edi
callq 0x5090
cmpl $0x0, %eax
je 0xec73
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xec8f
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
movslq 0x3c(%rsp), %rdx
addq %rdx, %rcx
movq %rcx, 0x30(%rsp)
movl $0x4, (%rax)
jmp 0xed28
movsbl 0x1f(%rsp), %eax
cmpl $0x9, %eax
je 0xecab
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0xeccb
movq 0x10(%rsp), %rax
movl $0x6, (%rax)
movq 0x10(%rax), %rax
movslq 0x3c(%rsp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xed28
movsbl 0x1f(%rsp), %edi
callq 0x5090
cmpl $0x0, %eax
je 0xed05
movq 0x10(%rsp), %rax
movl $0x6, (%rax)
movq 0x10(%rax), %rax
movslq 0x3c(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x28(%rsp)
jmp 0xed10
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xed28
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xeb65
movq 0x10(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x24(%rsp), %edx
callq 0x13d70
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x20(%rsp), %edx
callq 0x13dc0
addq $0x48, %rsp
retq
nopl (%rax,%rax)