	.file	"extr_tr_world.c_R_AddWorldSurfaces.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	R_AddWorldSurfaces
	.type	R_AddWorldSurfaces, @function
R_AddWorldSurfaces:
.LFB0:
	.cfi_startproc
	endbr64
	mov	rax, QWORD PTR r_drawworld[rip]
	mov	ecx, DWORD PTR [rax]
	test	ecx, ecx
	je	.L17
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	edx, DWORD PTR tr[rip+16]
	and	edx, DWORD PTR RDF_NOWORLDMODEL[rip]
	mov	r12d, edx
	jne	.L1
	mov	eax, DWORD PTR REFENTITYNUM_WORLD[rip]
	mov	ecx, DWORD PTR QSORT_REFENTITYNUM_SHIFT[rip]
	mov	DWORD PTR tr[rip], eax
	sal	eax, cl
	mov	DWORD PTR tr[rip+4], eax
	mov	eax, DWORD PTR tr[rip+56]
	test	DWORD PTR VPF_DEPTHSHADOW[rip], eax
	je	.L21
.L3:
	mov	rax, QWORD PTR tr[rip+64]
	mov	esi, DWORD PTR 4[rax]
	mov	edi, DWORD PTR [rax]
	call	ClearBounds@PLT
	mov	rax, QWORD PTR MAX_DLIGHTS[rip]
	cmp	QWORD PTR tr[rip+24], rax
	jbe	.L4
	mov	QWORD PTR tr[rip+24], rax
.L4:
	mov	rax, QWORD PTR MAX_DRAWN_PSHADOWS[rip]
	cmp	QWORD PTR tr[rip+32], rax
	jbe	.L5
	mov	QWORD PTR tr[rip+32], rax
.L5:
	mov	eax, DWORD PTR tr[rip+56]
	mov	edx, DWORD PTR VPF_FARPLANEFRUSTUM[rip]
	and	edx, eax
	mov	r8d, eax
	cmp	edx, 1
	sbb	esi, esi
	and	esi, -16
	add	esi, 31
	and	r8d, DWORD PTR VPF_DEPTHSHADOW[rip]
	jne	.L13
	mov	rcx, QWORD PTR tr[rip+24]
	mov	edi, 1
	mov	rdx, rdi
	sal	rdx, cl
	lea	r12d, -1[rdx]
	test	DWORD PTR VPF_SHADOWMAP[rip], eax
	je	.L22
.L7:
	mov	rax, QWORD PTR tr[rip+48]
	mov	edx, r12d
	mov	ecx, r8d
	mov	edi, DWORD PTR 40[rax]
	call	R_RecursiveWorldNode@PLT
	mov	rax, QWORD PTR tr[rip+48]
	mov	DWORD PTR tr[rip+40], 0
	mov	edx, DWORD PTR [rax]
	test	edx, edx
	jle	.L14
	xor	ebx, ebx
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rdx, QWORD PTR 8[rax]
	mov	rcx, QWORD PTR tr[rip+8]
	cmp	QWORD PTR [rdx+rbx*8], rcx
	jne	.L10
	mov	rdx, QWORD PTR 24[rax]
	mov	rcx, QWORD PTR 16[rax]
	mov	rdi, QWORD PTR 32[rax]
	mov	edx, DWORD PTR [rdx+rbx*4]
	mov	esi, DWORD PTR [rcx+rbx*4]
	add	rdi, rbx
	call	R_AddWorldSurface@PLT
	mov	rax, QWORD PTR tr[rip+48]
	mov	rdx, QWORD PTR 16[rax]
	mov	edx, DWORD PTR [rdx+rbx*4]
	or	DWORD PTR tr[rip+40], edx
.L10:
	add	rbx, 1
	cmp	DWORD PTR [rax], ebx
	jg	.L11
	mov	eax, DWORD PTR tr[rip+40]
	not	eax
.L8:
	mov	DWORD PTR tr[rip+40], eax
.L1:
	add	rsp, 8
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore 3
	.cfi_restore 12
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -24
	.cfi_offset 12, -16
	xor	r8d, r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L22:
	mov	rcx, QWORD PTR tr[rip+32]
	sal	rdi, cl
	lea	r8d, -1[rdi]
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L21:
	xor	eax, eax
	call	R_MarkLeaves@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L14:
	mov	eax, -1
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	R_AddWorldSurfaces, .-R_AddWorldSurfaces
	.comm	tr,72,32
	.comm	r_drawworld,8,8
	.comm	VPF_SHADOWMAP,4,4
	.comm	VPF_FARPLANEFRUSTUM,4,4
	.comm	VPF_DEPTHSHADOW,4,4
	.comm	REFENTITYNUM_WORLD,4,4
	.comm	RDF_NOWORLDMODEL,4,4
	.comm	QSORT_REFENTITYNUM_SHIFT,4,4
	.comm	MAX_DRAWN_PSHADOWS,8,8
	.comm	MAX_DLIGHTS,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_tr_world.c_R_AddWorldSurfaces.c"
	.text
	.align	2
	.global	R_AddWorldSurfaces
	.syntax unified
	.arm
	.fpu softvfp
	.type	R_AddWorldSurfaces, %function
