	.file	"extr_g_main.c_CalculateRanks.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
	.text
	.p2align 4
	.globl	CalculateRanks
	.type	CalculateRanks, @function
CalculateRanks:
.LFB0:
	.cfi_startproc
	endbr64
	mov	eax, DWORD PTR TEAM_NUM_TEAMS[rip]
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	QWORD PTR level[rip+72], 0
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	QWORD PTR level[rip], -1
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	QWORD PTR level[rip+8], 0
	mov	DWORD PTR level[rip+16], 0
	mov	QWORD PTR level[rip+64], 0
	test	eax, eax
	jle	.L28
	mov	rdx, QWORD PTR level[rip+56]
	lea	ecx, -1[rax]
	lea	rax, 8[rdx]
	lea	rcx, [rax+rcx*8]
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L43:
	add	rax, 8
.L3:
	mov	QWORD PTR [rdx], 0
	mov	rdx, rax
	cmp	rcx, rax
	jne	.L43
	mov	rsi, QWORD PTR level[rip+8]
.L2:
	mov	edi, DWORD PTR level[rip+20]
	mov	r9, QWORD PTR level[rip+24]
	test	edi, edi
	jle	.L4
	mov	rax, QWORD PTR level[rip+48]
	mov	r10, QWORD PTR g_entities[rip]
	mov	r11, QWORD PTR level[rip+56]
	lea	rdx, 8[rax]
	xor	eax, eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L5:
	add	rax, 1
	add	rdx, 24
	cmp	DWORD PTR level[rip+20], eax
	jle	.L4
.L9:
	mov	rcx, QWORD PTR 8[rdx]
	cmp	rcx, QWORD PTR CON_DISCONNECTED[rip]
	mov	r8d, eax
	je	.L5
	mov	DWORD PTR [r9+rsi*4], eax
	add	rsi, 1
	mov	QWORD PTR level[rip+8], rsi
	mov	rdi, QWORD PTR [rdx]
	cmp	rdi, QWORD PTR TEAM_SPECTATOR[rip]
	je	.L5
	add	QWORD PTR level[rip+72], 1
	cmp	rcx, QWORD PTR CON_CONNECTED[rip]
	jne	.L5
	add	DWORD PTR level[rip+16], 1
	mov	ecx, DWORD PTR [r10+rax*4]
	test	DWORD PTR SVF_BOT[rip], ecx
	jne	.L6
	add	QWORD PTR level[rip+64], 1
	cmp	rdi, QWORD PTR TEAM_RED[rip]
	je	.L44
	cmp	rdi, QWORD PTR TEAM_BLUE[rip]
	je	.L45
.L6:
	cmp	DWORD PTR level[rip], -1
	je	.L46
.L8:
	cmp	DWORD PTR level[rip+4], -1
	jne	.L5
	add	rax, 1
	add	rdx, 24
	cmp	DWORD PTR level[rip+20], eax
	mov	DWORD PTR level[rip+4], r8d
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	mov	ecx, DWORD PTR SortRanks[rip]
	mov	edx, 4
	mov	rdi, r9
	call	qsort@PLT
	mov	rbx, QWORD PTR g_gametype[rip]
	cmp	rbx, QWORD PTR GT_TEAM[rip]
	jge	.L10
	mov	esi, DWORD PTR level[rip+16]
	test	esi, esi
	jle	.L12
	mov	rax, QWORD PTR PERS_SCORE[rip]
	mov	rdi, QWORD PTR level[rip+48]
	xor	ecx, ecx
	mov	r11d, -1
	mov	rsi, QWORD PTR level[rip+24]
	mov	r12, QWORD PTR GT_SINGLE_PLAYER[rip]
	lea	rbp, 0[0+rax*4]
	mov	rax, QWORD PTR PERS_RANK[rip]
	lea	r9, 0[0+rax*4]
	xor	eax, eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L21:
	add	rax, 1
	cmp	edx, eax
	jle	.L12
