// File: /workspace/github_cpp_makefile_star2_O3/Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::tryToOccupyDesk()
void tryToOccupyDesk() {
        std::sort(this->deskPriority.begin(), this->deskPriority.end(), comparePacketsLamport);
        unsigned int me = this->getSelfIndexFromDeskPriority();
        if(me < this->deskPriority.size() && me < DESK_NUMBER) {
            printf("%u: Got desk, doing Paper work, rank: %d\n",Monitor::getLamport(),this->rank);
            sleep(1);
            this->gettingDesk = false;
            this->removeFromDeskPriority(this->rank);
            this->broadcastMessage(FREE_DESK, BODY);
            this->sendMessage(DONE_PAPERWORK, this->rank);
            printf("%u: Freeing desk, doing Paper work, rank: %d\n",Monitor::getLamport(),this->rank);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r12
movq 0x58(%rdi), %r14
movq 0x60(%rdi), %r15
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
cmpq %r15, %r14
je 0x42b3
movq %r15, %rbx
subq %r14, %rbx
movq %rbx, %rax
sarq $0x3, %rax
imulq %r13, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq 0x313(%rip), %rcx       # 0x4387
movq %r14, %rdi
movq %r15, %rsi
callq 0x3a7b
cmpq $0x281, %rbx            # imm = 0x281
jl 0x41e9
movq %r12, -0x58(%rbp)
leaq 0x28(%r14), %r13
movl $0x28, %r12d
movq %r14, %rdi
leaq (%r14,%r12), %rbx
movl 0x8(%r14,%r12), %eax
cmpl 0x8(%r14), %eax
jae 0x40f0
movq 0x20(%rbx), %rax
movq %rax, -0x30(%rbp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
subq %r12, %rdi
addq $0x50, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x21b0
movaps -0x50(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movq -0x30(%rbp), %rax
movq %rax, 0x20(%r14)
jmp 0x4147
movq (%rbx), %rcx
movups 0x18(%rbx), %xmm0
movups %xmm0, -0x44(%rbp)
movups 0xc(%rbx), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %rbx, %rdx
cmpl 0x8(%rdi), %eax
jae 0x4131
movq %r13, %rsi
leaq -0x28(%rsi), %rdx
movq -0x8(%rsi), %rdi
movq %rdi, 0x20(%rsi)
movups -0x28(%rsi), %xmm0
movups -0x18(%rsi), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
cmpl -0x48(%rsi), %eax
movq %rdx, %rsi
jb 0x410e
movq %rcx, (%rdx)
movl %eax, 0x8(%rdx)
movaps -0x50(%rbp), %xmm0
movups %xmm0, 0xc(%rdx)
movups -0x44(%rbp), %xmm0
movups %xmm0, 0x18(%rdx)
addq $0x28, %r12
addq $0x28, %r13
movq %rbx, %rdi
cmpq $0x280, %r12            # imm = 0x280
jne 0x409d
addq $0x280, %r14            # imm = 0x280
cmpq %r15, %r14
movq -0x58(%rbp), %r12
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
je 0x42b3
movq (%r14), %rax
movl 0x8(%r14), %ecx
movups 0x18(%r14), %xmm0
movups %xmm0, -0x44(%rbp)
movups 0xc(%r14), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r14, %rdx
cmpl -0x20(%r14), %ecx
jae 0x41c5
movq %r14, %rsi
leaq -0x28(%rsi), %rdx
movq -0x8(%rsi), %rdi
movq %rdi, 0x20(%rsi)
movups -0x28(%rsi), %xmm0
movups -0x18(%rsi), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
cmpl -0x48(%rsi), %ecx
movq %rdx, %rsi
jb 0x41a2
movq %rax, (%rdx)
movl %ecx, 0x8(%rdx)
movaps -0x50(%rbp), %xmm0
movups %xmm0, 0xc(%rdx)
movups -0x44(%rbp), %xmm0
movups %xmm0, 0x18(%rdx)
addq $0x28, %r14
cmpq %r15, %r14
jne 0x417d
jmp 0x42b3
leaq 0x28(%r14), %rax
cmpq %r15, %rax
je 0x42b3
movq %r14, %rdi
movq %rax, %rbx
movl 0x8(%rax), %eax
cmpl 0x8(%r14), %eax
jae 0x424c
movq 0x20(%rbx), %rax
movq %rax, -0x30(%rbp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %rbx, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x50, %rdi
movq %r14, %rsi
callq 0x21b0
movaps -0x50(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movq -0x30(%rbp), %rax
movq %rax, 0x20(%r14)
jmp 0x42a3
movq (%rbx), %rcx
movups 0x18(%rbx), %xmm0
movups %xmm0, -0x44(%rbp)
movups 0xc(%rbx), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %rbx, %rdx
cmpl 0x8(%rdi), %eax
jae 0x428d
movq %rbx, %rsi
leaq -0x28(%rsi), %rdx
movq -0x8(%rsi), %rdi
movq %rdi, 0x20(%rsi)
movups -0x28(%rsi), %xmm0
movups -0x18(%rsi), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
cmpl -0x48(%rsi), %eax
movq %rdx, %rsi
jb 0x426a
movq %rcx, (%rdx)
movl %eax, 0x8(%rdx)
movaps -0x50(%rbp), %xmm0
movups %xmm0, 0xc(%rdx)
movups -0x44(%rbp), %xmm0
movups %xmm0, 0x18(%rdx)
leaq 0x28(%rbx), %rax
movq %rbx, %rdi
cmpq %r15, %rax
jne 0x41f9
movq 0x58(%r12), %rcx
movq 0x60(%r12), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %r13, %rax
cmpq %rcx, %rdx
je 0x42e8
movl 0x8(%r12), %esi
xorl %edx, %edx
leaq (%rdx,%rdx,4), %rdi
cmpl 0x10(%rcx,%rdi,8), %esi
je 0x42ea
incl %edx
cmpq %rdx, %rax
ja 0x42d7
movl %eax, %edx
movl %edx, %ecx
cmpq %rcx, %rax
setbe %al
testl %edx, %edx
setne %cl
orb %al, %cl
jne 0x4378
callq 0x58c2
movl 0x8(%r12), %edx
leaq 0x2f37(%rip), %rdi      # 0x7243
movl %eax, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
callq 0x20b0
movb $0x0, 0x25(%r12)
movl 0x8(%r12), %esi
movq %r12, %rdi
callq 0x4396
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
movl $0x7a, %edx
movl $0x2, %ecx
callq 0x5f92
movl 0x8(%r12), %ecx
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
movl $0x76, %edx
callq 0x5d68
callq 0x58c2
movl 0x8(%r12), %edx
leaq 0x2efe(%rip), %rdi      # 0x726d
movl %eax, %esi
xorl %eax, %eax
callq 0x2030
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq