// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x0, 0x38(%rdi)
jne 0x10a48
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10dbe
movq %rax, 0x38(%rbx)
movq 0x40(%rbx), %r12
testq %r12, %r12
jne 0x10a63
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x109ae
movq 0x40(%rbx), %r12
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x4440
movq %rax, %r14
movl 0x30(%rbx), %edx
movq %rax, %rdi
movq %r12, %rsi
movl %ebp, %ecx
callq 0x1267c
movq %r14, 0x48(%rbx)
movq %r14, %rdi
callq 0x1441e
movq %rbx, (%rsp)
movq 0x48(%rbx), %rdi
callq 0x17010
testb %al, %al
je 0x10cd8
movq (%rsp), %rax
leaq 0x48(%rax), %r14
leaq 0x38(%rsp), %r13
movl $0xa, %r12d
leaq 0x48(%rsp), %rbx
movq %r13, %r15
movq (%rsp), %rax
movq 0x40(%rax), %r13
movq 0x48(%rax), %rsi
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
callq 0x17018
movq %r13, %rdi
movq %rbp, %rsi
callq 0x9d16
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x10b08
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
movq (%r14), %rsi
leaq 0x68(%rsp), %r13
movq %r13, %rdi
callq 0x17018
movl $0x1d, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x14c28(%rip), %rcx     # 0x25754
callq 0x44d0
movq %r15, %r13
movq %r15, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10b57
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x10b5f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
leaq 0x147d4(%rip), %rsi     # 0x25357
callq 0x4840
leaq 0x18(%rsp), %rsi
movq %rsi, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10bb0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x10bb6
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x14438(%rip), %rsi     # 0x2501a
leaq 0x14436(%rip), %rdx     # 0x2501f
callq 0x579e
leaq 0x218f3(%rip), %rdi     # 0x324e8
movl $0x1, %esi
leaq 0x8(%rsp), %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x20f32
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x10c26
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x10c42
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x10c59
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x10c75
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
movq (%r14), %rdi
callq 0x12aea
subl $0x1, %r12d
jb 0x10ca0
movq (%r14), %rdi
callq 0x1441e
movq (%r14), %rdi
callq 0x17010
testb %al, %al
jne 0x10ab9
testl %r12d, %r12d
jne 0x10cd8
movq %r14, %rdi
callq 0x10ef9
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x4440
movq %rax, %r15
movq (%rsp), %rax
movq 0x40(%rax), %rsi
movl 0x30(%rax), %edx
movq %r15, %rdi
movl $0x1f4, %ecx            # imm = 0x1F4
callq 0x1267c
movq %r15, (%r14)
movq %r15, %rdi
callq 0x1441e
movq (%rsp), %rdi
addq $0x38, %rdi
callq 0x10e93
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x1c0, %esi            # imm = 0x1C0
movq %r15, %rdi
jmp 0x10db1
movq %rax, %rbx
movl $0x1c0, %esi            # imm = 0x1C0
movq %r14, %rdi
jmp 0x10db1
movq %rax, %rbx
jmp 0x10d40
movq %rax, %rbx
jmp 0x10d78
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x10d40
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x10d61
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x10d61
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x10d78
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x10db6
movq 0x78(%rsp), %rsi
jmp 0x10dae
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x10db6
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4790