.L22:
	movsx	rdx, DWORD PTR [rsi+rax*4]
	mov	r10d, ecx
	mov	r8d, eax
	lea	rdx, [rdx+rdx*2]
	mov	rdx, QWORD PTR [rdi+rdx*8]
	mov	ecx, DWORD PTR [rdx+rbp]
	test	eax, eax
	je	.L29
	cmp	ecx, r10d
	jne	.L29
	movsx	rdx, DWORD PTR -4[rsi+rax*4]
	mov	r8d, DWORD PTR RANK_TIED_FLAG[rip]
	lea	rdx, [rdx+rdx*2]
	or	r8d, r11d
	mov	rdx, QWORD PTR [rdi+rdx*8]
	mov	DWORD PTR [rdx+r9], r8d
	movsx	rdx, DWORD PTR [rsi+rax*4]
	mov	r8d, DWORD PTR RANK_TIED_FLAG[rip]
	lea	rdx, [rdx+rdx*2]
	mov	rdx, QWORD PTR [rdi+rdx*8]
	or	r8d, r11d
	mov	DWORD PTR [rdx+r9], r8d
.L20:
	mov	edx, DWORD PTR level[rip+16]
	cmp	rbx, r12
	jne	.L21
	cmp	edx, 1
	jne	.L21
	movsx	rdx, DWORD PTR [rsi+rax*4]
	mov	r8d, DWORD PTR RANK_TIED_FLAG[rip]
	add	rax, 1
	lea	rdx, [rdx+rdx*2]
	or	r8d, r11d
	mov	rdx, QWORD PTR [rdi+rdx*8]
	mov	DWORD PTR [rdx+r9], r8d
	mov	edx, DWORD PTR level[rip+16]
	cmp	edx, eax
	jg	.L22
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rdx, QWORD PTR level[rip+8]
	test	rdx, rdx
	je	.L47
	mov	rax, QWORD PTR level[rip+24]
	mov	rcx, QWORD PTR level[rip+48]
	lea	rdi, .LC0[rip]
	movsx	rax, DWORD PTR [rax]
	lea	rax, [rax+rax*2]
	lea	rax, [rcx+rax*8]
	mov	rcx, QWORD PTR PERS_SCORE[rip]
	mov	rax, QWORD PTR [rax]
	movsx	rsi, DWORD PTR [rax+rcx*4]
	cmp	rdx, 1
	je	.L41
	call	va@PLT
	mov	edi, DWORD PTR CS_SCORES1[rip]
	mov	esi, eax
	call	trap_SetConfigstring@PLT
	mov	rax, QWORD PTR level[rip+24]
	mov	rdx, QWORD PTR level[rip+48]
	movsx	rax, DWORD PTR 4[rax]
	lea	rax, [rax+rax*2]
	lea	rax, [rdx+rax*8]
	mov	rdx, QWORD PTR PERS_SCORE[rip]
	mov	rax, QWORD PTR [rax]
	movsx	rsi, DWORD PTR [rax+rdx*4]
.L40:
	lea	rdi, .LC0[rip]
	call	va@PLT
	mov	edi, DWORD PTR CS_SCORES2[rip]
	mov	esi, eax
	call	trap_SetConfigstring@PLT
	xor	eax, eax
	call	CheckExitRules@PLT
	cmp	QWORD PTR level[rip+40], 0
	jne	.L48
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	mov	rax, QWORD PTR level[rip+32]
	mov	rcx, QWORD PTR TEAM_RED[rip]
	mov	rdx, QWORD PTR level[rip+8]
	mov	rsi, QWORD PTR [rax+rcx*8]
	test	rdx, rdx
	je	.L13
	mov	rcx, QWORD PTR TEAM_BLUE[rip]
	mov	r11, QWORD PTR level[rip+48]
	mov	rcx, QWORD PTR [rax+rcx*8]
	mov	rax, QWORD PTR PERS_RANK[rip]
	lea	r9, 0[0+rax*4]
	mov	rax, QWORD PTR level[rip+24]
	lea	r10, [rax+rdx*4]
	.p2align 4,,10
	.p2align 3
.L17:
	movsx	rdx, DWORD PTR [rax]
	xor	r8d, r8d
	lea	rdx, [rdx+rdx*2]
	mov	rdi, QWORD PTR [r11+rdx*8]
	mov	edx, 2
	add	rdi, r9
	cmp	rcx, rsi
	setge	r8b
	cmovne	edx, r8d
	add	rax, 4
	mov	DWORD PTR [rdi], edx
	cmp	r10, rax
	jne	.L17
