// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7e0, %rsp            # imm = 0x7E0
movq %rdi, -0x8(%rbp)
leaq -0x180(%rbp), %rdi
movq %rdi, -0x730(%rbp)
callq 0x4480
movq -0x730(%rbp), %rdi
leaq 0x2acb(%rip), %rsi      # 0xf50b
callq 0x4320
movq %rax, -0x728(%rbp)
jmp 0xca4e
movl $0x30, %edi
callq 0x9180
movb %al, -0x731(%rbp)
jmp 0xca60
movq -0x728(%rbp), %rdi
movb -0x731(%rbp), %al
movb %al, -0x18d(%rbp)
movzbl -0x18d(%rbp), %esi
callq 0x4520
movq %rax, -0x740(%rbp)
jmp 0xca88
movl $0x4, %edi
callq 0x91a0
movl %eax, -0x744(%rbp)
jmp 0xca9a
movq -0x740(%rbp), %rdi
movl -0x744(%rbp), %eax
movl %eax, -0x194(%rbp)
movl -0x194(%rbp), %esi
callq 0x43d0
movq %rax, -0x750(%rbp)
jmp 0xcac1
movq -0x750(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xcad5
leaq 0x2a3b(%rip), %rsi      # 0xf517
leaq -0x180(%rbp), %rdi
callq 0x4320
jmp 0xcaea
leaq -0x1b8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4350
jmp 0xcaff
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x758(%rbp)
callq 0x4600
movq -0x758(%rbp), %rdx
leaq 0x2a4a(%rip), %rsi      # 0xf56a
leaq -0x1d8(%rbp), %rdi
callq 0x4d90
jmp 0xcb2e
leaq -0x180(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x41c0
jmp 0xcb43
leaq -0x1d8(%rbp), %rdi
callq 0x4240
leaq -0x1d9(%rbp), %rdi
callq 0x43a0
leaq 0x2bd6(%rip), %rsi      # 0xf738
leaq -0x180(%rbp), %rdi
callq 0x4320
movq %rax, -0x760(%rbp)
jmp 0xcb77
movq -0x760(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
jmp 0xcb8b
leaq -0x208(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4350
jmp 0xcba0
leaq -0x208(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
leaq 0x2c89(%rip), %rsi      # 0xf83f
callq 0x4130
movq %rax, -0x768(%rbp)
jmp 0xcbc4
leaq -0x208(%rbp), %rdi
callq 0x4240
movq -0x768(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0xf0, %rdx
leaq 0x2bd5(%rip), %rsi      # 0xf7cc
xorl %eax, %eax
callq 0x4630
jmp 0xcc00
movl $0x0, -0x20c(%rbp)
movl -0x20c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xf0(%rcx), %eax
jge 0xd216
movq -0x1e8(%rbp), %rdi
leaq 0x2b22(%rip), %rsi      # 0xf750
xorl %eax, %eax
leaq -0x210(%rbp), %rdx
leaq -0x218(%rbp), %rcx
callq 0x4630
jmp 0xcc45
movb $0x1, -0x219(%rbp)
leaq -0x241(%rbp), %rdi
movq %rdi, -0x770(%rbp)
callq 0x4600
movq -0x770(%rbp), %rdx
leaq 0x28fd(%rip), %rsi      # 0xf56a
leaq -0x240(%rbp), %rdi
callq 0x4d90
jmp 0xcc7b
leaq -0x180(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x41c0
jmp 0xcc90
leaq -0x240(%rbp), %rdi
callq 0x4240
leaq -0x241(%rbp), %rdi
callq 0x43a0
leaq -0x180(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x4310
movq %rax, -0x778(%rbp)
jmp 0xccc4
movl $0x30, %edi
callq 0x9180
movb %al, -0x779(%rbp)
jmp 0xccd6
movq -0x778(%rbp), %rdi
movb -0x779(%rbp), %al
movb %al, -0x242(%rbp)
movzbl -0x242(%rbp), %esi
callq 0x4520
movq %rax, -0x788(%rbp)
jmp 0xccfe
movl $0x3, %edi
callq 0x91a0
movl %eax, -0x78c(%rbp)
jmp 0xcd10
movq -0x788(%rbp), %rdi
movl -0x78c(%rbp), %eax
movl %eax, -0x248(%rbp)
movl -0x248(%rbp), %esi
callq 0x43d0
movq %rax, -0x798(%rbp)
jmp 0xcd37
movq -0x798(%rbp), %rdi
movl -0x20c(%rbp), %esi
callq 0x45e0
jmp 0xcd4b
leaq -0x268(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4350
jmp 0xcd60
leaq 0x29f1(%rip), %rdx      # 0xf758
leaq -0x490(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x9310
jmp 0xcd7c
leaq -0x470(%rbp), %rdi
leaq -0x490(%rbp), %rsi
movl $0x8, %edx
callq 0x4550
jmp 0xcd96
leaq -0x490(%rbp), %rdi
callq 0x4240
leaq -0x470(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x43f0
movq %rax, -0x7a0(%rbp)
jmp 0xcdbe
movq -0x7a0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x4440
movb %al, -0x7a1(%rbp)
jmp 0xcddc
movb -0x7a1(%rbp), %al
testb $0x1, %al
jne 0xcdeb
jmp 0xcf35
movq -0x498(%rbp), %rax
cmpq -0x218(%rbp), %rax
jne 0xcf33
movb $0x0, -0x219(%rbp)
jmp 0xcf33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd253
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xce54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x4240
leaq -0x1d9(%rbp), %rdi
callq 0x43a0
jmp 0xd247
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd247
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x4240
jmp 0xd247
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xced1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x4240
leaq -0x241(%rbp), %rdi
callq 0x43a0
jmp 0xd247
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd208
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x4240
jmp 0xd208
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd1fc
jmp 0xcf35
leaq -0x470(%rbp), %rdi
callq 0x40a0
jmp 0xcf43
testb $0x1, -0x219(%rbp)
je 0xd1d0
leaq -0x4b9(%rbp), %rdi
movq %rdi, -0x7b0(%rbp)
callq 0x4600
movq -0x7b0(%rbp), %rdx
leaq 0x25f9(%rip), %rsi      # 0xf56a
leaq -0x4b8(%rbp), %rdi
callq 0x4d90
jmp 0xcf7f
leaq -0x180(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x41c0
jmp 0xcf94
leaq -0x4b8(%rbp), %rdi
callq 0x4240
leaq -0x4b9(%rbp), %rdi
callq 0x43a0
movl -0x210(%rbp), %esi
leaq -0x180(%rbp), %rdi
callq 0x45e0
movq %rax, -0x7b8(%rbp)
jmp 0xcfc7
movq -0x7b8(%rbp), %rdi
movl $0x20, %esi
callq 0x43e0
movq %rax, -0x7c0(%rbp)
jmp 0xcfe1
movq -0x7c0(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
callq 0x45e0
movq %rax, -0x7c8(%rbp)
jmp 0xcffc
movq -0x7c8(%rbp), %rdi
movl $0x20, %esi
callq 0x43e0
movq %rax, -0x7d0(%rbp)
jmp 0xd016
movq -0x7d0(%rbp), %rdi
movl -0x20c(%rbp), %esi
callq 0x45e0
jmp 0xd02a
leaq -0x500(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4350
jmp 0xd03f
leaq 0x2718(%rip), %rsi      # 0xf75e
leaq -0x4e0(%rbp), %rdi
leaq -0x500(%rbp), %rdx
callq 0xe1d0
jmp 0xd05b
leaq -0x4e0(%rbp), %rdi
callq 0x4180
movq %rax, %rdi
callq 0x42f0
jmp 0xd071
leaq -0x4e0(%rbp), %rdi
callq 0x4240
leaq -0x500(%rbp), %rdi
callq 0x4240
leaq 0x26c8(%rip), %rdx      # 0xf758
leaq -0x720(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x9310
jmp 0xd0a5
leaq -0x700(%rbp), %rdi
leaq -0x720(%rbp), %rsi
movl $0x10, %edx
callq 0x4670
jmp 0xd0bf
leaq -0x720(%rbp), %rdi
callq 0x4240
movq -0x218(%rbp), %rsi
leaq -0x700(%rbp), %rdi
callq 0x41f0
movq %rax, -0x7d8(%rbp)
jmp 0xd0e7
movq -0x7d8(%rbp), %rdi
movq 0x7eb3(%rip), %rsi      # 0x14fa8
callq 0x4370
jmp 0xd0fc
leaq -0x700(%rbp), %rdi
callq 0x44f0
jmp 0xd1d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd13f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x4b8(%rbp), %rdi
callq 0x4240
leaq -0x4b9(%rbp), %rdi
callq 0x43a0
jmp 0xd1fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
jmp 0xd182
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x4240
leaq -0x500(%rbp), %rdi
callq 0x4240
jmp 0xd1fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x720(%rbp), %rdi
callq 0x4240
jmp 0xd1fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x700(%rbp), %rdi
callq 0x44f0
jmp 0xd1fc
leaq -0x470(%rbp), %rdi
callq 0x40f0
leaq -0x268(%rbp), %rdi
callq 0x4240
movl -0x20c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20c(%rbp)
jmp 0xcc0a
leaq -0x470(%rbp), %rdi
callq 0x40f0
leaq -0x268(%rbp), %rdi
callq 0x4240
jmp 0xd247
movq -0x1e8(%rbp), %rdi
callq 0x44c0
jmp 0xd224
leaq -0x1b8(%rbp), %rdi
callq 0x4240
leaq -0x180(%rbp), %rdi
callq 0x40d0
xorl %eax, %eax
addq $0x7e0, %rsp            # imm = 0x7E0
popq %rbp
retq
leaq -0x1b8(%rbp), %rdi
callq 0x4240
leaq -0x180(%rbp), %rdi
callq 0x40d0
movq -0x188(%rbp), %rdi
callq 0x45f0
nopl (%rax,%rax)