// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmHttpProcessFirstLine
static sxi32 VmHttpProcessFirstLine(
	 SyString *pRequest, /* Raw HTTP request */
	 sxi32 *pMethod,     /* OUT: HTTP method */
	 SyhttpUri *pUri,    /* OUT: Parse of the URI */
	 sxi32 *pProto       /* OUT: HTTP protocol */
	 )
 {
	 static const char *azMethods[] = { "get", "post", "head", "put"};
	 static const sxi32 aMethods[]  = { HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_HEAD, HTTP_METHOD_PUT};
	 const char *zIn, *zEnd, *zPtr;
	 SyString sLine;
	 sxu32 nLen;
	 sxi32 rc;
	 /* Extract the first line and update the pointer */
	 rc = VmGetNextLine(pRequest, &sLine);
	 if( rc != SXRET_OK ){
		 return rc;
	 }
	 if ( sLine.nByte < 1 ){
		 /* Empty HTTP request */
		 return SXERR_EMPTY;
	 }
	 /* Delimit the line and ignore trailing and leading white spaces */
	 zIn = sLine.zString;
	 zEnd = &zIn[sLine.nByte];
	 while( zIn < zEnd && (unsigned char)zIn[0] < 0xc0 && SyisSpace(zIn[0]) ){
		 zIn++;
	 }
	 /* Extract the HTTP method */
	 zPtr = zIn;
	 while( zIn < zEnd && !SyisSpace(zIn[0]) ){
		 zIn++;
	 }
	 *pMethod = HTTP_METHOD_OTHR;
	 if( zIn > zPtr ){
		 sxu32 i;
		 nLen = (sxu32)(zIn-zPtr);
		 for( i = 0 ; i < SX_ARRAYSIZE(azMethods) ; ++i ){
			 if( SyStrnicmp(azMethods[i], zPtr, nLen) == 0 ){
				 *pMethod = aMethods[i];
				 break;
			 }
		 }
	 }
	 /* Jump trailing white spaces */
	 while( zIn < zEnd && (unsigned char)zIn[0] < 0xc0 && SyisSpace(zIn[0]) ){
		 zIn++;
	 }
	  /* Extract the request URI */
	 zPtr = zIn;
	 while( zIn < zEnd && !SyisSpace(zIn[0]) ){
		 zIn++;
	 } 
	 if( zIn > zPtr ){
		 nLen = (sxu32)(zIn-zPtr);
		 /* Split raw URI to it's fields */
		 VmHttpSplitURI(pUri, zPtr, nLen);
	 }
	 /* Jump trailing white spaces */
	 while( zIn < zEnd && (unsigned char)zIn[0] < 0xc0 && SyisSpace(zIn[0]) ){
		 zIn++;
	 }
	 /* Extract the HTTP version */
	 zPtr = zIn;
	 while( zIn < zEnd && !SyisSpace(zIn[0]) ){
		 zIn++;
	 }
	 *pProto = HTTP_PROTO_11; /* HTTP/1.1 */
	 rc = 1;
	 if( zIn > zPtr ){
		 rc = SyStrnicmp(zPtr, "http/1.0", (sxu32)(zIn-zPtr));
	 }
	 if( !rc ){
		 *pProto = HTTP_PROTO_10; /* HTTP/1.0 */
	 }
	 return SXRET_OK;
 }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7c580
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x7b649
movl -0x58(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7b97e
cmpl $0x1, -0x48(%rbp)
jae 0x7b65b
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x7b97e
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x5d(%rbp)
jae 0x7b6b8
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x5d(%rbp)
jge 0x7b6b8
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x5d(%rbp)
movb -0x5d(%rbp), %al
testb $0x1, %al
jne 0x7b6c1
jmp 0x7b6cf
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b671
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x5e(%rbp)
jae 0x7b70c
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x5e(%rbp)
movb -0x5e(%rbp), %al
testb $0x1, %al
jne 0x7b715
jmp 0x7b723
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b6d7
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x7b79c
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x54(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpq $0x4, %rax
jae 0x7b79a
movl -0x5c(%rbp), %eax
movl %eax, %ecx
leaq 0x732df(%rip), %rax     # 0xeea40
movq (%rax,%rcx,8), %rdi
movq -0x40(%rbp), %rsi
movl -0x54(%rbp), %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x7b78d
movl -0x5c(%rbp), %eax
movl %eax, %ecx
leaq 0x45b1e(%rip), %rax     # 0xc12a0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x7b79a
jmp 0x7b78f
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x7b74c
jmp 0x7b79c
jmp 0x7b79e
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x5f(%rbp)
jae 0x7b7e5
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x5f(%rbp)
jge 0x7b7e5
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x5f(%rbp)
movb -0x5f(%rbp), %al
testb $0x1, %al
jne 0x7b7ee
jmp 0x7b7fc
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b79e
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x60(%rbp)
jae 0x7b839
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x60(%rbp)
movb -0x60(%rbp), %al
testb $0x1, %al
jne 0x7b842
jmp 0x7b850
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b804
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x7b878
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x54(%rbp)
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x54(%rbp), %edx
callq 0x7c6d0
jmp 0x7b87a
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x61(%rbp)
jae 0x7b8c1
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x61(%rbp)
jge 0x7b8c1
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x7b8ca
jmp 0x7b8d8
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b87a
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x62(%rbp)
jae 0x7b915
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x62(%rbp)
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0x7b91e
jmp 0x7b92c
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7b8e0
movq -0x28(%rbp), %rax
movl $0x2, (%rax)
movl $0x1, -0x58(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x7b967
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
leaq 0x474ef(%rip), %rsi     # 0xc2e4e
callq 0x67830
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
jne 0x7b977
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)