// File: /workspace/github_c_makefile_star2_O0/silverneko[P]miku/./src/main.cpp
// Function: main
int main(int argc, char *argv[])
{
   //initialize
   bool verbose = false;
   int ac;
   while((ac = getopt_long(argc, argv, optstring, longopts, NULL)) != -1){
      switch(ac){
         case 'v':
            verbose = true;
            break;
         case 'p':
            MAXPARNUM = cast(optarg).to<int>();
            break;
         case 'b':
            BOXOFFSET = cast(optarg).to<int>();
            break;
         case 'a':
            AGGUPDATE = true;
            break;
         default:
            usage();
      }
   }
   
   if(!verbose){
      freopen("/dev/null", "w", stderr);
   }
   
   //initialize done
   
   if(geteuid() != 0){
      cerr << "Must be started as root !" << endl;
      return 0;
   }
   
   while(true){
      submission sub;
      int status = fetchSubmission(sub);
      if(status != 0){
         if(status == -2){
            cerr << "[ERROR] Unable to connect to TIOJ url" << endl; 
         }
         usleep(1000000);
         continue;
      }
      cerr << "Recieved submission [" << sub.submission_id << "]" << endl;
      respondValidating(sub.submission_id);
      if(fetchProblem(sub) == -1){
         usleep(1000000);
         cerr << "[ERROR] Unable to fetch problem meta" << endl;
         continue;
      }
      
      int verdict = testsuite(sub);
      sendResult(sub, verdict, true);
   }

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x11e0, %rsp           # imm = 0x11E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xa751(%rip), %rdx      # 0xf05c
leaq 0x103de(%rip), %rcx     # 0x14cf0
xorl %eax, %eax
movl %eax, %r8d
callq 0x4570
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
je 0x4b36
movl -0x18(%rbp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0x1168(%rbp)
subl $0x15, %eax
ja 0x4b2c
movq -0x1168(%rbp), %rax
leaq 0xa6b6(%rip), %rcx      # 0xf004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, -0x11(%rbp)
jmp 0x4b31
movq 0x10649(%rip), %rax     # 0x14fb0
movq (%rax), %rax
movq %rax, -0x1178(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x1170(%rbp)
callq 0x4600
movq -0x1178(%rbp), %rsi
movq -0x1170(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x4d90
jmp 0x499a
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4e40
jmp 0x49a9
leaq -0x38(%rbp), %rdi
callq 0x4e70
movl %eax, -0x117c(%rbp)
jmp 0x49ba
movl -0x117c(%rbp), %ecx
leaq 0x109a9(%rip), %rax     # 0x15370
movl %ecx, (%rax)
leaq -0x38(%rbp), %rdi
callq 0x4f00
leaq -0x58(%rbp), %rdi
callq 0x4240
leaq -0x59(%rbp), %rdi
callq 0x43a0
jmp 0x4b31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x4a23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x4a1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4f00
leaq -0x58(%rbp), %rdi
callq 0x4240
leaq -0x59(%rbp), %rdi
callq 0x43a0
jmp 0x4d84
movq 0x10578(%rip), %rax     # 0x14fb0
movq (%rax), %rax
movq %rax, -0x1190(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x1188(%rbp)
callq 0x4600
movq -0x1190(%rbp), %rsi
movq -0x1188(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x4d90
jmp 0x4a71
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4e40
jmp 0x4a86
leaq -0x90(%rbp), %rdi
callq 0x4e70
movl %eax, -0x1194(%rbp)
jmp 0x4a9a
movl -0x1194(%rbp), %ecx
leaq 0x108cd(%rip), %rax     # 0x15374
movl %ecx, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x4f00
leaq -0xb0(%rbp), %rdi
callq 0x4240
leaq -0xb1(%rbp), %rdi
callq 0x43a0
jmp 0x4b31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x4b0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x4b03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4f00
leaq -0xb0(%rbp), %rdi
callq 0x4240
leaq -0xb1(%rbp), %rdi
callq 0x43a0
jmp 0x4d84
leaq 0x10855(%rip), %rax     # 0x1537c
movb $0x1, (%rax)
jmp 0x4b31
callq 0x48b0
jmp 0x48fd
testb $0x1, -0x11(%rbp)
jne 0x4b59
movq 0x1048d(%rip), %rax     # 0x14fd0
movq (%rax), %rdx
leaq 0xa8a3(%rip), %rdi      # 0xf3f0
leaq 0xa6a5(%rip), %rsi      # 0xf1f9
callq 0x4390
callq 0x4210
cmpl $0x0, %eax
je 0x4b90
movq 0x10486(%rip), %rdi     # 0x14ff0
leaq 0xa68a(%rip), %rsi      # 0xf1fb
callq 0x4320
movq %rax, %rdi
movq 0x10428(%rip), %rsi     # 0x14fa8
callq 0x4370
xorl %eax, %eax
addq $0x11e0, %rsp           # imm = 0x11E0
popq %rbp
retq
jmp 0x4b92
leaq -0x1150(%rbp), %rdi
movq %rdi, -0x11a0(%rbp)
callq 0x4f20
movq -0x11a0(%rbp), %rdi
callq 0xc5a0
movl %eax, -0x1198(%rbp)
jmp 0x4bb9
movl -0x1198(%rbp), %eax
movl %eax, -0x1154(%rbp)
cmpl $0x0, -0x1154(%rbp)
je 0x4c42
cmpl $-0x2, -0x1154(%rbp)
jne 0x4c27
movq 0x10412(%rip), %rdi     # 0x14ff0
leaq 0xa630(%rip), %rsi      # 0xf215
callq 0x4320
movq %rax, -0x11a8(%rbp)
jmp 0x4bf3
movq -0x11a8(%rbp), %rdi
movq 0x103a7(%rip), %rsi     # 0x14fa8
callq 0x4370
jmp 0x4c08
jmp 0x4c27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1150(%rbp), %rdi
callq 0x51a0
jmp 0x4d84
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x44b0
jmp 0x4c33
movl $0x5, -0x1158(%rbp)
jmp 0x4d62
movq 0x103a7(%rip), %rdi     # 0x14ff0
leaq 0xa5eb(%rip), %rsi      # 0xf23b
callq 0x4320
movq %rax, -0x11b0(%rbp)
jmp 0x4c5e
movq -0x11b0(%rbp), %rdi
movl -0x114c(%rbp), %esi
callq 0x45e0
movq %rax, -0x11b8(%rbp)
jmp 0x4c79
movq -0x11b8(%rbp), %rdi
leaq 0xa5ca(%rip), %rsi      # 0xf251
callq 0x4320
movq %rax, -0x11c0(%rbp)
jmp 0x4c95
movq -0x11c0(%rbp), %rdi
movq 0x10305(%rip), %rsi     # 0x14fa8
callq 0x4370
jmp 0x4caa
movl -0x114c(%rbp), %edi
callq 0xc4b0
jmp 0x4cb7
leaq -0x1150(%rbp), %rdi
callq 0xd270
movl %eax, -0x11c4(%rbp)
jmp 0x4ccb
movl -0x11c4(%rbp), %eax
cmpl $-0x1, %eax
jne 0x4d1f
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x44b0
jmp 0x4ce2
movq 0x10307(%rip), %rdi     # 0x14ff0
leaq 0xa563(%rip), %rsi      # 0xf253
callq 0x4320
movq %rax, -0x11d0(%rbp)
jmp 0x4cfe
movq -0x11d0(%rbp), %rdi
movq 0x1029c(%rip), %rsi     # 0x14fa8
callq 0x4370
jmp 0x4d13
movl $0x5, -0x1158(%rbp)
jmp 0x4d62
leaq -0x1150(%rbp), %rdi
callq 0x6010
movl %eax, -0x11d4(%rbp)
jmp 0x4d33
movl -0x11d4(%rbp), %eax
movl %eax, -0x115c(%rbp)
movl -0x115c(%rbp), %esi
leaq -0x1150(%rbp), %rdi
movl $0x1, %edx
callq 0xde00
jmp 0x4d58
movl $0x0, -0x1158(%rbp)
leaq -0x1150(%rbp), %rdi
callq 0x51a0
movl -0x1158(%rbp), %eax
testl %eax, %eax
je 0x4d7f
jmp 0x4d7a
jmp 0x4b92
jmp 0x4b92
movq -0x68(%rbp), %rdi
callq 0x45f0
nopl (%rax)