// File: /workspace/github_c_makefile_star2_O3/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, 0x552a(%rip)      # 0x931c
jne 0x3e3d
xorl %eax, %eax
cmpb $0x1, 0x54d3(%rip)      # 0x92d0
jne 0x3f99
leaq 0x16dc(%rip), %rsi      # 0x54e6
leaq 0x10(%rsp), %rbx
movl $0x1, %edi
movq %rbx, %rdx
callq 0x4046
movq %rbx, %rdi
callq 0x22e0
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
mulq %rcx
movq %rdx, %rax
shrq $0x12, %rax
jmp 0x3f99
testq %rdi, %rdi
je 0x3e95
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
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rdx
shrq $0x7, %rax
addl %edx, %eax
addl %ecx, %eax
jmp 0x3f99
movl 0x54c5(%rip), %edi      # 0x9360
testl %edi, %edi
jne 0x3ede
movl 0x54ab(%rip), %edx      # 0x9350
leaq 0x16ad(%rip), %rsi      # 0x5559
leaq 0x15ca(%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, 0x548a(%rip)      # 0x9360
testl %eax, %eax
js 0x3fd7
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
movl 0x5473(%rip), %edi      # 0x9360
leaq 0x10(%rsp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x22c0
testl %eax, %eax
js 0x3fb0
cmpl $0xfff, %eax            # imm = 0xFFF
jae 0x3fb9
andl $0xfff, %eax            # imm = 0xFFF
movb $0x0, 0x10(%rsp,%rax)
leaq 0x11(%rsp), %rdi
movzbl -0x1(%rdi), %eax
testb $-0x21, %al
je 0x3f30
incq %rdi
jmp 0x3f1e
movb (%rdi), %al
incq %rdi
cmpb $0x20, %al
je 0x3f2b
movzbl %al, %eax
cmpl $0x28, %eax
jne 0x3fa2
movzbl (%rdi), %eax
cmpl $0x29, %eax
je 0x3f4a
testl %eax, %eax
jne 0x3f50
jmp 0x3f5b
cmpb $0x20, 0x1(%rdi)
je 0x3f5b
incq %rdi
jmp 0x3f3c
movb 0x1(%rdi), %al
incq %rdi
cmpb $0x29, %al
je 0x3f55
movzbl %al, %eax
cmpl $0x20, %eax
je 0x3f55
leaq 0x152d(%rip), %rsi      # 0x549b
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x23a0
cmpl $0x2, %eax
jne 0x3fce
movl 0x8(%rsp), %eax
addl 0xc(%rsp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
cltd
idivl 0x53cb(%rip)            # 0x9364
addq $0x1010, %rsp           # imm = 0x1010
popq %rbx
retq
leaq 0x14d9(%rip), %rdi      # 0x5482
xorl %eax, %eax
callq 0x2d7f
leaq 0x15bb(%rip), %rdi      # 0x5572
jmp 0x3fc0
leaq 0x15cc(%rip), %rdi      # 0x558c
leaq 0x14b6(%rip), %rsi      # 0x547d
xorl %eax, %eax
callq 0x2d7f
leaq 0x14f8(%rip), %rdi      # 0x54cd
jmp 0x3fa9
leaq 0x1587(%rip), %rdi      # 0x5565
leaq 0x10(%rsp), %rsi
jmp 0x3fc7