// File: /workspace/github_cpp_makefile_star2_O2/trisolaris233[P]httpc/src/request_parser.hpp
// Function: httpc::RequestParser::ResultType httpc::RequestParser::ParseRequest<char>(httpc::Request&, char)
ResultType ParseRequest(
                Request& request_, CharT chr) {
            // there is a problem with the original parsing function
            // the case is that when request line is like this "GET HTTP/1.1"
            // is also available on many broswers, but error will occurs on
            // the original one.
            switch(parse_enum_) {
                case kStart:
                    if (!is_char(chr) || is_ctl(chr) || is_tspecial(chr)) {
                        return kBad;
                    } else {
                        request_.method.push_back(chr);
                        parse_enum_ = kHTTPMethod;
                        return kIndeterminate;
                    }

                case kHTTPMethod:
                    if (chr == ' ') {
                        parse_enum_ = kURI;
                        return kIndeterminate;
                    } else if (!is_char(chr) || is_ctl(chr) || is_tspecial(chr)) {
                        return kBad;
                    } else {
                        request_.method.push_back(chr);
                        return kIndeterminate;
                    }

                case kURI:
                    if (chr == ' ') {
                        parse_enum_ = kH;
                        return kIndeterminate;
                    } else if (is_ctl(chr)) {
                        return kBad;
                    } else {
                        request_.uri.Append(chr);
                        return kIndeterminate;
                    }

                case kH:
                    if (chr == 'H') {
                        parse_enum_ = kT1;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kT1:
                    if (chr == 'T') {
                        parse_enum_ = kT2;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }
                    
                case kT2:
                    if (chr == 'T') {
                        parse_enum_ = kP;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kP:
                    if (chr == 'P') {
                        parse_enum_ = kSlash;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kSlash:
                    if (chr == '/') {
                        parse_enum_ = kMajorVersion;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kMajorVersion:
                    if (chr == '.') {
                        power_ = 1;
                        parse_enum_ = kMinorVersion;
                        return kIndeterminate;
                    } else if (std::isdigit(chr)) {
                        request_.http_major_version += power_ * static_cast<int>(chr - 0x30);
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kMinorVersion:
                    if (chr == '\r') {
                        parse_enum_ = kFirstLF;
                        return kIndeterminate;
                    } else if (std::isdigit(chr)) {
                        request_.http_minor_version += power_ * static_cast<int>(chr - 0x30);
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kFirstLF:
                    if (chr == '\n') {
                        parse_enum_ = kHeaderLineStart;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kHeaderLineStart:
                    if (chr == '\r') {
                        parse_enum_ = kExceptingNewLineEnding;
                        return kIndeterminate;
                    } else if (!request_.headers.empty() && (chr == ' ' || chr == '\t')) {
                        parse_enum_ = kHeaderLws;
                        return kIndeterminate;
                    } else if (!is_char(chr) || is_ctl(chr) || is_tspecial(chr)) {
                        return kBad;
                    } else {
                        request_.headers.push_back(Header());
                        request_.headers.back().field.push_back(chr);
                        parse_enum_ = kHeaderName;
                        return kIndeterminate;
                    }

                case kHeaderLws:
                    if (chr == '\r') {
                        parse_enum_ = kExceptingNormalNewLine;
                        return kIndeterminate;
                    } else if (chr == ' ' || chr == '\t') {
                        return kIndeterminate;
                    } else if (is_ctl(chr)) {
                        return kBad;
                    } else {
                        parse_enum_ = kHeaderValue;
                        request_.headers.back().value.push_back(chr);
                        return kIndeterminate;;
                    }

                case kHeaderName:
                    if (chr == ':') {
                        parse_enum_ = kSpaceBeforeHeaderValue;
                        return kIndeterminate;
                    } else if (!is_char(chr) || is_ctl(chr) || is_tspecial(chr)) {
                        return kBad;
                    } else {
                        request_.headers.back().field.push_back(chr);
                        return kIndeterminate;
                    }

                case kSpaceBeforeHeaderValue:
                    if (chr == ' ') {
                        parse_enum_ = kHeaderValue;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kHeaderValue:
                    if (chr == '\r') {
                        parse_enum_ = kExceptingNormalNewLine;
                        return kIndeterminate;
                    } else if (is_ctl(chr)) {
                        return kBad;
                    } else {
                        request_.headers.back().value.push_back(chr);
                        return kIndeterminate;
                    }

                case kExceptingNormalNewLine:
                    if (chr == '\n') {
                        parse_enum_ = kHeaderLineStart;
                        return kIndeterminate;
                    } else {
                        return kBad;
                    }

                case kExceptingNewLineEnding:
                    return chr == '\n' ? kGood : kBad;
                    
                
                default:
                    return kBad;
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl 0x20(%rdi), %eax
pushq $0x1
popq %rbx
cmpq $0x12, %rax
ja 0x14e78
movq %rsi, %r14
movq %rdi, %r15
leaq 0xc4ea(%rip), %rcx      # 0x2107c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0xa, %dl
jne 0x14e78
movl $0xc, 0x20(%r15)
jmp 0x14e75
cmpb $0x3a, %dl
jne 0x14d63
movl $0x10, 0x20(%r15)
jmp 0x14e75
cmpb $0x54, %dl
jne 0x14e78
movl $0x5, 0x20(%r15)
jmp 0x14e75
cmpb $0xd, %dl
jne 0x14da7
movl $0x12, 0x20(%r15)
jmp 0x14e75
cmpb $0x20, %dl
jne 0x14dd9
movl $0x2, 0x20(%r15)
jmp 0x14e75
cmpb $0x54, %dl
jne 0x14e78
movl $0x6, 0x20(%r15)
jmp 0x14e75
cmpb $0x48, %dl
jne 0x14e78
movl $0x4, 0x20(%r15)
jmp 0x14e75
movsbl %dl, %r12d
movl %r12d, %edi
callq 0x1f76c
testb %al, %al
je 0x14e78
movl %r12d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movl %r12d, %edi
callq 0x1f78f
testb %al, %al
jne 0x14e78
movq %r14, %rdi
movl %r12d, %esi
callq 0x84a0
movl $0x1, 0x20(%r15)
jmp 0x14e75
cmpb $0x20, %dl
jne 0x14e07
movl $0x3, 0x20(%r15)
jmp 0x14e75
cmpb $0x50, %dl
jne 0x14e78
movl $0x7, 0x20(%r15)
jmp 0x14e75
cmpb $0x2f, %dl
jne 0x14e78
movl $0x8, 0x20(%r15)
jmp 0x14e75
cmpb $0xd, %dl
jne 0x14e20
movl $0x11, 0x20(%r15)
jmp 0x14e75
movsbl %dl, %r12d
pushq $0x2
popq %r13
cmpl $0x9, %r12d
je 0x14f3b
cmpl $0x20, %r12d
je 0x14f3b
cmpl $0xd, %r12d
jne 0x14f10
movl $0x11, 0x20(%r15)
jmp 0x14f3b
cmpb $0xd, %dl
jne 0x14e45
movl $0xb, 0x20(%r15)
jmp 0x14e75
cmpb $0x2e, %dl
jne 0x14e5e
movl $0x1, 0x28(%r15)
movl $0xa, 0x20(%r15)
jmp 0x14e75
xorl %ebx, %ebx
cmpb $0xa, %dl
setne %bl
jmp 0x14e78
cmpb $0x20, %dl
jne 0x14e78
movl $0xe, 0x20(%r15)
jmp 0x14e75
movsbl %dl, %r15d
movl %r15d, %edi
callq 0x1f76c
testb %al, %al
je 0x14e78
movl %r15d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movl %r15d, %edi
callq 0x1f78f
testb %al, %al
jne 0x14e78
movq 0xa0(%r14), %rdi
addq $-0x40, %rdi
jmp 0x14e3b
movq 0x98(%r14), %rax
cmpq 0xa0(%r14), %rax
je 0x14e89
movsbl %dl, %eax
cmpl $0x20, %eax
je 0x14dcc
cmpl $0x9, %eax
jne 0x14e89
movl $0xf, 0x20(%r15)
jmp 0x14e75
movsbl %dl, %r15d
movl %r15d, %edi
callq 0x1f76c
testb %al, %al
je 0x14e78
movl %r15d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movl %r15d, %edi
callq 0x1f78f
testb %al, %al
je 0x14e1b
jmp 0x14e78
movsbl %dl, %r15d
movl %r15d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
addq $0x20, %r14
movq %r14, %rdi
jmp 0x14e3b
movsbl %dl, %r15d
movl %r15d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movq 0xa0(%r14), %rdi
addq $-0x20, %rdi
movl %r15d, %esi
callq 0x84a0
jmp 0x14e75
movsbl %dl, %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x14e78
imull 0x28(%r15), %eax
addl %eax, 0x94(%r14)
jmp 0x14e75
movsbl %dl, %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x14e78
imull 0x28(%r15), %eax
addl %eax, 0x90(%r14)
pushq $0x2
popq %rbx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %dl, %r12d
movl %r12d, %edi
callq 0x1f76c
testb %al, %al
je 0x14e78
movl %r12d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movl %r12d, %edi
callq 0x1f78f
testb %al, %al
jne 0x14e78
leaq -0x58(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x98(%r14), %rdi
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movb $0x0, (%rax)
leaq -0x68(%rbp), %rsi
callq 0xa734
leaq -0x68(%rbp), %rdi
callq 0xa64e
movq 0xa0(%r14), %rdi
addq $-0x40, %rdi
movl %r12d, %esi
callq 0x84a0
movl $0xd, 0x20(%r15)
jmp 0x14e75
movl %r12d, %edi
callq 0x1f77b
testb %al, %al
jne 0x14e78
movl $0xe, 0x20(%r15)
movq 0xa0(%r14), %rdi
addq $-0x20, %rdi
movl %r12d, %esi
callq 0x84a0
movl %r13d, %ebx
jmp 0x14e78
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0xa64e
movq %rbx, %rdi
callq 0x8850
nop