// File: /workspace/github_c_makefile_star2_O0/silverneko[P]miku/./src/server_io.cpp
// Function: fetchProblem(submission&)
int fetchProblem(submission &sub)
{
   //get submission code
   char *buff = new char[5*1024*1024];
   ostringstream sout;
   sout << "fetch_code.py " << sub.submission_id;
   FILE* Pipe = popen(sout.str().c_str(), "r");
   sout.str("");
   while(fgets(buff, 5*1024*1024, Pipe) != NULL)
      sout << buff;
   sub.code = sout.str();
   pclose(Pipe);
   
   //get sjcode
   sout.str("");
   sout << "fetch_sjcode.py " << sub.problem_id;
   Pipe = popen(sout.str().c_str(), "r");
   sout.str("");
   while(fgets(buff, 5*1024*1024, Pipe) != NULL)
      sout << buff;
   sub.sjcode = sout.str();
   pclose(Pipe);
   
   //get interlib
   sout.str("");
   sout << "fetch_interlib.py " << sub.problem_id;
   Pipe = popen(sout.str().c_str(), "r");
   sout.str("");
   while(fgets(buff, 5*1024*1024, Pipe) != NULL)
      sout << buff;
   sub.interlib = sout.str();
   pclose(Pipe);
   
   delete [] buff;
   //check if testdata dir exists
   sout.str("");
   sout << "./testdata/";
   sout << setfill('0') << setw(4) << sub.problem_id;
   string testdata_dir(sout.str());
   if(access(testdata_dir.c_str(), F_OK)){
      system(("mkdir " + testdata_dir + " 2>/dev/null").c_str());
   }

   //download testdata
   if(downloadTestdata(sub) == -1){
      return -1;
   }
   
   //get memlimit, timelimit
   sout.str("");
   sout << "fetch_limits.py " << sub.problem_id;
   Pipe = popen(sout.str().c_str(), "r");
   for(int i = 0; i < sub.testdata_count; ++i){
      fscanf(Pipe, "%d %d", &sub.time_limit[i], &sub.mem_limit[i]);
   }
   pclose(Pipe);
   
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x10(%rbp)
movl $0x500000, %edi         # imm = 0x500000
callq 0x4030
movq %rax, -0x18(%rbp)
leaq -0x190(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x4480
movq -0x420(%rbp), %rdi
leaq 0x24c3(%rip), %rsi      # 0xf771
callq 0x4320
movq %rax, -0x418(%rbp)
jmp 0xd2bc
movq -0x418(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x45e0
jmp 0xd2d1
leaq -0x1c8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd2e6
leaq -0x1c8(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
leaq 0x2543(%rip), %rsi      # 0xf83f
callq 0x4130
movq %rax, -0x428(%rbp)
jmp 0xd30a
leaq -0x1c8(%rbp), %rdi
callq 0x4240
movq -0x428(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0x4600
movq -0x430(%rbp), %rdx
leaq 0x2225(%rip), %rsi      # 0xf56a
leaq -0x1e8(%rbp), %rdi
callq 0x4d90
jmp 0xd353
leaq -0x190(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x41c0
jmp 0xd368
leaq -0x1e8(%rbp), %rdi
callq 0x4240
leaq -0x1e9(%rbp), %rdi
callq 0x43a0
movq -0x18(%rbp), %rdi
movq -0x1a8(%rbp), %rdx
movl $0x500000, %esi         # imm = 0x500000
callq 0x4530
movq %rax, -0x438(%rbp)
jmp 0xd39e
movq -0x438(%rbp), %rax
cmpq $0x0, %rax
je 0xd440
movq -0x18(%rbp), %rsi
leaq -0x190(%rbp), %rdi
callq 0x4320
jmp 0xd3c1
jmp 0xd380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x4240
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xd42f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x4240
leaq -0x1e9(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
leaq -0x210(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd455
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
leaq -0x210(%rbp), %rsi
movq %rsi, -0x440(%rbp)
callq 0x4410
movq -0x440(%rbp), %rdi
callq 0x4240
movq -0x1a8(%rbp), %rdi
callq 0x44c0
jmp 0xd48a
leaq -0x231(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x4600
movq -0x448(%rbp), %rdx
leaq 0x20bf(%rip), %rsi      # 0xf56a
leaq -0x230(%rbp), %rdi
callq 0x4d90
jmp 0xd4b9
leaq -0x190(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x41c0
jmp 0xd4ce
leaq -0x230(%rbp), %rdi
callq 0x4240
leaq -0x231(%rbp), %rdi
callq 0x43a0
leaq 0x2293(%rip), %rsi      # 0xf780
leaq -0x190(%rbp), %rdi
callq 0x4320
movq %rax, -0x450(%rbp)
jmp 0xd502
movq -0x450(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xd516
leaq -0x258(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd52b
leaq -0x258(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
leaq 0x22fe(%rip), %rsi      # 0xf83f
callq 0x4130
movq %rax, -0x458(%rbp)
jmp 0xd54f
movq -0x458(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4240
leaq -0x279(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x4600
movq -0x460(%rbp), %rdx
leaq 0x1fe0(%rip), %rsi      # 0xf56a
leaq -0x278(%rbp), %rdi
callq 0x4d90
jmp 0xd598
leaq -0x190(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x41c0
jmp 0xd5ad
leaq -0x278(%rbp), %rdi
callq 0x4240
leaq -0x279(%rbp), %rdi
callq 0x43a0
movq -0x18(%rbp), %rdi
movq -0x1a8(%rbp), %rdx
movl $0x500000, %esi         # imm = 0x500000
callq 0x4530
movq %rax, -0x468(%rbp)
jmp 0xd5e3
movq -0x468(%rbp), %rax
cmpq $0x0, %rax
je 0xd6b1
movq -0x18(%rbp), %rsi
leaq -0x190(%rbp), %rdi
callq 0x4320
jmp 0xd606
jmp 0xd5c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xd63a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x4240
leaq -0x231(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4240
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xd6a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x4240
leaq -0x279(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
leaq -0x2a0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd6c6
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
leaq -0x2a0(%rbp), %rsi
movq %rsi, -0x470(%rbp)
callq 0x4410
movq -0x470(%rbp), %rdi
callq 0x4240
movq -0x1a8(%rbp), %rdi
callq 0x44c0
jmp 0xd6fb
leaq -0x2c1(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x4600
movq -0x478(%rbp), %rdx
leaq 0x1e4e(%rip), %rsi      # 0xf56a
leaq -0x2c0(%rbp), %rdi
callq 0x4d90
jmp 0xd72a
leaq -0x190(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x41c0
jmp 0xd73f
leaq -0x2c0(%rbp), %rdi
callq 0x4240
leaq -0x2c1(%rbp), %rdi
callq 0x43a0
leaq 0x2033(%rip), %rsi      # 0xf791
leaq -0x190(%rbp), %rdi
callq 0x4320
movq %rax, -0x480(%rbp)
jmp 0xd773
movq -0x480(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xd787
leaq -0x2e8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd79c
leaq -0x2e8(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
leaq 0x208d(%rip), %rsi      # 0xf83f
callq 0x4130
movq %rax, -0x488(%rbp)
jmp 0xd7c0
movq -0x488(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4240
leaq -0x309(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x4600
movq -0x490(%rbp), %rdx
leaq 0x1d6f(%rip), %rsi      # 0xf56a
leaq -0x308(%rbp), %rdi
callq 0x4d90
jmp 0xd809
leaq -0x190(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x41c0
jmp 0xd81e
leaq -0x308(%rbp), %rdi
callq 0x4240
leaq -0x309(%rbp), %rdi
callq 0x43a0
movq -0x18(%rbp), %rdi
movq -0x1a8(%rbp), %rdx
movl $0x500000, %esi         # imm = 0x500000
callq 0x4530
movq %rax, -0x498(%rbp)
jmp 0xd854
movq -0x498(%rbp), %rax
cmpq $0x0, %rax
je 0xd922
movq -0x18(%rbp), %rsi
leaq -0x190(%rbp), %rdi
callq 0x4320
jmp 0xd877
jmp 0xd836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xd8ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x4240
leaq -0x2c1(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4240
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xd911
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x4240
leaq -0x309(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
leaq -0x330(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xd937
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
leaq -0x330(%rbp), %rsi
movq %rsi, -0x4a0(%rbp)
callq 0x4410
movq -0x4a0(%rbp), %rdi
callq 0x4240
movq -0x1a8(%rbp), %rdi
callq 0x44c0
jmp 0xd96c
movq -0x18(%rbp), %rax
movq %rax, -0x4a8(%rbp)
cmpq $0x0, %rax
je 0xd989
movq -0x4a8(%rbp), %rdi
callq 0x4460
leaq -0x351(%rbp), %rdi
movq %rdi, -0x4b0(%rbp)
callq 0x4600
movq -0x4b0(%rbp), %rdx
leaq 0x1bc0(%rip), %rsi      # 0xf56a
leaq -0x350(%rbp), %rdi
callq 0x4d90
jmp 0xd9b8
leaq -0x190(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x41c0
jmp 0xd9cd
leaq -0x350(%rbp), %rdi
callq 0x4240
leaq -0x351(%rbp), %rdi
callq 0x43a0
leaq 0x1b1f(%rip), %rsi      # 0xf50b
leaq -0x190(%rbp), %rdi
callq 0x4320
jmp 0xd9fa
movl $0x30, %edi
callq 0x9180
movb %al, -0x4b1(%rbp)
jmp 0xda0c
movb -0x4b1(%rbp), %al
movb %al, -0x352(%rbp)
movzbl -0x352(%rbp), %esi
leaq -0x190(%rbp), %rdi
callq 0x4520
movq %rax, -0x4c0(%rbp)
jmp 0xda34
movl $0x4, %edi
callq 0x91a0
movl %eax, -0x4c4(%rbp)
jmp 0xda46
movq -0x4c0(%rbp), %rdi
movl -0x4c4(%rbp), %eax
movl %eax, -0x358(%rbp)
movl -0x358(%rbp), %esi
callq 0x43d0
movq %rax, -0x4d0(%rbp)
jmp 0xda6d
movq -0x4d0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xda81
leaq -0x378(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xda96
leaq -0x378(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
xorl %esi, %esi
callq 0x45a0
cmpl $0x0, %eax
je 0xdbbd
leaq 0x1ce8(%rip), %rsi      # 0xf7a4
leaq -0x3b8(%rbp), %rdi
leaq -0x378(%rbp), %rdx
callq 0xe270
jmp 0xdad1
leaq 0x1cd3(%rip), %rdx      # 0xf7ab
leaq -0x398(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0xe220
jmp 0xdaed
leaq -0x398(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
callq 0x42f0
jmp 0xdb03
leaq -0x398(%rbp), %rdi
callq 0x4240
leaq -0x3b8(%rbp), %rdi
callq 0x4240
jmp 0xdbbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xdb52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x4240
leaq -0x351(%rbp), %rdi
callq 0x43a0
jmp 0xdde2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xddd6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xdbac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x4240
leaq -0x3b8(%rbp), %rdi
callq 0x4240
jmp 0xddd6
movq -0x10(%rbp), %rdi
callq 0xca10
movl %eax, -0x4d4(%rbp)
jmp 0xdbce
movl -0x4d4(%rbp), %eax
cmpl $-0x1, %eax
jne 0xdbef
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x3bc(%rbp)
jmp 0xddb2
leaq -0x3e1(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x4600
movq -0x4e0(%rbp), %rdx
leaq 0x195a(%rip), %rsi      # 0xf56a
leaq -0x3e0(%rbp), %rdi
callq 0x4d90
jmp 0xdc1e
leaq -0x190(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x41c0
jmp 0xdc33
leaq -0x3e0(%rbp), %rdi
callq 0x4240
leaq -0x3e1(%rbp), %rdi
callq 0x43a0
leaq 0x1b66(%rip), %rsi      # 0xf7b8
leaq -0x190(%rbp), %rdi
callq 0x4320
movq %rax, -0x4e8(%rbp)
jmp 0xdc67
movq -0x4e8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xdc7b
leaq -0x408(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4350
jmp 0xdc90
leaq -0x408(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
leaq 0x1b99(%rip), %rsi      # 0xf83f
callq 0x4130
movq %rax, -0x4f0(%rbp)
jmp 0xdcb4
movq -0x4f0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x408(%rbp), %rdi
callq 0x4240
movl $0x0, -0x40c(%rbp)
movl -0x40c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xf0(%rcx), %eax
jge 0xdd93
movq -0x1a8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x40c(%rbp), %rcx
leaq 0x414(%rax,%rcx,4), %rdx
leaq 0xf4(%rax,%rcx,4), %rcx
leaq 0x1ab2(%rip), %rsi      # 0xf7c9
xorl %eax, %eax
callq 0x4630
jmp 0xdd20
jmp 0xdd22
movl -0x40c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40c(%rbp)
jmp 0xdcd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xdd65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x4240
leaq -0x3e1(%rbp), %rdi
callq 0x43a0
jmp 0xddd6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x408(%rbp), %rdi
callq 0x4240
jmp 0xddd6
movq -0x1a8(%rbp), %rdi
callq 0x44c0
jmp 0xdda1
movl $0x0, -0x4(%rbp)
movl $0x1, -0x3bc(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x4240
leaq -0x190(%rbp), %rdi
callq 0x40d0
movl -0x4(%rbp), %eax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
leaq -0x378(%rbp), %rdi
callq 0x4240
leaq -0x190(%rbp), %rdi
callq 0x40d0
movq -0x198(%rbp), %rdi
callq 0x45f0
nopw (%rax,%rax)