// File: /workspace/github_cpp_makefile_star2_O1/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 0x50015
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 0x1cc5d(%rip), %xmm0    # 0x6c9c8
movsd 0x1963d(%rip), %xmm1    # 0x693b0
callq 0x1cdfe
movq 0x98(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0xb810
cmpb $0x1, 0xc8(%r14)
jne 0x50007
cmpq $0x0, 0x238(%r14)
je 0x50007
movq 0x180(%r14), %rdi
movq %r12, %rsi
callq 0x5510c
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 0x4ffa9
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbp, %rcx
callq 0x554ba
testb %al, %al
je 0x4ffa6
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 0x55252
movq $0x0, 0x60(%r13)
movq 0x48(%r13), %rax
movq 0x50(%r13), %rcx
cmpq %rcx, %rax
je 0x4fee3
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 0x4feca
movq %rsi, 0x28(%rdx)
movq %rbp, %rbx
movq %r15, %rbp
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
leaq 0x2b70(%rip), %rdx      # 0x52a6a
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 0x1d19a
movq 0xb0(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xa8(%rsp), %rdi
movq %r15, %rsi
callq 0x55a5a
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
movq %rbp, %r15
je 0x4ff6f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0xb510
movb $0x0, 0x90(%rsp)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x4f114
movq %rbx, %rbp
movq 0xa0(%rsp), %rdi
callq 0xb030
movb $0x1, %r13b
leaq 0x80(%rsp), %rbx
jmp 0x4ffa9
xorl %r13d, %r13d
movq %rbp, %rdi
callq 0x52c14
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4ffcb
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ffe2
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4fffe
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
testb %r13b, %r13b
jne 0x4fd9b
cmpb $0x0, 0x188(%r14)
jne 0x4fd58
movq 0x28(%rsp), %rdi
callq 0xb3b0
xorl %edi, %edi
callq 0xb9d0
movq %rax, %r14
jmp 0x50056
movq %rax, %r14
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
movq %rbp, %r15
je 0x50056
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x50056
movq %rax, %r14
movq %rbp, %r15
leaq 0x80(%rsp), %rbx
jmp 0x50065
jmp 0x50062
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
callq 0x52c14
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5008c
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x500a3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x500bf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %r14, %rdi
callq 0xb9c0
nop