	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_AddWorldSurfaces             ## -- Begin function R_AddWorldSurfaces
	.p2align	4, 0x90
_R_AddWorldSurfaces:                    ## @R_AddWorldSurfaces
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	_r_drawworld@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpl	$0, (%rax)
	je	LBB0_5
## %bb.1:
	movq	_tr@GOTPCREL(%rip), %rbx
	movq	_RDF_NOWORLDMODEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_2
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_2:
	movq	_REFENTITYNUM_WORLD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	movq	_QSORT_REFENTITYNUM_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	movl	%eax, 4(%rbx)
	xorl	%eax, %eax
	callq	_R_MarkLeaves
	movq	32(%rbx), %rax
	movl	(%rax), %edi
	movl	4(%rax), %esi
	callq	_ClearBounds
	movq	16(%rbx), %rcx
	movq	_MAX_DLIGHTS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jbe	LBB0_4
## %bb.3:
	movq	%rax, 16(%rbx)
	movq	%rax, %rcx
LBB0_4:
	movq	$-1, %rdx
                                        ## kill: def $cl killed $cl killed $rcx
	shlq	%cl, %rdx
	movq	24(%rbx), %rax
	movl	(%rax), %edi
	notq	%rdx
	movl	$15, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_R_RecursiveWorldNode           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_r_drawworld,8,3                ## @r_drawworld
	.comm	_tr,40,3                        ## @tr
	.comm	_RDF_NOWORLDMODEL,4,2           ## @RDF_NOWORLDMODEL
	.comm	_REFENTITYNUM_WORLD,4,2         ## @REFENTITYNUM_WORLD
	.comm	_QSORT_REFENTITYNUM_SHIFT,4,2   ## @QSORT_REFENTITYNUM_SHIFT
	.comm	_MAX_DLIGHTS,8,3                ## @MAX_DLIGHTS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_AddWorldSurfaces             ; -- Begin function R_AddWorldSurfaces
	.p2align	2
_R_AddWorldSurfaces:                    ; @R_AddWorldSurfaces
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x8, _r_drawworld@GOTPAGE
Lloh1:
	ldr	x8, [x8, _r_drawworld@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	w8, [x8]
	cbz	w8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x19, _tr@GOTPAGE
Lloh4:
	ldr	x19, [x19, _tr@GOTPAGEOFF]
	ldr	w8, [x19, #8]
Lloh5:
	adrp	x9, _RDF_NOWORLDMODEL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _RDF_NOWORLDMODEL@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
LBB0_2:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_3:
Lloh8:
	adrp	x8, _REFENTITYNUM_WORLD@GOTPAGE
Lloh9:
	ldr	x8, [x8, _REFENTITYNUM_WORLD@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _QSORT_REFENTITYNUM_SHIFT@GOTPAGE
Lloh12:
	ldr	x9, [x9, _QSORT_REFENTITYNUM_SHIFT@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	lsl	w9, w8, w9
	stp	w8, w9, [x19]
	bl	_R_MarkLeaves
	ldr	x8, [x19, #32]
	ldp	w0, w1, [x8]
	bl	_ClearBounds
	ldr	x8, [x19, #16]
Lloh14:
	adrp	x9, _MAX_DLIGHTS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _MAX_DLIGHTS@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ls	LBB0_5
; %bb.4:
	str	x9, [x19, #16]
	mov	x8, x9
LBB0_5:
	ldr	x9, [x19, #24]
	ldr	w0, [x9]
	mov	x9, #-1
	lsl	x8, x9, x8
	mvn	x2, x8
	mov	w1, #15
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_R_RecursiveWorldNode
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_r_drawworld,8,3                ; @r_drawworld
	.comm	_tr,40,3                        ; @tr
	.comm	_RDF_NOWORLDMODEL,4,2           ; @RDF_NOWORLDMODEL
	.comm	_REFENTITYNUM_WORLD,4,2         ; @REFENTITYNUM_WORLD
	.comm	_QSORT_REFENTITYNUM_SHIFT,4,2   ; @QSORT_REFENTITYNUM_SHIFT
	.comm	_MAX_DLIGHTS,8,3                ; @MAX_DLIGHTS
.subsections_via_symbols
