// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::acceptRequest(int)
Request acceptRequest(int fd)
	{
		// receive port number of the current player
		std::vector<char> buffer(BUFFER_SIZE, '\0');
	    int len = recv(fd, &buffer.data()[0], BUFFER_SIZE, 0);
	    if(len == -1)
	    {
	        throw ProxyException("In acceptRequest(), server receive request error");
	    }
	    buffer[len] = '\0';

	    // get current time for request
	    time_t cur = time(NULL);
	    tm * tm = localtime(&cur);
	    char * dt = asctime(tm);
	    std::string cur_time(dt);

	    // extract HTTP action and url from request
	    Request request(cur_time, buffer, len);
	    parser.parseRequest(request);
	    return request;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movb $0x0, -0x31(%rbp)
leaq -0x32(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x4650
movq -0xd0(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x10000, %esi          # imm = 0x10000
leaq -0x31(%rbp), %rdx
callq 0x9390
jmp 0x76f1
leaq -0x32(%rbp), %rdi
callq 0x4420
movl -0x14(%rbp), %eax
movl %eax, -0xf4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x9410
movl -0xf4(%rbp), %edi
movq %rax, %rsi
movl $0x10000, %edx          # imm = 0x10000
xorl %ecx, %ecx
callq 0x40f0
movq %rax, -0xf0(%rbp)
jmp 0x772a
movq -0xf0(%rbp), %rax
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0x7821
movb $0x1, -0x6a(%rbp)
movl $0x28, %edi
callq 0x41b0
movq %rax, -0x108(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x4650
movq -0x100(%rbp), %rdx
leaq 0x119f4(%rip), %rsi     # 0x19165
leaq -0x68(%rbp), %rdi
callq 0x4bf0
jmp 0x777c
movq -0x108(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x9240
jmp 0x778e
movq -0x108(%rbp), %rdi
movb $0x0, -0x6a(%rbp)
leaq 0x1c558(%rip), %rsi     # 0x23cf8
leaq 0x1b09(%rip), %rdx      # 0x92b0
callq 0x4610
jmp 0x79ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x32(%rbp), %rdi
callq 0x4420
jmp 0x79b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x79a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x77ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x4250
leaq -0x69(%rbp), %rdi
callq 0x4420
testb $0x1, -0x6a(%rbp)
jne 0x7810
jmp 0x781c
movq -0x108(%rbp), %rdi
callq 0x42d0
jmp 0x79a8
movslq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x9430
movb $0x0, (%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x4390
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x42e0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x4140
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x4650
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4bf0
jmp 0x7898
leaq -0xa9(%rbp), %rdi
callq 0x4420
movb $0x0, -0xaa(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x9450
jmp 0x78bd
movq -0xe8(%rbp), %rdi
movl -0x48(%rbp), %ecx
leaq -0xa8(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x9540
jmp 0x78dc
leaq -0xc8(%rbp), %rdi
callq 0x6130
movq -0xd8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x96a0
jmp 0x78fd
movb $0x1, -0xaa(%rbp)
testb $0x1, -0xaa(%rbp)
jne 0x7977
jmp 0x796b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa9(%rbp), %rdi
callq 0x4420
jmp 0x79a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x799c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6130
jmp 0x799c
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x7a90
jmp 0x799c
movq -0xe8(%rbp), %rdi
callq 0x7a90
leaq -0xa8(%rbp), %rdi
callq 0x4250
leaq -0x30(%rbp), %rdi
callq 0x6130
movq -0xe0(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x4250
leaq -0x30(%rbp), %rdi
callq 0x6130
movq -0x40(%rbp), %rdi
callq 0x4640
nopw (%rax,%rax)