// File: /workspace/github_cpp_makefile_star2_O1/solaldunckel[P]webserv/srcs/HTTP/Client.cpp
// Function: Client::setupResponse(std::vector<ServerConfig, std::allocator<ServerConfig>>&, InputArgs&, int)
void Client::setupResponse(std::vector<ServerConfig> &servers, InputArgs &options, int error_code) {
  if (!request_)
    request_ = getRequest(true);

  if (!config_)
    setupConfig(servers, options);

  response_ = new Response(*config_, worker_id_, error_code);

  int loop = 0;

  for (int ret = 1; ret != 0; loop++) {
    ret = 0;

    response_->build();

    if (response_->redirect()) {
      ret = 1;
      config_->redirectLocation(response_->redirect_target());
      Log.print(INFO, "INTERNAL REDIRECT : [target: " + response_->redirect_target() + "]");
      response_->clear();
    }
    if (loop >= 10) {
      ft::delete_(response_);
      response_ = new Response(*config_, worker_id_, 500);
      response_->build();
      break ;
    }
  }

  ft::delete_(request_);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x0, 0x38(%rdi)
jne 0x10958
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10ccc
movq %rax, 0x38(%rbx)
cmpq $0x0, 0x40(%rbx)
jne 0x1096d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x108be
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x4430
movq %rax, %r14
movq 0x40(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rax, %rdi
movl %ebp, %ecx
callq 0x125d4
leaq 0x38(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x48(%rbx), %r15
movq %r14, 0x48(%rbx)
movl $0xb, %r13d
leaq 0x50(%rsp), %r14
movq %r15, 0x8(%rsp)
movq (%r15), %rdi
callq 0x14374
movq (%r15), %rdi
callq 0x16f8c
movl %eax, %ebp
testb %al, %al
je 0x10ba1
movq %r14, %r15
movq 0x40(%rbx), %r12
movq %rbx, %r14
movq 0x48(%rbx), %rsi
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0x16f94
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9cd0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
leaq 0x40(%rsp), %r12
je 0x10a19
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x16f94
movl $0x1d, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x14d12(%rip), %rcx     # 0x25754
callq 0x44c0
movq %r14, %rbx
movq %r12, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq %r15, %r14
je 0x10a70
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x10a78
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rdi
leaq 0x148bb(%rip), %rsi     # 0x25357
callq 0x4830
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10ac9
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x10acf
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r14, %rdi
leaq 0x1451f(%rip), %rsi     # 0x2501a
leaq 0x1451d(%rip), %rdx     # 0x2501f
callq 0x578e
leaq 0x219ca(%rip), %rdi     # 0x324d8
movl $0x1, %esi
leaq 0x10(%rsp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x20fae
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x10b3f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x10b5b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x10b72
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
movq 0x8(%rsp), %r15
je 0x10b99
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4460
movq (%r15), %rdi
callq 0x12a42
decl %r13d
je 0x10bb1
testb %bpl, %bpl
jne 0x109ac
jmp 0x10be5
movq %r15, %rdi
callq 0x10e07
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x4430
movq %rax, %r14
movq 0x40(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rax, %rdi
movl $0x1f4, %ecx            # imm = 0x1F4
callq 0x125d4
movq %r14, (%r15)
movq %r14, %rdi
callq 0x14374
movq 0x70(%rsp), %rdi
callq 0x10da1
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10c03
movq %rax, %rbx
movl $0x1c0, %esi            # imm = 0x1C0
movq %r14, %rdi
jmp 0x10cbf
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x10cc4
movq 0xa8(%rsp), %rsi
jmp 0x10cbc
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x10c60
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x10c60
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x10c81
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x10c81
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10ca2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x10ca2
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x10cc4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4460
movq %rbx, %rdi
callq 0x4780