// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/job.h
// Function: JobQueue::add_job(JobType, unsigned int, unsigned int)
void add_job(JobType type, sigint from, sigint to)
    {
        std::unique_lock<std::mutex> guard(this->lock);

#ifdef THREAD_USE_JOB_SYNC
        while (this->size >= this->jobs.capacity)
        {
            this->bufferFull.wait(guard);
        }
#endif

        Barrier* barrier = this->barrier;
        Barrier* modifyBarrier = barrier;
        bool allocated = false;

        if (type != JobType::Query || this->barrier->modification)
        {
            Barrier* newBarrier = &BarrierMemory[BarrierIndex++];
            assert(BarrierIndex < BARRIER_BUFFER_COUNT);
            newBarrier->modification = type != JobType::Query;
            newBarrier->waiting = 1;
            modifyBarrier = newBarrier;
            this->barrier = modifyBarrier;
        }
        else if (!this->barrier->modification)
        {
            barrier->push();
        }

        this->jobs[this->end] = Job(type, from, to, barrier, modifyBarrier, allocated);
        this->end = (this->end + 1) % this->jobs.size;

        this->size++;

#ifdef THREAD_USE_JOB_SYNC
        this->bufferEmpty.notify_one();
#endif

        assert(this->size <= this->jobs.capacity);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xb0(%rdi), %rax
leaq 0x8(%rsp), %r12
movq %rdi, %rbx
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rax, (%r12)
movq %r12, %rdi
movb $0x0, 0x8(%r12)
callq 0x4420
movb $0x1, 0x8(%r12)
movq 0x98(%rbx), %rax
cmpq 0xe0(%rbx), %rax
jb 0x34dc
leaq 0x130(%rbx), %r12
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2070
movq 0x98(%rbx), %rax
cmpq 0xe0(%rbx), %rax
jae 0x34c1
movq 0xf0(%rbx), %rax
testl %r15d, %r15d
jne 0x34f1
cmpb $0x1, (%rax)
jne 0x35d2
movq 0x3120d8(%rip), %rdx    # 0x3155d0
leaq 0x1(%rdx), %rcx
movq %rcx, 0x3120cd(%rip)    # 0x3155d0
cmpq $0x30d40, %rcx          # imm = 0x30D40
jae 0x35fd
shlq $0x4, %rdx
leaq 0x4cb5(%rip), %rsi      # 0x81d0
testl %r15d, %r15d
leaq (%rsi,%rdx), %rcx
setne (%rdx,%rsi)
movq $0x1, 0x8(%rdx,%rsi)
movq %rcx, 0xf0(%rbx)
movq 0x31209b(%rip), %rdx    # 0x3155d8
leaq 0x1(%rdx), %rsi
movq %rsi, 0x312090(%rip)    # 0x3155d8
movslq 0xa8(%rbx), %rsi
movq 0xe8(%rbx), %rdi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
movq %rdx, (%rdi,%rsi)
movl %r15d, 0x8(%rdi,%rsi)
movl %r14d, 0xc(%rdi,%rsi)
movl %ebp, 0x10(%rdi,%rsi)
movq %rax, 0x18(%rdi,%rsi)
movq %rcx, 0x20(%rdi,%rsi)
movb $0x0, 0x28(%rdi,%rsi)
xorl %edx, %edx
leaq 0x68(%rbx), %rdi
movq 0xa8(%rbx), %rax
incq %rax
divq 0xd8(%rbx)
movq %rdx, 0xa8(%rbx)
incq 0x98(%rbx)
callq 0x20d0
movq 0x98(%rbx), %rax
cmpq 0xe0(%rbx), %rax
ja 0x35de
leaq 0x8(%rsp), %rdi
callq 0x3452
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq 0x8(%rax)
movq %rax, %rcx
jmp 0x3536
leaq 0x1c87(%rip), %rdi      # 0x526c
leaq 0x1c46(%rip), %rsi      # 0x5232
leaq 0x1c49(%rip), %rcx      # 0x523c
movl $0x7b, %edx
callq 0x2100
leaq 0x1c0a(%rip), %rdi      # 0x520e
leaq 0x1c27(%rip), %rsi      # 0x5232
leaq 0x1c2a(%rip), %rcx      # 0x523c
movl $0x67, %edx
callq 0x2100