// File: /workspace/github_cpp_makefile_star2_O1/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 0xc(%rsp), %rax
movl %esi, (%rax)
leaq 0x48(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1ac40
movq (%rax), %rdi
xorl %esi, %esi
callq 0x10ccc
movq %rax, %r12
testq %rax, %rax
jne 0x19b0d
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x1ac40
movq (%rax), %rdi
movl $0x1, %esi
callq 0x10ccc
movq %rax, %r12
movl 0xc(%rsp), %ecx
movq $-0x2, %rax
rolq %cl, %rax
leal 0x3f(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x6, %edx
movslq %edx, %rdx
andq %rax, 0xf8(%rbx,%rdx,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 0x19dbc
movl %r15d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
leaq (%rsp,%rax), %rdx
addq $0xb0, %rdx
leaq 0x70(%rsp), %r13
leaq 0xb0(%rsp), %rsi
movq %r13, %rdi
callq 0x578e
movq %r12, %rdi
movq %r13, %rsi
callq 0x110a2
movl %eax, %ebp
testl %eax, %eax
jle 0x19d9a
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x1ac40
movq (%rax), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
callq 0x108be
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x218(%rbx), %rsi
movq 0x220(%rbx), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x6bac
leaq 0xbe56(%rip), %rsi      # 0x25a3a
leaq 0x10(%rsp), %rdi
callq 0x4830
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x1ac40
movq (%rax), %rdi
callq 0x10d96
movq %rax, %r12
leaq 0x188cb(%rip), %rdi     # 0x324d8
callq 0x20faa
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x9f2e
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x58(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0x19c43
movq 0x20(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x19c62
leaq 0x60(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x19c5d
movq 0x60(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x19c73
movq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x4100
jmp 0x19c81
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x44c0
leaq 0x40(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x19ca5
movq %rsi, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x19cab
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xa0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xb33e(%rip), %rsi      # 0x2501a
leaq 0xb33c(%rip), %rdx      # 0x2501f
leaq 0x90(%rsp), %rdi
callq 0x578e
leaq 0x187e1(%rip), %rdi     # 0x324d8
leaq 0x30(%rsp), %rdx
leaq 0x90(%rsp), %rcx
movl $0x1, %esi
xorl %r8d, %r8d
callq 0x20fae
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x19d2e
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19d49
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19d64
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x19d7b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x1ac40
movq (%rax), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movl %ebp, %ecx
callq 0x10924
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x19dbc
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4460
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
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x19df9
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x19df9
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19e19
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x19e19
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19e3d
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x19e3d
jmp 0x19e3a
jmp 0x19e56
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x19e59
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x19e59
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x19e7b
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4460
movq %rbx, %rdi
callq 0x4780
nop