// File: /workspace/github_cpp_makefile_star2_O3/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 0xf12a
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 0x4690
movq %r14, %rdi
callq 0x4550
xorps %xmm0, %xmm0
movups %xmm0, 0x1d8(%rbx)
movups %xmm0, 0x1c8(%rbx)
movq (%rbx), %rdi
callq 0x1efa0
leaq 0x58(%rbx), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x4230
movq 0x8(%rbx), %rdi
callq 0x9efe
movq %rax, %rdi
movq %r14, %rsi
callq 0xcf2e
leaq 0x38(%rbx), %rdi
movq %rax, %rsi
callq 0x4230
movq 0x8(%rbx), %rdi
callq 0x9f08
movq (%rax), %rax
cmpb $0x2f, (%rax)
jne 0xeb7a
movq 0x8(%rbx), %rdi
callq 0x9f08
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 0x6c2a
leaq 0x16a60(%rip), %rsi     # 0x25594
movq %r14, %rdi
callq 0x4840
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 0xebee
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xebf6
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 0x6c2a
leaq 0x169ef(%rip), %rsi     # 0x25594
movq %r14, %rdi
callq 0x4840
movq 0x8(%rbx), %rdi
callq 0x9f08
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 0xec4b
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xec53
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 0x4570
movq (%r14), %rdi
cmpq %r12, %rdi
je 0xec33
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xed89
movq 0x18(%rsp), %rsi
jmp 0xed81
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 0x1691e(%rip), %rsi     # 0x25594
callq 0x4840
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xeca3
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xecab
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 0xecfb
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xed02
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 0x4570
movq (%r14), %rdi
cmpq %r15, %rdi
je 0xed3f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x58(%rsp), %r12
je 0xed5b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xed72
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0xed89
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x6a8a
leaq 0x167f7(%rip), %rcx     # 0x25596
movl $0x15, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x44d0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xedd8
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xeddf
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 0xee13
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x28(%rsp), %rsi
leaq 0x108(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5712
leaq 0xf8(%rbx), %r14
leaq 0x108(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x1c752
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xee64
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x4470
movq %r14, %rdi
movl $0x1, %esi
callq 0x1cd66
testl %ebp, %ebp
je 0xeeca
leaq 0x48(%rsp), %rdi
movl %ebp, %esi
callq 0x6a8a
leaq 0x16724(%rip), %rcx     # 0x255ac
leaq 0x48(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x44d0
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xef6f
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xef76
addq $0x18, %rbx
leaq 0x166eb(%rip), %rsi     # 0x255c0
leaq 0xe8(%rsp), %rdi
movq %rbx, %rdx
callq 0x568a
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x16122(%rip), %rsi     # 0x2501a
leaq 0x16120(%rip), %rdx     # 0x2501f
leaq 0xa8(%rsp), %rdi
callq 0x579e
leaq 0x235d5(%rip), %rdi     # 0x324e8
leaq 0xe8(%rsp), %rdx
leaq 0xa8(%rsp), %rcx
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x20f32
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xef4d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf113
movq 0xf8(%rsp), %rsi
jmp 0xf10b
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 0x1661b(%rip), %rsi     # 0x255b4
callq 0x4840
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xefc1
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xefc9
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 0xf022
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0xf02a
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 0x15fc2(%rip), %rsi     # 0x2501a
leaq 0x15fc0(%rip), %rdx     # 0x2501f
leaq 0xc8(%rsp), %rdi
callq 0x579e
leaq 0x23475(%rip), %rdi     # 0x324e8
leaq 0x88(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x20f32
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xf0ad
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xf0ca
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf0e1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xf0f8
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf113
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0xf12a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
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 0xf161
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf161
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf2e2
movq 0xf8(%rsp), %rsi
jmp 0xf2a2
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf1a2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf1a2
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xf2c9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf2c9
jmp 0xf1da
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
jne 0xf2d8
jmp 0xf2f9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0xf2bf
jmp 0xf2f9
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0xf215
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf215
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xf237
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf237
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xf253
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf253
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xf26f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf26f
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf2e2
movq 0x58(%rsp), %rsi
jmp 0xf2a2
jmp 0xf2df
movq %rax, %rbx
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf2e2
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0xf2e2
jmp 0xf2df
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf2f9
movq 0x18(%rsp), %rsi
jmp 0xf2f1
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xf2f9
movq 0x58(%rsp), %rsi
jmp 0xf2f1
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0xf2f9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4790
nop