// File: /workspace/github_c_makefile_star2_O1/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 0x1744(%rip), %rsi      # 0x94b3
movl $0xb, %edx
movq %rbx, %rdi
callq 0x32f0
movq 0x2a8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rbx
addq $0x2a8, %rbx            # imm = 0x2A8
cmpb $0x0, 0xe1(%rbx)
jne 0x7db6
movq %rbx, %rdi
movl $0x20, %esi
callq 0x3260
movb %al, 0xe0(%rbx)
movb $0x1, 0xe1(%rbx)
movb $0x30, 0xe0(%rbx)
leaq 0x2a8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x4, 0x2b8(%rsp,%rax)
movq 0x8(%rsp), %rax
movl (%rax), %esi
callq 0x34d0
leaq 0x16d4(%rip), %rsi      # 0x94bf
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 0x16ed(%rip), %rdx      # 0x9512
leaq 0x420(%rsp), %rdi
movq %rdx, %rsi
callq 0x4040
leaq 0x420(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x33d0
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7e6f
movq 0x430(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x1864(%rip), %rsi      # 0x96da
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 0x1921(%rip), %rsi      # 0x97e1
callq 0x30e0
movq %rax, 0x30(%rsp)
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7eef
movq 0x430(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rax
leaq 0xf0(%rax), %rbp
leaq 0x186c(%rip), %rsi      # 0x976e
movq 0x30(%rsp), %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3500
cmpl $0x0, (%rbp)
jle 0x8372
leaq 0xb8(%rsp), %r13
movq 0x507e(%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 0x179b(%rip), %rsi      # 0x96f2
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 0x1590(%rip), %rdx      # 0x9512
movq %rdx, %rsi
callq 0x4040
leaq 0x2b0(%rsp), %rdi
movq %rbx, %rsi
callq 0x33d0
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x7fbf
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), %rax
movq %r14, %r15
addq %rax, %r15
cmpb $0x0, 0xe1(%r14,%rax)
jne 0x8013
movq %r15, %rdi
movl $0x20, %esi
callq 0x3260
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x30, 0xe0(%r15)
movq (%r14), %rax
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 0x3fb0
movq %r14, %rdi
leaq 0x1683(%rip), %rsi      # 0x96fa
callq 0x3520
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x3450
movq 0xa8(%rsp), %rdi
movq %r13, %rbp
cmpq %r13, %rdi
je 0x80ac
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 0x80ef
cmpq %r15, %r14
je 0x833c
movq %r13, 0xa8(%rsp)
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
leaq 0x1409(%rip), %rdx      # 0x9512
movq %rdx, %rsi
callq 0x4040
leaq 0x2b0(%rsp), %rdi
movq %r14, %rsi
callq 0x33d0
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x813e
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 0x1534(%rip), %rcx      # 0x9700
callq 0x32e0
movq %rbp, %r13
movq %rbp, 0xa8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8200
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x8208
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 0x824d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8269
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 0x3fb0
movq %r14, %rdi
leaq 0x1468(%rip), %rsi      # 0x96fa
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 0x82c8
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 0x8360
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
incl %r12d
movq 0x78(%rsp), %rbp
cmpl (%rbp), %r12d
jl 0x7f4b
movq 0x30(%rsp), %rdi
callq 0x3380
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x839d
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x4c14(%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 0x84cc
jmp 0x84cc
jmp 0x846d
jmp 0x84cc
jmp 0x83ed
jmp 0x84cc
movq %rax, %rbx
jmp 0x851e
jmp 0x84d1
jmp 0x8448
jmp 0x84d1
jmp 0x8448
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x84d4
movq 0xb8(%rsp), %rsi
jmp 0x845f
jmp 0x84d1
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x844b
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x844b
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x84d4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x84d4
jmp 0x84cc
jmp 0x84cc
movq %rax, %rbx
movq 0x420(%rsp), %rdi
leaq 0x430(%rsp), %rax
cmpq %rax, %rdi
je 0x84fd
movq 0x430(%rsp), %rsi
jmp 0x84f5
jmp 0x84cc
movq %rax, %rbx
jmp 0x84e1
jmp 0x8498
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x84e1
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x84e1
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x33c0
jmp 0x84d4
movq %rax, %rbx
jmp 0x84fd
movq %rax, %rbx
leaq 0x420(%rsp), %rdi
callq 0x30a0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x84fd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x851e
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x4a93(%rip), %rsi      # 0xcfb8
leaq 0x2a8(%rsp), %rdi
callq 0x3170
leaq 0x318(%rsp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x34e0