// File: /workspace/github_c_makefile_star2_O2/silverneko[P]miku/isolate/isolate.c
// Function: get_run_time_ms
static int
get_run_time_ms(struct rusage *rus)
{
  if (cg_timing)
    return cg_get_run_time_ms();

  if (rus)
    {
      struct timeval total;
      timeradd(&rus->ru_utime, &rus->ru_stime, &total);
      return total.tv_sec*1000 + total.tv_usec/1000;
    }

  char buf[PROC_BUF_SIZE], *x;
  int utime, stime;
  static int proc_stat_fd;

  read_proc_file(buf, "stat", &proc_stat_fd);
  x = buf;
  while (*x && *x != ' ')
    x++;
  while (*x == ' ')
    x++;
  if (*x++ != '(')
    die("proc stat syntax error 1");
  while (*x && (*x != ')' || x[1] != ' '))
    x++;
  while (*x == ')' || *x == ' ')
    x++;
  if (sscanf(x, "%*c %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %d %d", &utime, &stime) != 2)
    die("proc stat syntax error 2");

  return (utime + stime) * 1000 / ticks_per_sec;
}

// Assembly:
pushq %rbx
subq $0x1010, %rsp           # imm = 0x1010
cmpb $0x1, 0x57b9(%rip)      # 0x931c
jne 0x3ba2
xorl %eax, %eax
cmpb $0x1, 0x5762(%rip)      # 0x92d0
jne 0x3cee
leaq 0x196b(%rip), %rsi      # 0x54e6
pushq $0x1
popq %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x3d8b
movq %rbx, %rdi
callq 0x22e0
movl $0xf4240, %ecx          # imm = 0xF4240
xorl %edx, %edx
divq %rcx
jmp 0x3cee
testq %rdi, %rdi
je 0x3bea
movl 0x10(%rdi), %ecx
addl (%rdi), %ecx
movq 0x8(%rdi), %rax
movq 0x18(%rdi), %rdx
leaq (%rdx,%rax), %rsi
xorl %edi, %edi
cmpq $0xf4240, %rsi          # imm = 0xF4240
setge %dil
leaq -0xf4240(%rdx,%rax), %rax
cmovlq %rsi, %rax
addl %ecx, %edi
imull $0x3e8, %edi, %ecx      # imm = 0x3E8
movl $0x3e8, %esi            # imm = 0x3E8
cqto
idivq %rsi
addl %ecx, %eax
jmp 0x3cee
movl 0x5770(%rip), %edi      # 0x9360
testl %edi, %edi
jne 0x3c33
movl 0x5756(%rip), %edx      # 0x9350
leaq 0x1958(%rip), %rsi      # 0x5559
leaq 0x1875(%rip), %rcx      # 0x547d
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2460
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2400
movl %eax, %edi
movl %eax, 0x5735(%rip)      # 0x9360
testl %eax, %eax
js 0x3d2c
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
movl 0x571e(%rip), %edi      # 0x9360
leaq 0x10(%rsp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x22c0
testl %eax, %eax
js 0x3d05
cmpl $0xfff, %eax            # imm = 0xFFF
jae 0x3d0e
andl $0xfff, %eax            # imm = 0xFFF
movb $0x0, 0x10(%rsp,%rax)
leaq 0x11(%rsp), %rdi
movzbl -0x1(%rdi), %eax
testb $-0x21, %al
je 0x3c85
incq %rdi
jmp 0x3c73
movb (%rdi), %al
incq %rdi
cmpb $0x20, %al
je 0x3c80
movzbl %al, %eax
cmpl $0x28, %eax
jne 0x3cf7
movzbl (%rdi), %eax
cmpl $0x29, %eax
je 0x3c9f
testl %eax, %eax
jne 0x3ca5
jmp 0x3cb0
cmpb $0x20, 0x1(%rdi)
je 0x3cb0
incq %rdi
jmp 0x3c91
movb 0x1(%rdi), %al
incq %rdi
cmpb $0x29, %al
je 0x3caa
movzbl %al, %eax
cmpl $0x20, %eax
je 0x3caa
leaq 0x17d8(%rip), %rsi      # 0x549b
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x23a0
cmpl $0x2, %eax
jne 0x3d23
movl 0x8(%rsp), %eax
addl 0xc(%rsp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
cltd
idivl 0x5676(%rip)            # 0x9364
addq $0x1010, %rsp           # imm = 0x1010
popq %rbx
retq
leaq 0x1784(%rip), %rdi      # 0x5482
xorl %eax, %eax
callq 0x3696
leaq 0x1866(%rip), %rdi      # 0x5572
jmp 0x3d15
leaq 0x1877(%rip), %rdi      # 0x558c
leaq 0x1761(%rip), %rsi      # 0x547d
xorl %eax, %eax
callq 0x3696
leaq 0x17a3(%rip), %rdi      # 0x54cd
jmp 0x3cfe
leaq 0x1832(%rip), %rdi      # 0x5565
leaq 0x10(%rsp), %rsi
jmp 0x3d1c