.L13:
	lea	rdi, .LC0[rip]
	call	va@PLT
	mov	edi, DWORD PTR CS_SCORES1[rip]
	mov	esi, eax
	call	trap_SetConfigstring@PLT
	mov	rdx, QWORD PTR TEAM_BLUE[rip]
	mov	rax, QWORD PTR level[rip+32]
	mov	rsi, QWORD PTR [rax+rdx*8]
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L47:
	mov	rsi, QWORD PTR SCORE_NOT_PRESENT[rip]
	lea	rdi, .LC0[rip]
.L41:
	call	va@PLT
	mov	edi, DWORD PTR CS_SCORES1[rip]
	mov	esi, eax
	call	trap_SetConfigstring@PLT
	mov	rsi, QWORD PTR SCORE_NOT_PRESENT[rip]
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L44:
	add	QWORD PTR [r11], 1
	cmp	DWORD PTR level[rip], -1
	mov	rsi, QWORD PTR level[rip+8]
	jne	.L8
	.p2align 4,,10
	.p2align 3
.L46:
	mov	DWORD PTR level[rip], r8d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L29:
	mov	DWORD PTR [rdx+r9], r8d
	mov	r11d, r8d
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L48:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xor	eax, eax
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	jmp	SendScoreboardMessageToAllClients@PLT
	.p2align 4,,10
	.p2align 3
.L45:
	.cfi_restore_state
	add	QWORD PTR 8[r11], 1
	mov	rsi, QWORD PTR level[rip+8]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L28:
	xor	esi, esi
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	CalculateRanks, .-CalculateRanks
	.comm	level,80,32
	.comm	g_gametype,8,8
	.comm	g_entities,8,8
	.comm	TEAM_SPECTATOR,8,8
	.comm	TEAM_RED,8,8
	.comm	TEAM_NUM_TEAMS,4,4
	.comm	TEAM_BLUE,8,8
	.comm	SortRanks,4,4
	.comm	SVF_BOT,4,4
	.comm	SCORE_NOT_PRESENT,8,8
	.comm	RANK_TIED_FLAG,4,4
	.comm	PERS_SCORE,8,8
	.comm	PERS_RANK,8,8
	.comm	GT_TEAM,8,8
	.comm	GT_SINGLE_PLAYER,8,8
	.comm	CS_SCORES2,4,4
	.comm	CS_SCORES1,4,4
	.comm	CON_DISCONNECTED,8,8
	.comm	CON_CONNECTED,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_g_main.c_CalculateRanks.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"%i\000"
	.text
	.align	2
	.global	CalculateRanks
	.syntax unified
	.arm
	.fpu softvfp
	.type	CalculateRanks, %function
