// File: /workspace/github_cpp_makefile_star2_O2/solaldunckel[P]webserv/srcs/HTTP/Server.cpp
// Function: Server::recv(int)
bool Server::recv(int fd) {
  Request *req = clients_[fd]->getRequest();

  if (!req)
    req = clients_[fd]->getRequest(true);

  char buf[BUF_SIZE];

  FD_CLR(fd, &read_fds_);

  int nbytes = ::recv(fd, buf, BUF_SIZE, 0);

  if (nbytes <= 0)
    return false;

  std::string buffer(buf, nbytes);

  int ret = req->parse(buffer);

  if (ret >= 1) {
    clients_[fd]->setupConfig(servers_, options_);
    Log.print(INFO, head_ + "<< " + clients_[fd]->getConfig()->log(Log.getLogLevel()));
    clients_[fd]->setupResponse(servers_, options_, ret);
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x100b8, %rsp          # imm = 0x100B8
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
movl %esi, (%rax)
leaq 0x48(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x14a54
movq (%rax), %rdi
xorl %esi, %esi
callq 0xe350
movq %rax, %r12
testq %rax, %rax
jne 0x13f51
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x14a54
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0xe350
movq %rax, %r12
movl 0x8(%rsp), %ecx
pushq $-0x2
popq %rsi
rolq %cl, %rsi
pushq $0x40
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
cltq
andq %rsi, 0xf8(%rbx,%rax,8)
leaq 0xb0(%rsp), %rsi
movl $0xffff, %edx           # imm = 0xFFFF
movl %ecx, %edi
xorl %ecx, %ecx
callq 0x4120
movq %rax, %r15
testl %r15d, %r15d
jle 0x140dd
movl %r15d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0xa0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
leaq (%rsp,%rax), %rdx
addq $0xb0, %rdx
leaq 0x90(%rsp), %r13
leaq 0xb0(%rsp), %rsi
movq %r13, %rdi
callq 0x53a8
movq %r12, %rdi
movq %r13, %rsi
callq 0xe64e
movl %eax, %ebp
testl %eax, %eax
jle 0x140d0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x14a54
movq (%rax), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
callq 0xe0a6
leaq 0x218(%rbx), %rsi
leaq 0x89e6(%rip), %rdx      # 0x1c9ec
leaq 0x50(%rsp), %rdi
callq 0x60d3
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x14a54
movq (%rax), %rdi
callq 0xe41a
movq %rax, %r12
leaq 0x174b9(%rip), %rdi     # 0x2b4e8
callq 0x18e1a
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x8e78
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x61d5
leaq 0x7fbc(%rip), %rsi      # 0x1c01a
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5328
leaq 0x17474(%rip), %rdi     # 0x2b4e8
pushq $0x1
popq %rsi
leaq 0x70(%rsp), %rdx
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
callq 0x18e1e
leaq 0x10(%rsp), %rdi
callq 0x4898
leaq 0x70(%rsp), %rdi
callq 0x4898
leaq 0x30(%rsp), %rdi
callq 0x4898
leaq 0x50(%rsp), %rdi
callq 0x4898
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x14a54
movq (%rax), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movl %ebp, %ecx
callq 0xe108
leaq 0x90(%rsp), %rdi
callq 0x4898
testl %r15d, %r15d
setg %al
addq $0x100b8, %rsp          # imm = 0x100B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4898
jmp 0x14107
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4898
jmp 0x14116
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x4898
jmp 0x14127
jmp 0x14133
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4898
jmp 0x14136
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x4898
movq %rbx, %rdi
callq 0x4750
nop