// File: /workspace/github_c_makefile_star2_O3/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 $0x628, %rsp            # imm = 0x628
movq %rdi, 0x8(%rsp)
leaq 0x2a8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3350
leaq 0x1834(%rip), %rsi      # 0x94c3
movl $0xb, %edx
movq %rbx, %rdi
callq 0x32f0
movq 0x2a8(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%rsp,%rcx), %rbx
addq $0x2a8, %rbx            # imm = 0x2A8
cmpb $0x0, 0xe1(%rbx)
jne 0x7cd8
movq %rbx, %rdi
movl $0x20, %esi
callq 0x3260
movb $0x1, 0xe1(%rbx)
movq 0x2a8(%rsp), %rax
movb $0x30, 0xe0(%rbx)
movq -0x18(%rax), %rax
movq $0x4, 0x2b8(%rsp,%rax)
movq 0x8(%rsp), %rax
movl (%rax), %esi
leaq 0x2a8(%rsp), %rdi
callq 0x34d0
leaq 0x17c5(%rip), %rsi      # 0x94cf
leaq 0x2a8(%rsp), %rdi
movl $0x6, %edx
callq 0x32f0
leaq 0x2b0(%rsp), %rsi
leaq 0x88(%rsp), %rdi
callq 0x3430
leaq 0x430(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x17de(%rip), %rdx      # 0x9522
leaq 0x420(%rsp), %rdi
movq %rdx, %rsi
callq 0x3f86
leaq 0x420(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x33d0
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7d8e
movq 0x430(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x1955(%rip), %rsi      # 0x96ea
leaq 0x2a8(%rsp), %rdi
movl $0x17, %edx
callq 0x32f0
movq 0x8(%rsp), %rax
movl (%rax), %esi
leaq 0x2a8(%rsp), %rdi
callq 0x34d0
leaq 0x420(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x3430
movq 0x420(%rsp), %rdi
leaq 0x1a12(%rip), %rsi      # 0x97f1
callq 0x30e0
movq %rax, 0x30(%rsp)
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7e0e
movq 0x430(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rax
leaq 0xf0(%rax), %rbp
leaq 0x195d(%rip), %rsi      # 0x977e
movq 0x30(%rsp), %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3500
cmpl $0x0, (%rbp)
jle 0x828a
leaq 0xb8(%rsp), %r13
movq 0x515f(%rip), %rax      # 0xcfa8
movq (%rax), %rcx
movq %rcx, 0x70(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x68(%rsp)
leaq 0x420(%rsp), %rbx
xorl %r12d, %r12d
movq %rbp, 0x78(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x188c(%rip), %rsi      # 0x9702
leaq 0x3c(%rsp), %rdx
leaq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x3500
leaq 0x430(%rsp), %rax
movq %rax, 0x420(%rsp)
movq %rbx, %rdi
leaq 0x1681(%rip), %rdx      # 0x9522
movq %rdx, %rsi
callq 0x3f86
leaq 0x2b0(%rsp), %rdi
movq %rbx, %rsi
callq 0x33d0
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7ede
movq 0x430(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
leaq 0x2a8(%rsp), %rdi
callq 0x32f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %r14, %r15
addq %rcx, %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x7f2e
movq %r15, %rdi
movl $0x20, %esi
callq 0x3260
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x3, 0x10(%r14,%rax)
movq %r14, %rdi
movl %r12d, %esi
callq 0x34d0
leaq 0x48(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x3430
movq %r13, 0xa8(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x3ef0
movq %r14, %rdi
leaq 0x177b(%rip), %rsi      # 0x970a
callq 0x3520
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x3450
movq 0xa8(%rsp), %rdi
movq %r13, %rbp
cmpq %r13, %rdi
je 0x7fc4
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
callq 0x3360
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %r13d
movq 0x80(%rsp), %r14
movq 0x40(%rsp), %r15
movq %rbx, %rdi
callq 0x3080
testb $0x5, %r13b
movq %rbp, %r13
jne 0x8007
cmpq %r15, %r14
je 0x8254
movq %r13, 0xa8(%rsp)
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
leaq 0x1501(%rip), %rdx      # 0x9522
movq %rdx, %rsi
callq 0x3f86
leaq 0x2b0(%rsp), %rdi
movq %r14, %rsi
callq 0x33d0
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x8056
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
movl 0x3c(%rsp), %esi
leaq 0x2a8(%rsp), %rdi
callq 0x34d0
movb $0x20, 0xa8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x32f0
movq 0x8(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x34d0
movb $0x20, 0xa8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x32f0
movq %rax, %rdi
movl %r12d, %esi
callq 0x34d0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x3430
movl $0x12, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x162c(%rip), %rcx      # 0x9710
callq 0x32e0
movq %rbp, %r13
movq %rbp, 0xa8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8118
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x8120
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0xb0(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xa8(%rsp), %rdi
callq 0x3240
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x8165
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8181
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3ef0
movq %r14, %rdi
leaq 0x1560(%rip), %rsi      # 0x970a
callq 0x3520
leaq 0xa8(%rsp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3530
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x81e0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x40(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x3110
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq 0x70(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq -0x18(%rax), %rax
movq 0x68(%rsp), %rcx
movq %rcx, 0xa8(%rsp,%rax)
leaq 0xb0(%rsp), %rdi
callq 0x3230
leaq 0x1a0(%rsp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x30a0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8278
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
incl %r12d
movq 0x78(%rsp), %rbp
cmpl (%rbp), %r12d
jl 0x7e6a
movq 0x30(%rsp), %rdi
callq 0x3380
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x82b5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x4cfc(%rip), %rsi      # 0xcfb8
leaq 0x2a8(%rsp), %rdi
callq 0x3170
leaq 0x318(%rsp), %rdi
callq 0x3100
xorl %eax, %eax
addq $0x628, %rsp            # imm = 0x628
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x83e4
jmp 0x83e4
jmp 0x8385
jmp 0x83e4
jmp 0x8305
jmp 0x83e4
movq %rax, %rbx
jmp 0x8436
jmp 0x83e9
jmp 0x8360
jmp 0x83e9
jmp 0x8360
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x83ec
movq 0xb8(%rsp), %rsi
jmp 0x8377
jmp 0x83e9
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x8363
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x8363
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x83ec
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x83ec
jmp 0x83e4
jmp 0x83e4
movq %rax, %rbx
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x8415
movq 0x430(%rsp), %rsi
jmp 0x840d
jmp 0x83e4
movq %rax, %rbx
jmp 0x83f9
jmp 0x83b0
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x83f9
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x83f9
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x33c0
jmp 0x83ec
movq %rax, %rbx
jmp 0x8415
movq %rax, %rbx
leaq 0x420(%rsp), %rdi
callq 0x30a0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8415
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8436
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x4b7b(%rip), %rsi      # 0xcfb8
leaq 0x2a8(%rsp), %rdi
callq 0x3170
leaq 0x318(%rsp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x34e0