CalculateRanks:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	r1, #0
	mvn	r3, #0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r2, .L45
	ldr	r4, .L45+4
	ldr	r2, [r2]
	sub	sp, sp, #12
	cmp	r2, r1
	str	r3, [r4]
	str	r3, [r4, #4]
	str	r1, [r4, #8]
	str	r1, [r4, #44]
	str	r1, [r4, #12]
	str	r1, [r4, #40]
	ble	.L2
	ldr	r3, [r4, #36]
	sub	r3, r3, #4
	add	r2, r3, r2, lsl #2
.L3:
	str	r1, [r3, #4]!
	cmp	r2, r3
	bne	.L3
	ldr	r1, [r4, #8]
.L2:
	ldr	r3, [r4, #16]
	ldr	r0, [r4, #20]
	cmp	r3, #0
	ble	.L4
	ldr	r2, .L45+8
	ldr	ip, [r4, #36]
	ldr	r10, [r2]
	mov	r3, #0
	ldr	r2, [r4, #32]
	ldr	r6, .L45+12
	ldr	r7, .L45+16
	ldr	r8, .L45+20
	ldr	r9, .L45+24
	str	ip, [sp, #4]
	b	.L9
.L5:
	ldr	ip, [r4, #16]
	add	r3, r3, #1
	cmp	ip, r3
	add	r2, r2, #12
	ble	.L4
.L9:
	ldr	ip, [r2, #8]
	ldr	lr, [r6]
	cmp	ip, lr
	beq	.L5
	str	r3, [r0, r1, lsl #2]
	add	r1, r1, #1
	str	r1, [r4, #8]
	ldr	r5, [r2, #4]
	ldr	lr, [r7]
	cmp	r5, lr
	beq	.L5
	ldr	lr, [r4, #44]
	ldr	fp, [r8]
	add	lr, lr, #1
	cmp	ip, fp
	str	lr, [r4, #44]
	bne	.L5
	ldr	ip, [r4, #12]
	ldr	lr, [r9]
	add	ip, ip, #1
	str	ip, [r4, #12]
	ldr	ip, [r10, r3, lsl #2]
	tst	ip, lr
	bne	.L6
	ldr	lr, .L45+28
	ldr	ip, [r4, #40]
	ldr	lr, [lr]
	add	ip, ip, #1
	cmp	r5, lr
	str	ip, [r4, #40]
	beq	.L41
	ldr	ip, .L45+32
	ldr	ip, [ip]
	cmp	r5, ip
	ldreq	ip, [sp, #4]
	ldreq	r1, [ip, #4]
	addeq	r1, r1, #1
	streq	r1, [ip, #4]
	ldreq	r1, [r4, #8]
.L6:
	ldr	ip, [r4]
	cmn	ip, #1
	streq	r3, [r4]
	beq	.L5
	ldr	ip, [r4, #4]
	cmn	ip, #1
	streq	r3, [r4, #4]
	b	.L5
.L4:
	ldr	r3, .L45+36
	mov	r2, #4
	ldr	r3, [r3]
	bl	qsort
	ldr	r2, .L45+40
	ldr	r3, .L45+44
	ldr	r7, [r2]
	ldr	r3, [r3]
	cmp	r7, r3
	bge	.L10
	ldr	r3, [r4, #12]
	cmp	r3, #0
	ble	.L12
	mov	r0, #0
	ldr	r1, .L45+48
	ldr	ip, .L45+52
	ldr	r5, [r1]
	ldr	r3, .L45+56
	ldr	r8, [ip]
	ldr	r1, [r4, #20]
	mvn	r6, #0
	mov	r2, r0
	ldr	r10, [r3]
	ldr	lr, [r4, #32]
	ldr	r9, .L45+60
	lsl	r8, r8, #2
	lsl	r5, r5, #2
	sub	r1, r1, #4
	b	.L21
.L20:
	cmp	r2, r3
	bge	.L12
.L21:
	mov	r3, r0
	ldr	r0, [r1, #4]!
	add	r0, r0, r0, lsl #1
	ldr	ip, [lr, r0, lsl #2]
	ldr	r0, [ip, r8]
	subs	r3, r0, r3
	movne	r3, #1
	cmp	r2, #0
	moveq	r3, #1
	cmp	r3, #0
	movne	r6, r2
	strne	r2, [ip, r5]
	bne	.L19
	ldr	r3, [r1, #-4]
	ldr	ip, [r9]
	add	r3, r3, r3, lsl #1
	ldr	fp, [lr, r3, lsl #2]
	orr	r3, ip, r6
	str	r3, [fp, r5]
	ldr	r3, [r1]
	ldr	ip, [r9]
	add	r3, r3, r3, lsl #1
	ldr	fp, [lr, r3, lsl #2]
	orr	r3, ip, r6
	str	r3, [fp, r5]
.L19:
	cmp	r7, r10
	ldr	r3, [r4, #12]
	add	r2, r2, #1
	bne	.L20
	cmp	r3, #1
	bne	.L20
	ldr	r3, [r1]
	ldr	ip, [r9]
	add	r3, r3, r3, lsl #1
	ldr	fp, [lr, r3, lsl #2]
	orr	r3, ip, r6
	str	r3, [fp, r5]
	ldr	r3, [r4, #12]
	cmp	r2, r3
	blt	.L21
.L12:
	ldr	r2, [r4, #8]
	ldr	r3, .L45+64
	cmp	r2, #0
	ldr	r5, [r3]
	beq	.L42
	ldr	r3, [r4, #20]
	ldr	r1, [r4, #32]
	ldr	r3, [r3]
	ldr	r6, .L45+52
	add	r3, r3, r3, lsl #1
	ldr	r3, [r1, r3, lsl #2]
	ldr	r1, [r6]
	cmp	r2, #1
	ldr	r0, .L45+68
	ldr	r1, [r3, r1, lsl #2]
	beq	.L43
	bl	va
	mov	r1, r0
	mov	r0, r5
	bl	trap_SetConfigstring
	ldr	r3, [r4, #20]
	ldr	r2, [r4, #32]
	ldr	r3, [r3, #4]
	ldr	r1, [r6]
	add	r3, r3, r3, lsl #1
	ldr	r2, [r2, r3, lsl #2]
.L38:
	ldr	r3, .L45+72
	ldr	r1, [r2, r1, lsl #2]
.L39:
	ldr	r5, [r3]
.L37:
	ldr	r0, .L45+68
	bl	va
	mov	r1, r0
	mov	r0, r5
	bl	trap_SetConfigstring
	bl	CheckExitRules
	ldr	r3, [r4, #28]
	cmp	r3, #0
	bne	.L44
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L10:
	ldr	r3, .L45+28
	ldr	r0, [r4, #8]
	ldr	r2, [r3]
	ldr	r3, [r4, #24]
	cmp	r0, #0
	ldr	r1, [r3, r2, lsl #2]
	ldreq	r5, .L45+32
	beq	.L13
	mov	r7, #2
	mov	r9, #1
	mov	r8, #0
	ldr	r5, .L45+32
	ldr	ip, .L45+48
	ldr	lr, [r5]
	ldr	r2, [r4, #20]
	ldr	ip, [ip]
	add	r0, r2, r0, lsl r7
	ldr	r6, [r3, lr, lsl #2]
	ldr	lr, [r4, #32]
	lsl	ip, ip, r7
	sub	r0, r0, #4
	sub	r2, r2, #4
.L17:
	ldr	r3, [r2, #4]!
	cmp	r6, r1
	add	r3, r3, r3, lsl #1
	ldr	r3, [lr, r3, lsl #2]
	streq	r7, [r3, ip]
	beq	.L15
	strlt	r8, [r3, ip]
	strge	r9, [r3, ip]
.L15:
	cmp	r0, r2
	bne	.L17
.L13:
	ldr	r3, .L45+64
	ldr	r0, .L45+68
	ldr	r6, [r3]
	bl	va
	mov	r1, r0
	mov	r0, r6
	bl	trap_SetConfigstring
	ldr	r1, [r5]
	ldr	r2, [r4, #24]
	b	.L38
.L42:
	ldr	r6, .L45+76
	ldr	r0, .L45+68
	ldr	r1, [r6]
	bl	va
	mov	r1, r0
	mov	r0, r5
	bl	trap_SetConfigstring
	ldr	r3, .L45+72
	ldr	r1, [r6]
	b	.L39
.L41:
	ldr	ip, [sp, #4]
	ldr	r1, [ip]
	add	r1, r1, #1
	str	r1, [ip]
	ldr	r1, [r4, #8]
	b	.L6
.L44:
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	SendScoreboardMessageToAllClients
.L43:
	bl	va
	mov	r1, r0
	mov	r0, r5
	bl	trap_SetConfigstring
	ldr	r2, .L45+72
	ldr	r3, .L45+76
	ldr	r5, [r2]
	ldr	r1, [r3]
	b	.L37
.L46:
	.align	2
.L45:
	.word	TEAM_NUM_TEAMS
	.word	level
	.word	g_entities
	.word	CON_DISCONNECTED
	.word	TEAM_SPECTATOR
	.word	CON_CONNECTED
	.word	SVF_BOT
	.word	TEAM_RED
	.word	TEAM_BLUE
	.word	SortRanks
	.word	g_gametype
	.word	GT_TEAM
	.word	PERS_RANK
	.word	PERS_SCORE
	.word	GT_SINGLE_PLAYER
	.word	RANK_TIED_FLAG
	.word	CS_SCORES1
	.word	.LC0
	.word	CS_SCORES2
	.word	SCORE_NOT_PRESENT
	.size	CalculateRanks, .-CalculateRanks
	.comm	level,48,4
	.comm	g_gametype,4,4
	.comm	g_entities,4,4
	.comm	TEAM_SPECTATOR,4,4
	.comm	TEAM_RED,4,4
	.comm	TEAM_NUM_TEAMS,4,4
	.comm	TEAM_BLUE,4,4
	.comm	SortRanks,4,4
	.comm	SVF_BOT,4,4
	.comm	SCORE_NOT_PRESENT,4,4
	.comm	RANK_TIED_FLAG,4,4
	.comm	PERS_SCORE,4,4
	.comm	PERS_RANK,4,4
	.comm	GT_TEAM,4,4
	.comm	GT_SINGLE_PLAYER,4,4
	.comm	CS_SCORES2,4,4
	.comm	CS_SCORES1,4,4
	.comm	CON_DISCONNECTED,4,4
	.comm	CON_CONNECTED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
