// File: lotuskip[P]yuxtapa/server/cmds.cpp
// Function: (anonymous namespace)::pl_level_cmp(std::_List_const_iterator<Player>, std::_List_const_iterator<Player>)
bool pl_level_cmp(const list<Player>::const_iterator i, const list<Player>::const_iterator j)
{
	// Ordering is based on a consideration of kills/deaths & playing time:
	unsigned long resi = 0, resj = 0;
	for(char ch = 0; ch < NO_CLASS; ++ch)
	{
		resi += i->stats_i->time_played[ch];
		resj += j->stats_i->time_played[ch];
	}
	resi /= NO_CLASS; // averages of times played as each class
	resj /= NO_CLASS;
	// only take kill/death ratio into account if have enough deaths:
	if(i->stats_i->deaths >= KILLS_DEATHS_REQ_FOR_COMP)
		resi *= float(total_kills(i->stats_i))/i->stats_i->deaths;
	if(j->stats_i->deaths >= KILLS_DEATHS_REQ_FOR_COMP)
		resj *= float(total_kills(j->stats_i))/j->stats_i->deaths;
	// It might be that resi == resj, although this is very unlikely.
	// In that case, less healing received wins (or arbitrarily j if equal):
	if(resi != resj)
		return (resi > resj);
	return (i->stats_i->healing_recvd > j->stats_i->healing_recvd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movsbl -0x29(%rbp), %eax
cmpl $0xb, %eax
jge 0x5d464
leaq -0x10(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movsbq -0x29(%rbp), %rcx
movq 0xb0(%rax,%rcx,8), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movsbq -0x29(%rbp), %rcx
movq 0xb0(%rax,%rcx,8), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movb -0x29(%rbp), %al
addb $0x1, %al
movb %al, -0x29(%rbp)
jmp 0x5d3f7
movq -0x20(%rbp), %rax
movl $0xb, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movl $0xb, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
cmpq $0x14, 0x30(%rax)
jb 0x5d5dd
leaq -0x10(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x24f40
movq 0x80(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5d7d0
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x48(%rbp)
testq %rax, %rax
movss %xmm0, -0x44(%rbp)
js 0x5d501
movss -0x48(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
movq -0x50(%rbp), %rdi
movss -0x44(%rbp), %xmm0
movss %xmm0, -0x5c(%rbp)
callq 0x24f40
movq %rax, %rdi
subq $-0x80, %rdi
callq 0x1b390
movq 0x30(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x58(%rbp)
testq %rax, %rax
movss %xmm0, -0x54(%rbp)
js 0x5d559
movss -0x58(%rbp), %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x5c(%rbp), %xmm0
movss -0x54(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x64(%rbp)
testq %rax, %rax
movss %xmm0, -0x60(%rbp)
js 0x5d5a5
movss -0x64(%rbp), %xmm0
movss %xmm0, -0x60(%rbp)
movss -0x68(%rbp), %xmm1
movss -0x60(%rbp), %xmm0
mulss %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttss2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movss 0xf156(%rip), %xmm1     # 0x6c720
subss %xmm1, %xmm0
cvttss2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
cmpq $0x14, 0x30(%rax)
jb 0x5d74d
leaq -0x18(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x24f40
movq 0x80(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5d7d0
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x70(%rbp)
testq %rax, %rax
movss %xmm0, -0x6c(%rbp)
js 0x5d656
movss -0x70(%rbp), %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rdi
movss -0x6c(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
callq 0x24f40
movq %rax, %rdi
subq $-0x80, %rdi
callq 0x1b390
movq 0x30(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x80(%rbp)
testq %rax, %rax
movss %xmm0, -0x7c(%rbp)
js 0x5d6b1
movss -0x80(%rbp), %xmm0
movss %xmm0, -0x7c(%rbp)
movss -0x84(%rbp), %xmm0
movss -0x7c(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x90(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x8c(%rbp)
testq %rax, %rax
movss %xmm0, -0x88(%rbp)
js 0x5d70f
movss -0x8c(%rbp), %xmm0
movss %xmm0, -0x88(%rbp)
movss -0x90(%rbp), %xmm1
movss -0x88(%rbp), %xmm0
mulss %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttss2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movss 0xefe6(%rip), %xmm1     # 0x6c720
subss %xmm1, %xmm0
cvttss2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x5d769
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
seta %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x5d7c0
leaq -0x10(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movq 0x98(%rax), %rax
movq %rax, -0x98(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x24f40
movq %rax, %rdi
addq $0x80, %rdi
callq 0x1b390
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq 0x98(%rcx), %rax
seta %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nop