// File: mh0fm4[P]SCDC/src/components/dataprov/dataprov_jobrun_relay.cc
// Function: scdc_dataprov_jobrun_relay::sched_job_add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool scdc_dataprov_jobrun_relay::sched_job_add(const std::string &jobid, scdc_result &result)
{
  /* last sched exists, but execeeds its max. jobs? */
  if (sched_last != sched.end() && sched_last_jobs >= sched_last->second.max_parallel_jobs)
  {
    /* select next relay */
    ++sched_last;
    sched_last_jobs = 0;
  }

  /* last sched does not exist? */
  if (sched_last == sched.end())
  {
    /* restart with first */
    sched_last = sched.begin();
    sched_last_jobs = 0;
  }

  if (sched_last == sched.end()) return false;

  relay_t::iterator i = relay.find(sched_last->first);

  if (i == relay.end()) return false;

  ++sched_last_jobs;

  string rel = i->second;

  return sched_jobs.insert(sched_jobs_t::value_type(jobid, rel)).second;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0xf0(%rbp)
addq $0xc8, %rdi
callq 0x8f170
movq -0xf0(%rbp), %rdi
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x91000
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xe1(%rbp)
jne 0x8dcf3
jmp 0x8dd2b
movq -0xf8(%rbp), %rdi
movq 0x138(%rdi), %rax
movq %rax, -0x100(%rbp)
addq $0x130, %rdi            # imm = 0x130
callq 0x91030
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq 0x20(%rcx), %rax
setge %al
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x8dd37
jmp 0x8dd5c
movq -0xf8(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x91050
movq -0xf8(%rbp), %rax
movq $0x0, 0x138(%rax)
movq -0xf8(%rbp), %rdi
movq %rdi, %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x108(%rbp)
addq $0xc8, %rdi
callq 0x8f170
movq -0x108(%rbp), %rdi
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x91080
testb $0x1, %al
jne 0x8dd99
jmp 0x8ddd0
movq -0xf8(%rbp), %rdi
addq $0xc8, %rdi
callq 0x910b0
movq %rax, %rcx
movq -0xf8(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, 0x130(%rax)
movq $0x0, 0x138(%rax)
movq -0xf8(%rbp), %rdi
movq %rdi, %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x110(%rbp)
addq $0xc8, %rdi
callq 0x8f170
movq -0x110(%rbp), %rdi
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x91080
testb $0x1, %al
jne 0x8de0d
jmp 0x8de16
movb $0x0, -0x1(%rbp)
jmp 0x8df90
movq -0xf8(%rbp), %rdi
movq %rdi, %rax
addq $0x98, %rax
movq %rax, -0x118(%rbp)
addq $0x130, %rdi            # imm = 0x130
callq 0x91030
movq -0x118(%rbp), %rdi
movq %rax, %rsi
callq 0x34e40
movq -0xf8(%rbp), %rdi
movq %rax, -0x48(%rbp)
addq $0x98, %rdi
callq 0x349b0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x34ab0
testb $0x1, %al
jne 0x8de76
jmp 0x8de7f
movb $0x0, -0x1(%rbp)
jmp 0x8df90
movq -0xf8(%rbp), %rax
movq 0x138(%rax), %rcx
incq %rcx
movq %rcx, 0x138(%rax)
leaq -0x48(%rbp), %rdi
callq 0x349e0
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0xc270
movq -0xf8(%rbp), %rax
movq -0x128(%rbp), %rdx
addq $0xf8, %rax
movq %rax, -0x120(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x910e0
jmp 0x8dee4
movq -0x120(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x34e70
movb %dl, -0x131(%rbp)
movq %rax, -0x130(%rbp)
jmp 0x8df06
movb -0x131(%rbp), %al
movq -0x130(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
movb %al, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x80(%rbp)
movb -0xd8(%rbp), %al
movb %al, -0x78(%rbp)
movb -0x78(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x34f10
leaq -0x70(%rbp), %rdi
callq 0xc3e0
jmp 0x8df90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8df85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x34f10
leaq -0x70(%rbp), %rdi
callq 0xc3e0
jmp 0x8df9e
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0xcba0
nopw (%rax,%rax)