R_AddWorldSurfaces:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r3, .L27
	ldr	r3, [r3]
	ldr	r3, [r3]
	cmp	r3, #0
	bxeq	lr
	push	{r4, r5, r6, lr}
	ldr	r3, .L27+4
	ldr	r5, .L27+8
	ldr	r3, [r3]
	ldr	r4, [r5, #16]
	ands	r4, r4, r3
	popne	{r4, r5, r6, pc}
	ldr	r2, .L27+12
	ldr	r3, .L27+16
	ldr	r6, .L27+20
	ldr	r2, [r2]
	ldr	r3, [r3]
	ldr	r1, [r6]
	ldr	r0, [r5, #52]
	lsl	r3, r2, r3
	tst	r0, r1
	stm	r5, {r2, r3}
	beq	.L24
.L3:
	ldr	r3, [r5, #56]
	ldm	r3, {r0, r1}
	bl	ClearBounds
	add	r3, r5, #24
	ldmia	r3, {r2-r3}
	ldr	r1, .L27+24
	ldmia	r1, {r0-r1}
	cmp	r3, r1
	cmpeq	r2, r0
	strhi	r0, [r5, #24]
	strhi	r1, [r5, #28]
.L4:
	add	r3, r5, #32
	ldmia	r3, {r2-r3}
	ldr	r1, .L27+28
	ldmia	r1, {r0-r1}
	cmp	r3, r1
	cmpeq	r2, r0
	strhi	r0, [r5, #32]
	strhi	r1, [r5, #36]
.L5:
	ldr	r3, .L27+32
	ldr	r0, [r5, #52]
	ldr	r2, [r3]
	ldr	r3, [r6]
	tst	r0, r2
	movne	r1, #31
	moveq	r1, #15
	ands	r3, r0, r3
	movne	r3, #0
	movne	r2, r3
	bne	.L7
	mov	ip, #1
	ldr	lr, .L27+36
	ldr	r2, [r5, #24]
	ldr	lr, [lr]
	lsl	r2, ip, r2
	tst	r0, lr
	ldreq	r3, [r5, #32]
	sub	r2, r2, #1
	lsleq	r3, ip, r3
	subeq	r3, r3, #1
.L7:
	ldr	r0, [r5, #48]
	ldr	r0, [r0, #20]
	bl	R_RecursiveWorldNode
	mov	r2, #0
	ldr	r3, [r5, #48]
	str	r2, [r5, #40]
	ldr	r2, [r3]
	cmp	r2, #0
	bgt	.L11
	b	.L14
.L26:
	ldr	r3, [r5, #48]
	add	r4, r4, #1
	ldr	r2, [r3]
	cmp	r2, r4
	ble	.L25
.L11:
	ldr	r1, [r3, #4]
	ldr	r2, [r5, #8]
	ldr	r1, [r1, r4, lsl #2]
	cmp	r1, r2
	bne	.L26
	ldr	r2, [r3, #12]
	ldr	r1, [r3, #8]
	ldr	r0, [r3, #16]
	ldr	r2, [r2, r4, lsl #2]
	ldr	r1, [r1, r4, lsl #2]
	add	r0, r4, r0
	bl	R_AddWorldSurface
	ldr	r3, [r5, #48]
	ldr	r1, [r5, #40]
	ldr	r2, [r3, #8]
	ldr	r2, [r2, r4, lsl #2]
	add	r4, r4, #1
	orr	r2, r2, r1
	str	r2, [r5, #40]
	ldr	r2, [r3]
	cmp	r2, r4
	bgt	.L11
.L25:
	ldr	r3, [r5, #40]
	mvn	r3, r3
.L8:
	str	r3, [r5, #40]
	pop	{r4, r5, r6, pc}
.L24:
	bl	R_MarkLeaves
	b	.L3
.L14:
	mvn	r3, #0
	b	.L8
.L28:
	.align	2
.L27:
	.word	r_drawworld
	.word	RDF_NOWORLDMODEL
	.word	tr
	.word	REFENTITYNUM_WORLD
	.word	QSORT_REFENTITYNUM_SHIFT
	.word	VPF_DEPTHSHADOW
	.word	MAX_DLIGHTS
	.word	MAX_DRAWN_PSHADOWS
	.word	VPF_FARPLANEFRUSTUM
	.word	VPF_SHADOWMAP
	.size	R_AddWorldSurfaces, .-R_AddWorldSurfaces
	.comm	tr,64,8
	.comm	r_drawworld,4,4
	.comm	VPF_SHADOWMAP,4,4
	.comm	VPF_FARPLANEFRUSTUM,4,4
	.comm	VPF_DEPTHSHADOW,4,4
	.comm	REFENTITYNUM_WORLD,4,4
	.comm	RDF_NOWORLDMODEL,4,4
	.comm	QSORT_REFENTITYNUM_SHIFT,4,4
	.comm	MAX_DRAWN_PSHADOWS,8,8
	.comm	MAX_DLIGHTS,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
