// File: /workspace/github_cpp_makefile_star2_O1/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 0x43c5
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 0x342(%rip), %rcx       # 0x44c8
movq %r14, %rdi
movq %r15, %rsi
callq 0x3b6b
cmpq $0x281, %rbx            # imm = 0x281
jl 0x42fb
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 0x4202
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 0x4259
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 0x4243
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 0x4220
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 0x41af
addq $0x280, %r14            # imm = 0x280
cmpq %r15, %r14
movq -0x58(%rbp), %r12
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
je 0x43c5
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 0x42d7
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 0x42b4
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 0x428f
jmp 0x43c5
leaq 0x28(%r14), %rax
cmpq %r15, %rax
je 0x43c5
movq %r14, %rdi
movq %rax, %rbx
movl 0x8(%rax), %eax
cmpl 0x8(%r14), %eax
jae 0x435e
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 0x43b5
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 0x439f
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 0x437c
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 0x430b
movq 0x58(%r12), %rcx
movq 0x60(%r12), %rsi
movq %rsi, %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %r13, %rax
xorl %edx, %edx
cmpq %rcx, %rsi
setne %sil
je 0x4419
movl 0x8(%r12), %edi
movb $0x1, %sil
cmpl 0x10(%rcx), %edi
je 0x4419
movl $0x1, %r8d
movl %r8d, %edx
movl %r8d, %r8d
cmpq %r8, %rax
seta %sil
jbe 0x4419
leaq (%r8,%r8,4), %r9
leal 0x1(%rdx), %r8d
cmpl 0x10(%rcx,%r9,8), %edi
jne 0x43fb
testb %sil, %sil
cmovnel %edx, %eax
testl %eax, %eax
jne 0x44b9
movq 0x60(%r12), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %rax, %rdx
jbe 0x44b9
callq 0x5b08
movl 0x8(%r12), %edx
leaq 0x2df6(%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 0x44d8
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
movl $0x7a, %edx
movl $0x2, %ecx
callq 0x61ca
movl 0x8(%r12), %ecx
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
movl $0x76, %edx
callq 0x5fa0
callq 0x5b08
movl 0x8(%r12), %edx
leaq 0x2dbd(%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