// File: /workspace/github_cpp_makefile_star2_O1/solaldunckel[P]webserv/srcs/HTTP/CGI.cpp
// Function: CGI::init(int)
void CGI::init(int worker_id) {
  char *cwd = getcwd(NULL, 0);
  if (!cwd)
    return ;
  cwd_ = cwd;
  free(cwd);

  env_ = NULL;
  argv_[0] = NULL;
  argv_[1] = NULL;
  argv_[2] = NULL;
  extension_ = file_.getMimeExtension();
  cgi_exe_ = config_.getCGI()[extension_];
  if (config_.getCGIBin()[0] == '/') {
    cgi_path_ = config_.getCGIBin() + "/" + cgi_exe_;
  } else {
    cgi_path_ = cwd_ + "/" + config_.getCGIBin() + "/" + cgi_exe_;
  }
  std::string cgi_path = "/tmp/webserv_cgi_tmp_" + ft::to_string(worker_id);
  tmp_file_.set_path(cgi_path.c_str());
  tmp_file_.open(true);
  if (worker_id)
    Log.print(DEBUG, "worker[" + ft::to_string(worker_id) + "] : CGI -> " + cgi_path_);
  else
    Log.print(DEBUG, "server : CGI -> " + cgi_path_);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %esi, %ebp
movq %rdi, %rbx
xorl %edi, %edi
xorl %esi, %esi
callq 0x4200
testq %rax, %rax
je 0xf076
movq %rax, %r14
leaq 0x78(%rbx), %r15
movq 0x80(%rbx), %r12
movq %rax, %rdi
callq 0x4190
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x4680
movq %r14, %rdi
callq 0x4540
xorps %xmm0, %xmm0
movups %xmm0, 0x1d8(%rbx)
movups %xmm0, 0x1c8(%rbx)
movq (%rbx), %rdi
callq 0x1ef7c
leaq 0x58(%rbx), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x4230
movq 0x8(%rbx), %rdi
callq 0x9ea8
movq %rax, %rdi
movq %r14, %rsi
callq 0xce88
leaq 0x38(%rbx), %rdi
movq %rax, %rsi
callq 0x4230
movq 0x8(%rbx), %rdi
callq 0x9eb2
movq (%rax), %rax
cmpb $0x2f, (%rax)
jne 0xeac6
movq 0x8(%rbx), %rdi
callq 0x9eb2
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x6bac
leaq 0x16b14(%rip), %rsi     # 0x25594
movq %r14, %rdi
callq 0x4830
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
leaq 0x8(%rsp), %rdi
callq 0x4100
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xeb3a
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xeb42
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x78(%rbx), %rsi
movq 0x80(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x6bac
leaq 0x16aa3(%rip), %rsi     # 0x25594
movq %r14, %rdi
callq 0x4830
movq 0x8(%rbx), %rdi
callq 0x9eb2
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
callq 0x4100
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xeb97
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xeb9f
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x4560
movq (%r14), %rdi
cmpq %r12, %rdi
je 0xeb7f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xecd5
movq 0x18(%rsp), %rsi
jmp 0xeccd
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x169d2(%rip), %rsi     # 0x25594
callq 0x4830
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xebef
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xebf7
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
callq 0x4100
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xec47
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xec4e
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x4560
movq (%r14), %rdi
cmpq %r15, %rdi
je 0xec8b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x58(%rsp), %r12
je 0xeca7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xecbe
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0xecd5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x6a15
leaq 0x168ab(%rip), %rcx     # 0x25596
movl $0x15, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x44c0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xed24
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xed2b
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0xed5f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x28(%rsp), %rsi
leaq 0x108(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5702
leaq 0xf8(%rbx), %r14
leaq 0x108(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x1c6c6
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xedb0
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x4460
movq %r14, %rdi
movl $0x1, %esi
callq 0x1cd04
testl %ebp, %ebp
je 0xee16
leaq 0x48(%rsp), %rdi
movl %ebp, %esi
callq 0x6a15
leaq 0x167d8(%rip), %rcx     # 0x255ac
leaq 0x48(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x44c0
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xeebb
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xeec2
addq $0x18, %rbx
leaq 0x1679f(%rip), %rsi     # 0x255c0
leaq 0xe8(%rsp), %rdi
movq %rbx, %rdx
callq 0x567a
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x161d6(%rip), %rsi     # 0x2501a
leaq 0x161d4(%rip), %rdx     # 0x2501f
leaq 0xa8(%rsp), %rdi
callq 0x578e
leaq 0x23679(%rip), %rdi     # 0x324d8
leaq 0xe8(%rsp), %rdx
leaq 0xa8(%rsp), %rcx
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x20fae
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xee99
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf05f
movq 0xf8(%rsp), %rsi
jmp 0xf057
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x166cf(%rip), %rsi     # 0x255b4
callq 0x4830
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xef0d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xef15
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
callq 0x4100
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xef6e
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0xef76
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x90(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xd8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x16076(%rip), %rsi     # 0x2501a
leaq 0x16074(%rip), %rdx     # 0x2501f
leaq 0xc8(%rsp), %rdi
callq 0x578e
leaq 0x23519(%rip), %rdi     # 0x324d8
leaq 0x88(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x20fae
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xeff9
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xf016
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf02d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xf044
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4460
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf05f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0xf076
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4460
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xf0ad
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf0ad
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf22e
movq 0xf8(%rsp), %rsi
jmp 0xf1ee
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf0ee
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf0ee
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xf215
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf215
jmp 0xf126
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
jne 0xf224
jmp 0xf245
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0xf20b
jmp 0xf245
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xf161
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf161
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xf183
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf183
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf19f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf19f
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xf1bb
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf1bb
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf22e
movq 0x58(%rsp), %rsi
jmp 0xf1ee
jmp 0xf22b
movq %rax, %rbx
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf22e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0xf22e
jmp 0xf22b
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf245
movq 0x18(%rsp), %rsi
jmp 0xf23d
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xf245
movq 0x58(%rsp), %rsi
jmp 0xf23d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0xf245
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4460
movq %rbx, %rdi
callq 0x4780
nop