// File: /workspace/github_c_makefile_star2_O2/silverneko[P]miku/./src/sandbox.cpp
// Function: sandboxExec(int, sandboxOptions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int sandboxExec(int boxid, const sandboxOptions &opt, const string &comm)
{
   ostringstream sout;
   sout << "isolate --box-id=" << boxid;
   if(opt.cgroup) sout << " --cg";
   if(opt.preserve_env) sout << " --full-env";
   for(int i = 0; i < opt.dirs.size(); ++i)
      sout << " --dir=" << opt.dirs[i];
   if(!opt.input.empty()) sout << " --stdin=" << opt.input;
   if(!opt.output.empty()) sout << " --stdout=" << opt.output;
   if(!opt.errout.empty()) sout << " --stderr=" << opt.errout;
   if(!opt.meta.empty()) sout << " --meta=" << opt.meta;
   if(opt.mem != 0) sout << " --mem=" << opt.mem;
   sout << " --processes=" << opt.procs;
   double timeout = opt.timeout * 0.001;
   if(opt.timeout != 0){
      sout << " --time=" << fixed << setprecision(3) << timeout;
      sout << " --wall-time=" << fixed << setprecision(3) << timeout * 2;
   }
   if(opt.fsize_limit) sout << " --fsize=" << opt.fsize_limit;
   sout << " --file-limit=" << opt.file_limit;
   sout << " --extra-time=0.2";
   sout << " --run -- " << comm;
   cerr << "[debug] box-" << boxid << " execute command : " << sout.str() << endl;
   
   system(sout.str().c_str());
   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movl %edi, %ebx
leaq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0x3360
leaq 0x451d(%rip), %rsi      # 0x8280
movq %r12, %rdi
callq 0x3290
movq %rax, %rdi
movl %ebx, %esi
callq 0x34c0
cmpb $0x1, (%r15)
jne 0x3d8c
leaq 0x4510(%rip), %rsi      # 0x8292
leaq 0x30(%rsp), %rdi
callq 0x3290
cmpb $0x1, 0x1(%r15)
jne 0x3da4
leaq 0x44fe(%rip), %rsi      # 0x8298
leaq 0x30(%rsp), %rdi
callq 0x3290
xorl %ebp, %ebp
leaq 0x44f7(%rip), %r12      # 0x82a4
leaq 0x30(%rsp), %r13
xorl %r14d, %r14d
movq 0x10(%r15), %rax
subq 0x8(%r15), %rax
sarq $0x5, %rax
cmpq %r14, %rax
jbe 0x3de9
movq %r13, %rdi
movq %r12, %rsi
callq 0x3290
movq 0x8(%r15), %rsi
addq %rbp, %rsi
movq %rax, %rdi
callq 0x3280
incq %r14
addq $0x20, %rbp
jmp 0x3db5
cmpq $0x0, 0x28(%r15)
je 0x3e0d
leaq 0x44b5(%rip), %rsi      # 0x82ac
leaq 0x30(%rsp), %rdi
callq 0x3290
leaq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0x3280
cmpq $0x0, 0x48(%r15)
je 0x3e31
leaq 0x449b(%rip), %rsi      # 0x82b6
leaq 0x30(%rsp), %rdi
callq 0x3290
leaq 0x40(%r15), %rsi
movq %rax, %rdi
callq 0x3280
cmpq $0x0, 0x68(%r15)
je 0x3e55
leaq 0x4482(%rip), %rsi      # 0x82c1
leaq 0x30(%rsp), %rdi
callq 0x3290
leaq 0x60(%r15), %rsi
movq %rax, %rdi
callq 0x3280
cmpq $0x0, 0x88(%r15)
je 0x3e7f
leaq 0x4466(%rip), %rsi      # 0x82cc
leaq 0x30(%rsp), %rdi
callq 0x3290
leaq 0x80(%r15), %rsi
movq %rax, %rdi
callq 0x3280
cmpl $0x0, 0xa0(%r15)
je 0x3ea9
leaq 0x4445(%rip), %rsi      # 0x82d5
leaq 0x30(%rsp), %rdi
callq 0x3290
movl 0xa0(%r15), %esi
movq %rax, %rdi
callq 0x34c0
leaq 0x442d(%rip), %rsi      # 0x82dd
leaq 0x30(%rsp), %rdi
callq 0x3290
movl 0xa4(%r15), %esi
movq %rax, %rdi
callq 0x34c0
movl 0xa8(%r15), %ebp
testl %ebp, %ebp
je 0x3f6c
leaq 0x440c(%rip), %rsi      # 0x82eb
leaq 0x30(%rsp), %rdi
callq 0x3290
cvtsi2sd %ebp, %xmm0
mulsd 0x4383(%rip), %xmm0     # 0x8278
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl 0x18(%rax,%rdx), %esi
orl $0x4, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq $0x3, 0x8(%rax,%rcx)
movq %rax, %rdi
movsd %xmm0, (%rsp)
callq 0x3440
leaq 0x43c7(%rip), %rsi      # 0x82f4
leaq 0x30(%rsp), %rdi
callq 0x3290
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl 0x18(%rax,%rdx), %esi
orl $0x4, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq $0x3, 0x8(%rax,%rcx)
movsd (%rsp), %xmm0
addsd %xmm0, %xmm0
movq %rax, %rdi
callq 0x3440
cmpl $0x0, 0xb0(%r15)
je 0x3f96
leaq 0x4385(%rip), %rsi      # 0x8302
leaq 0x30(%rsp), %rdi
callq 0x3290
movl 0xb0(%r15), %esi
movq %rax, %rdi
callq 0x34c0
leaq 0x436f(%rip), %rsi      # 0x830c
leaq 0x30(%rsp), %rdi
callq 0x3290
movl 0xac(%r15), %esi
movq %rax, %rdi
callq 0x34c0
leaq 0x435e(%rip), %rsi      # 0x831b
leaq 0x30(%rsp), %rdi
callq 0x3290
leaq 0x435f(%rip), %rsi      # 0x832d
leaq 0x30(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x3280
movq 0x8004(%rip), %rdi      # 0xbff0
leaq 0x4345(%rip), %rsi      # 0x8338
callq 0x3290
movq %rax, %rdi
movl %ebx, %esi
callq 0x34c0
leaq 0x433c(%rip), %rsi      # 0x8345
movq %rax, %rdi
callq 0x3290
movq %rax, %r14
leaq 0x38(%rsp), %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3430
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3280
movq %rax, %rdi
callq 0x31a0
leaq 0x10(%rsp), %rdi
callq 0x3170
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3430
movq 0x10(%rsp), %rdi
callq 0x3260
leaq 0x10(%rsp), %rdi
callq 0x3170
leaq 0x30(%rsp), %rdi
callq 0x30b0
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x408a
jmp 0x409d
jmp 0x409d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3170
jmp 0x40a0
jmp 0x409d
jmp 0x409d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x30b0
movq %rbx, %rdi
callq 0x34d0