// File: /workspace/github_c_makefile_star2_O2/silverneko[P]miku/./src/server_io.cpp
// Function: downloadTestdata(submission&)
int downloadTestdata(submission &sub)
{
   ostringstream sout;
   sout << "./testdata/" << setfill('0') << setw(4) << sub.problem_id;
   sout << "/input";
   string dir(sout.str());

   sout.str("");
   sout << "fetch_testdata_meta.py " << sub.problem_id;
   FILE *Pipe = popen(sout.str().c_str(), "r");
   fscanf(Pipe, "%d", &sub.testdata_count);
   for(int i = 0; i < sub.testdata_count; ++i){
      int testdata_id;
      long long timestamp;
      fscanf(Pipe, "%d %lld", &testdata_id, &timestamp);
      bool flag = true;
      sout.str("");
      sout << dir << setfill('0') << setw(3) << i;
      string td(sout.str());
      ifstream fin(td + ".meta");
      long long ts;
      if(fin >> ts){
         if(ts == timestamp){
            flag = false;
         }
      }
      fin.close();
      if(flag){
         //need to renew td
         sout.str("");
         sout << testdata_id << ' ' << sub.problem_id << ' ' << i;
         system(("fetch_testdata.py " + sout.str()).c_str());
         ofstream fout(td + ".meta");
         fout << timestamp << endl;
      }
   }
   pclose(Pipe);
   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x618, %rsp            # imm = 0x618
movq %rdi, 0x8(%rsp)
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0x3360
leaq 0x1b63(%rip), %rsi      # 0x84c3
movq %rbx, %rdi
callq 0x3290
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x3410
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq 0x8(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x34c0
leaq 0x1b36(%rip), %rsi      # 0x84cf
leaq 0x98(%rsp), %rdi
callq 0x3290
leaq 0xa0(%rsp), %r15
leaq 0x78(%rsp), %rdi
movq %r15, %rsi
callq 0x3430
leaq 0x1b60(%rip), %rsi      # 0x8522
leaq 0x210(%rsp), %rdi
leaq 0x418(%rsp), %rdx
callq 0x3992
leaq 0x210(%rsp), %rsi
movq %r15, %rdi
callq 0x33e0
leaq 0x210(%rsp), %rdi
callq 0x3170
leaq 0x1ca4(%rip), %rsi      # 0x869f
leaq 0x98(%rsp), %rdi
callq 0x3290
movq 0x8(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x34c0
leaq 0x210(%rsp), %rdi
movq %r15, %rsi
callq 0x3430
leaq 0x210(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x1d6d(%rip), %rsi      # 0x87a6
callq 0x3110
movq %rax, %r14
movq %rbx, %rdi
callq 0x3170
movq 0x8(%rsp), %rax
leaq 0xf0(%rax), %rdx
leaq 0x1cd7(%rip), %rsi      # 0x8733
movq %r14, 0x18(%rsp)
movq %r14, %rdi
movq %rdx, 0x28(%rsp)
xorl %eax, %eax
callq 0x3500
leaq 0x210(%rsp), %r14
leaq 0x418(%rsp), %rbx
leaq 0x58(%rsp), %r13
xorl %ebp, %ebp
movq 0x28(%rsp), %rax
cmpl (%rax), %ebp
jge 0x6cb0
movq 0x18(%rsp), %rdi
leaq 0x1c17(%rip), %rsi      # 0x86b7
leaq 0x14(%rsp), %rdx
leaq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x3500
movq %r14, %rdi
leaq 0x1a67(%rip), %rsi      # 0x8522
movq %rbx, %rdx
callq 0x3992
movq %r15, %rdi
movq %r14, %rsi
callq 0x33e0
movq %r14, %rdi
callq 0x3170
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3280
movq %rax, %rdi
pushq $0x30
popq %rsi
callq 0x3410
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x3, 0x10(%rax,%rcx)
movq %rax, %rdi
movl %ebp, %esi
callq 0x34c0
movq %r13, %rdi
movq %r15, %rsi
callq 0x3430
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x1b9a(%rip), %rdx      # 0x86bf
callq 0x5d19
movl %ebp, 0x4(%rsp)
movq %r15, %rbp
movq %r14, %rdi
movq %rbx, %rsi
pushq $0x8
popq %rdx
callq 0x3450
movq %rbx, %r12
movq %rbx, %rdi
callq 0x3170
movq %r14, %rbx
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %r15d
movq 0x30(%rsp), %r14
movq 0x20(%rsp), %r13
movq %rbx, %rdi
callq 0x3080
testb $0x5, %r15b
movq %rbp, %r15
jne 0x6b8a
cmpq %r13, %r14
je 0x6c8a
movq %r12, %r14
movq %r12, %rdi
leaq 0x198b(%rip), %rsi      # 0x8522
leaq 0x38(%rsp), %rdx
callq 0x3992
movq %r15, %rdi
movq %r14, %rsi
callq 0x33e0
movq %r14, %rdi
callq 0x3170
movl 0x14(%rsp), %esi
leaq 0x98(%rsp), %rdi
callq 0x34c0
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x32f0
movq 0x8(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x34c0
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x32f0
movq %rax, %rdi
movl 0x4(%rsp), %esi
callq 0x34c0
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %rbp, %r15
movq %rbp, %rsi
callq 0x3430
movq %r12, %r14
movq %r12, %rdi
leaq 0x1aaf(%rip), %rsi      # 0x86c5
movq %r13, %rdx
callq 0x74ed
leaq 0x58(%rsp), %r13
movq 0x418(%rsp), %rdi
callq 0x3260
movq %r14, %rdi
callq 0x3170
leaq 0x38(%rsp), %rbp
movq %rbp, %rdi
callq 0x3170
movq %rbp, %rdi
movq %r13, %rsi
leaq 0x1a6d(%rip), %rdx      # 0x86bf
callq 0x5d19
movq %r14, %rdi
movq %rbp, %rsi
pushq $0x10
popq %rdx
callq 0x3530
movq %rbp, %rdi
callq 0x3170
movq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x3130
movq %rax, %rdi
callq 0x31a0
movq %r14, %rdi
callq 0x33d0
movq %rbx, %r14
movq %rbx, %rdi
callq 0x30d0
leaq 0x58(%rsp), %r13
movq %r13, %rdi
callq 0x3170
movl 0x4(%rsp), %ebp
incl %ebp
movq %r12, %rbx
jmp 0x6a87
movq 0x18(%rsp), %rdi
callq 0x33a0
leaq 0x78(%rsp), %rdi
callq 0x3170
leaq 0x98(%rsp), %rdi
callq 0x30b0
xorl %eax, %eax
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6d71
jmp 0x6d71
jmp 0x6d60
jmp 0x6d71
jmp 0x6cf7
jmp 0x6d71
movq %rax, %rbx
jmp 0x6d9a
jmp 0x6d76
jmp 0x6d24
movq %rax, %rbx
leaq 0x418(%rsp), %rdi
jmp 0x6d2c
movq %rax, %rbx
leaq 0x418(%rsp), %rdi
callq 0x3170
jmp 0x6d27
jmp 0x6d76
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x3170
jmp 0x6d79
jmp 0x6d76
movq %rax, %rbx
leaq 0x418(%rsp), %rdi
callq 0x33d0
jmp 0x6d79
movq %rax, %rbx
jmp 0x6d86
movq %rax, %rbx
leaq 0x418(%rsp), %rdi
callq 0x3170
jmp 0x6d86
jmp 0x6d71
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
jmp 0x6d8b
jmp 0x6d71
jmp 0x6d71
movq %rax, %rbx
jmp 0x6d90
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
callq 0x30d0
leaq 0x58(%rsp), %rdi
callq 0x3170
leaq 0x78(%rsp), %rdi
callq 0x3170
leaq 0x98(%rsp), %rdi
callq 0x30b0
movq %rbx, %rdi
callq 0x34d0