// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/dataprov/dataprov_jobrun.cc
// Function: sched_run_routine(void*)
static void *sched_run_routine(void *arg)
{
  SCDC_TRACE(__func__ << ": arg: '" << arg << "'");

  scdc_dataprov_jobrun *dataprov_jobrun = static_cast<scdc_dataprov_jobrun *>(arg);

  pthread_mutex_lock(&dataprov_jobrun->sched_lock);
  while (dataprov_jobrun->sched_run)
  {
    struct timespec abstime;
    abstimeout(&abstime, 0.1, -1);

    pthread_cond_timedwait(&dataprov_jobrun->sched_cond, &dataprov_jobrun->sched_lock, &abstime);

/*    SCDC_TRACE(__func__ << ": " << time(NULL) << " TICK-TACK");*/

    if (!dataprov_jobrun->runjobs) continue;

    while (dataprov_jobrun->sched_jobs_wait.size() > 0)
    {
      /* check scheduling method */
      dataprov_jobrun->sched->update(dataprov_jobrun->sched_method);

      string jobid;
      scdc_dataprov_jobrun_job_t job;
      scdc_dataprov_jobrun_res_t jobres;
      scdcint_t m;

      if (!dataprov_jobrun->sched->job_get_runable(jobid, job, jobres, m)) break;

      sched_job_arg_t *sched_job_arg = new sched_job_arg_t;
      sched_job_arg->dataprov_jobrun = dataprov_jobrun;
      sched_job_arg->jobid = jobid;
      sched_job_arg->jobcmds = job.jobcmds;
      sched_job_arg->jobres = jobres;
      sched_job_arg->m = m;

      dataprov_jobrun->sched->job_started(m, jobid, sched_job_arg->jobres);

      pthread_t thread;
      pthread_create(&thread, NULL, sched_job_routine, sched_job_arg);

      dataprov_jobrun->sched_jobs_run.insert(scdc_dataprov_jobrun::sched_jobs_run_t::value_type(jobid, thread));

      job.waiting = false;
      dataprov_jobrun->set_job(jobid, job);

      pthread_cond_signal(&dataprov_jobrun->sched_cond_finished);
    }
  }
  pthread_mutex_unlock(&dataprov_jobrun->sched_lock);

  SCDC_TRACE(__func__ << ": return");

  pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %r14
addq $0x190, %rdi            # imm = 0x190
movq %rdi, 0x28(%rsp)
callq 0xb7d0
cmpb $0x1, 0x188(%r14)
jne 0x4fbc8
leaq 0x1b8(%r14), %rax
movq %rax, 0x98(%rsp)
leaq 0xf0(%r14), %r12
leaq 0x60(%rsp), %r15
leaq 0x80(%rsp), %rbx
leaq 0x240(%r14), %rax
movq %rax, 0xa8(%rsp)
leaq 0x1e8(%r14), %rax
movq %rax, 0xa0(%rsp)
leaq 0xe0(%rsp), %rbp
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
movsd 0x1d122(%rip), %xmm0    # 0x6ca40
movsd 0x19aaa(%rip), %xmm1    # 0x693d0
callq 0x1cd2f
movq 0x98(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0xb810
cmpb $0x1, 0xc8(%r14)
jne 0x4fbba
cmpq $0x0, 0x238(%r14)
je 0x4fbba
movq 0x180(%r14), %rdi
movq %r12, %rsi
callq 0x54cac
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
xorl %r13d, %r13d
movq %r13, 0x10(%rsp)
movb %r13b, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %r15, 0x50(%rsp)
movq %r13, 0x58(%rsp)
movb %r13b, 0x60(%rsp)
movq %rbx, 0x70(%rsp)
movq %r13, 0x78(%rsp)
movb %r13b, 0x80(%rsp)
movb $0x1, 0x90(%rsp)
movq %r13, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movq 0x180(%r14), %rdi
cmpq %r13, 0x38(%rdi)
jne 0x4fb5c
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbp, %rcx
callq 0x55082
testb %al, %al
je 0x4fb59
movl $0x68, %edi
callq 0xb500
movq %rax, %r13
leaq 0x8(%rax), %rdi
addq $0x18, %rax
movq %rax, 0x8(%r13)
xorl %ecx, %ecx
movq %rcx, 0x10(%r13)
movb %cl, 0x18(%r13)
leaq 0x38(%r13), %rax
movq %rax, 0x28(%r13)
movq %rcx, 0x30(%r13)
movb %cl, 0x38(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r13)
movq %rcx, 0x58(%r13)
movq %r14, (%r13)
leaq 0x8(%rsp), %rsi
callq 0xb2c0
leaq 0x28(%r13), %rdi
leaq 0x70(%rsp), %rsi
callq 0xb2c0
movq %r13, %rdi
addq $0x48, %rdi
movq %rbp, %rsi
callq 0x54df2
movq $0x0, 0x60(%r13)
movq 0x48(%r13), %rax
movq 0x50(%r13), %rcx
cmpq %rcx, %rax
je 0x4fa96
movq 0x180(%r14), %rdx
movq 0x28(%rdx), %rsi
movq 0x28(%rax), %rdi
imulq 0x20(%rax), %rdi
subq %rdi, %rsi
addq $0x30, %rax
cmpq %rcx, %rax
jne 0x4fa7d
movq %rsi, 0x28(%rdx)
movq %rbp, %rbx
movq %r15, %rbp
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
leaq 0x2b5a(%rip), %rdx      # 0x52607
movq %r13, %rcx
callq 0xba00
leaq 0xc8(%rsp), %r13
movq %r13, 0xb8(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
callq 0x1d0a0
movq 0xb0(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xa8(%rsp), %rdi
movq %r15, %rsi
callq 0x5562e
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
movq %rbp, %r15
je 0x4fb22
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0xb510
movb $0x0, 0x90(%rsp)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x4ecbe
movq %rbx, %rbp
movq 0xa0(%rsp), %rdi
callq 0xb030
movb $0x1, %r13b
leaq 0x80(%rsp), %rbx
jmp 0x4fb5c
xorl %r13d, %r13d
movq %rbp, %rdi
callq 0x527b2
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4fb7e
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x4fb95
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4fbb1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
testb %r13b, %r13b
jne 0x4f94e
cmpb $0x0, 0x188(%r14)
jne 0x4f90b
movq 0x28(%rsp), %rdi
callq 0xb3b0
xorl %edi, %edi
callq 0xb9d0
movq %rax, %r14
jmp 0x4fc09
movq %rax, %r14
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
movq %rbp, %r15
je 0x4fc09
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x4fc09
movq %rax, %r14
movq %rbp, %r15
leaq 0x80(%rsp), %rbx
jmp 0x4fc18
jmp 0x4fc15
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
callq 0x527b2
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4fc3f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x4fc56
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4fc72
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %r14, %rdi
callq 0xb9c0