// File: /workspace/github_c_makefile_star2_O3/wtarreau[P]httpterm/httpterm.c
// Function: process_runnable_tasks
int process_runnable_tasks() {
  int next_time;
  struct task *t, *tnext;

  next_time = TIME_ETERNITY; /* set the timer to wait eternally first */

  /* look for expired tasks and add them to the run queue.
   */
  tnext = ((struct task *)LIST_HEAD(wait_queue[0]))->next;
  while ((t = tnext) != LIST_HEAD(wait_queue[0])) { /* we haven't looped ? */
      tnext = t->next;
      if (t->state & TASK_RUNNING)
	  continue;
      
      if (tv_iseternity(&t->expire))
	  continue;

      /* wakeup expired entries. It doesn't matter if they are
       * already running because of a previous event
       */
      if (tv_cmp_ms(&t->expire, &now) <= 0) {
	  task_wakeup(&rq, t);
      }
      else {
	  /* first non-runnable task. Use its expiration date as an upper bound */
	  int temp_time = tv_remain(&now, &t->expire);
	  if (temp_time)
	      next_time = temp_time;
	  break;
      }
  }

  /* process each task in the run queue now. Each task may be deleted
   * since we only use the run queue's head. Note that any task can be
   * woken up by any other task and it will be processed immediately
   * after as it will be queued on the run queue's head.
   */
  while ((t = rq) != NULL) {
      int temp_time;

      task_sleep(&rq, t);
      temp_time = t->process(t);
      next_time = MINTIME(temp_time, next_time);
  }
  return next_time;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x7330(%rip), %r15      # 0xd240
leaq 0x7329(%rip), %r14      # 0xd240
movq 0x746a(%rip), %rbx      # 0xd388
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpq %r14, %r15
je 0x6006
movq %r15, %rbp
movq (%r15), %r15
movl 0x20(%rbp), %r13d
testb $0x1, %r13b
jne 0x5f24
movq 0x28(%rbp), %rdx
testq %rdx, %rdx
jne 0x5f4d
cmpq $0x0, 0x30(%rbp)
je 0x5f24
movq %rdx, 0x8(%rsp)
leaq 0x28(%rbp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x749e(%rip), %rsi      # 0xd400
callq 0x6061
testl %eax, %eax
jg 0x5f88
cmpl $0x1, %r13d
je 0x5f24
movq %rbx, 0x10(%rbp)
movl $0x1, 0x20(%rbp)
movq %rbp, 0x7405(%rip)      # 0xd388
movq %rbp, %rbx
jmp 0x5f24
leaq 0x7471(%rip), %rdi      # 0xd400
movq 0x10(%rsp), %rsi
callq 0x6061
xorl %r12d, %r12d
testl %eax, %eax
js 0x5fa4
xorl %edx, %edx
jmp 0x5ffd
movq 0x8(%rsp), %rax
subq 0x7450(%rip), %rax      # 0xd400
imulq $0x3e8, %rax, %rsi      # imm = 0x3E8
movq 0x30(%rbp), %rdx
movq 0x7446(%rip), %rax      # 0xd408
movq %rdx, %rcx
subq %rax, %rcx
jle 0x5fdc
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
movq %rcx, %rax
imulq %rdx
jmp 0x5fec
subq %rdx, %rax
movabsq $-0x20c49ba5e353f7cf, %rcx # imm = 0xDF3B645A1CAC0831
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rsi, %rdx
cmpl $0x1, %edx
sbbl %r12d, %r12d
orl %edx, %r12d
testq %rbx, %rbx
je 0x604f
cmpl $0x1, 0x20(%rbx)
jne 0x6023
movq 0x10(%rbx), %rax
movq %rax, 0x736c(%rip)      # 0xd388
movl $0x0, 0x20(%rbx)
movq %rbx, %rdi
callq *0x38(%rbx)
movl %eax, %ecx
cmpl %eax, %r12d
cmovll %r12d, %eax
testl %ecx, %ecx
cmovsl %r12d, %eax
testl %r12d, %r12d
cmovsl %ecx, %eax
movq 0x7343(%rip), %rbx      # 0xd388
movl %eax, %r12d
testq %rbx, %rbx
jne 0x600b
jmp 0x6052
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq