	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_SortDrawSurfs                ## -- Begin function R_SortDrawSurfs
	.p2align	4, 0x90
_R_SortDrawSurfs:                       ## @R_SortDrawSurfs
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	testl	%esi, %esi
	jle	LBB0_11
## %bb.1:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_R_RadixSort
	movq	_tr@GOTPCREL(%rip), %rax
	movq	_VPF_SHADOWMAP@GOTPCREL(%rip), %rcx
	movq	_VPF_DEPTHSHADOW@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%edx, (%rax)
	je	LBB0_2
LBB0_11:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_R_AddDrawSurfCmd               ## TAILCALL
LBB0_2:
	movl	%r14d, %r15d
	shlq	$2, %r15
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r12), %edi
	leaq	-44(%rbp), %rsi
	leaq	-56(%rbp), %rdx
	leaq	-68(%rbp), %rcx
	leaq	-64(%rbp), %r8
	leaq	-60(%rbp), %r9
	callq	_R_DecomposeSort
	movq	-56(%rbp), %rax
	movq	(%rax), %rcx
	movq	_SS_PORTAL@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jg	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	(%rbx,%r12), %r13
	movq	_SS_BAD@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	_ERR_DROP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movl	8(%rax), %edx
	leaq	L_.str(%rip), %rsi
	movq	_ri@GOTPCREL(%rip), %rax
	callq	*(%rax)
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	-44(%rbp), %esi
	movq	%r13, %rdi
	callq	_R_MirrorViewBySurface
	testq	%rax, %rax
	jne	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_4 Depth=1
	addq	$4, %r12
	cmpq	%r12, %r15
	jne	LBB0_4
	jmp	LBB0_9
LBB0_8:
	movq	_r_portalOnly@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	jne	LBB0_10
LBB0_9:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_R_AddDrawSurfCmd
LBB0_10:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_tr,4,2                         ## @tr
	.comm	_VPF_SHADOWMAP,4,2              ## @VPF_SHADOWMAP
	.comm	_VPF_DEPTHSHADOW,4,2            ## @VPF_DEPTHSHADOW
	.comm	_SS_PORTAL,8,3                  ## @SS_PORTAL
	.comm	_SS_BAD,8,3                     ## @SS_BAD
	.comm	_ri,8,3                         ## @ri
	.comm	_ERR_DROP,4,2                   ## @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Shader '%s'with sort == SS_BAD"

	.comm	_r_portalOnly,8,3               ## @r_portalOnly
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_SortDrawSurfs                ; -- Begin function R_SortDrawSurfs
	.p2align	2
_R_SortDrawSurfs:                       ; @R_SortDrawSurfs
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
	cmp	w1, #0
	b.le	LBB0_2
; %bb.1:
	mov	x0, x20
	mov	x1, x19
	bl	_R_RadixSort
Lloh0:
	adrp	x8, _tr@GOTPAGE
Lloh1:
	ldr	x8, [x8, _tr@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _VPF_SHADOWMAP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _VPF_SHADOWMAP@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _VPF_DEPTHSHADOW@GOTPAGE
Lloh7:
	ldr	x10, [x10, _VPF_DEPTHSHADOW@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_3
LBB0_2:
	mov	x0, x20
	mov	x1, x19
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_R_AddDrawSurfCmd
LBB0_3:
	mov	x23, #0
	mov	w8, w19
	lsl	x24, x8, #2
Lloh9:
	adrp	x25, _SS_PORTAL@GOTPAGE
Lloh10:
	ldr	x25, [x25, _SS_PORTAL@GOTPAGEOFF]
Lloh11:
	adrp	x26, _SS_BAD@GOTPAGE
Lloh12:
	ldr	x26, [x26, _SS_BAD@GOTPAGEOFF]
Lloh13:
	adrp	x27, _ri@GOTPAGE
Lloh14:
	ldr	x27, [x27, _ri@GOTPAGEOFF]
Lloh15:
	adrp	x28, _ERR_DROP@GOTPAGE
Lloh16:
	ldr	x28, [x28, _ERR_DROP@GOTPAGEOFF]
Lloh17:
	adrp	x21, l_.str@PAGE
Lloh18:
	add	x21, x21, l_.str@PAGEOFF
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x22, x20, x23
	ldr	w0, [x22]
	add	x1, sp, #16
	add	x2, sp, #24
	add	x3, sp, #20
	add	x4, sp, #12
	add	x5, sp, #8
	bl	_R_DecomposeSort
	ldr	x8, [sp, #24]
	ldr	x9, [x8]
	ldr	x10, [x25]
	cmp	x9, x10
	b.gt	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x10, [x26]
	cmp	x9, x10
	b.ne	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x9, [x27]
	ldr	w0, [x28]
	ldr	w2, [x8, #8]
	mov	x1, x21
	blr	x9
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w1, [sp, #16]
	mov	x0, x22
	bl	_R_MirrorViewBySurface
	cbnz	x0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x23, x23, #4
	cmp	x24, x23
	b.ne	LBB0_4
	b	LBB0_10
LBB0_9:
Lloh19:
	adrp	x8, _r_portalOnly@GOTPAGE
Lloh20:
	ldr	x8, [x8, _r_portalOnly@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	ldr	x8, [x8]
	cbnz	x8, LBB0_11
LBB0_10:
	mov	x0, x20
	mov	x1, x19
	bl	_R_AddDrawSurfCmd
LBB0_11:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_tr,4,2                         ; @tr
	.comm	_VPF_SHADOWMAP,4,2              ; @VPF_SHADOWMAP
	.comm	_VPF_DEPTHSHADOW,4,2            ; @VPF_DEPTHSHADOW
	.comm	_SS_PORTAL,8,3                  ; @SS_PORTAL
	.comm	_SS_BAD,8,3                     ; @SS_BAD
	.comm	_ri,8,3                         ; @ri
	.comm	_ERR_DROP,4,2                   ; @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Shader '%s'with sort == SS_BAD"

	.comm	_r_portalOnly,8,3               ; @r_portalOnly
.subsections_via_symbols
