	.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, %ebx
	testl	%esi, %esi
	jle	LBB0_11
## %bb.1:
	movq	_MAX_DRAWSURFS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%ebx, %eax
	cmovll	%eax, %ebx
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	%ebx, %esi
	movl	$4, %edx
	callq	_qsortFast
	testl	%ebx, %ebx
	jle	LBB0_9
## %bb.2:
	movl	%ebx, %r12d
	leaq	-68(%rbp), %r14
	movq	_SS_PORTAL@GOTPCREL(%rip), %r13
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %edi
	leaq	-44(%rbp), %rsi
	leaq	-64(%rbp), %rdx
	leaq	-72(%rbp), %rcx
	movq	%r14, %r8
	callq	_R_DecomposeSort
	movq	-64(%rbp), %rax
	movq	(%rax), %rcx
	cmpq	(%r13), %rcx
	jg	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	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	%r15, %rdi
	callq	_R_MirrorViewBySurface
	testq	%rax, %rax
	jne	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_4 Depth=1
	addq	$4, %r15
	decq	%r12
	jne	LBB0_4
	jmp	LBB0_9
LBB0_11:
	movl	%ebx, %esi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_R_AddDrawSurfCmd               ## TAILCALL
LBB0_8:
	movq	_r_portalOnly@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	jne	LBB0_10
LBB0_9:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %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	_MAX_DRAWSURFS,4,2              ## @MAX_DRAWSURFS
	.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, x0
	cmp	w1, #0
	b.le	LBB0_8
; %bb.1:
Lloh0:
	adrp	x8, _MAX_DRAWSURFS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_DRAWSURFS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	csel	w20, w8, w1, lt
	mov	x0, x19
	mov	x1, x20
	mov	w2, #4
	bl	_qsortFast
	cmp	w20, #1
	b.lt	LBB0_10
; %bb.2:
Lloh3:
	adrp	x23, _SS_PORTAL@GOTPAGE
Lloh4:
	ldr	x23, [x23, _SS_PORTAL@GOTPAGEOFF]
Lloh5:
	adrp	x24, _SS_BAD@GOTPAGE
Lloh6:
	ldr	x24, [x24, _SS_BAD@GOTPAGEOFF]
Lloh7:
	adrp	x21, l_.str@PAGE
Lloh8:
	add	x21, x21, l_.str@PAGEOFF
Lloh9:
	adrp	x25, _ri@GOTPAGE
Lloh10:
	ldr	x25, [x25, _ri@GOTPAGEOFF]
	mov	x26, x20
Lloh11:
	adrp	x27, _ERR_DROP@GOTPAGE
Lloh12:
	ldr	x27, [x27, _ERR_DROP@GOTPAGEOFF]
	mov	x22, x19
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x22]
	add	x1, sp, #16
	add	x2, sp, #24
	add	x3, sp, #20
	add	x4, sp, #12
	bl	_R_DecomposeSort
	ldr	x8, [sp, #24]
	ldr	x9, [x8]
	ldr	x10, [x23]
	cmp	x9, x10
	b.gt	LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x10, [x24]
	cmp	x9, x10
	b.ne	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x9, [x25]
	ldr	w0, [x27]
	ldr	w2, [x8, #8]
	mov	x1, x21
	blr	x9
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [sp, #16]
	mov	x0, x22
	bl	_R_MirrorViewBySurface
	cbnz	x0, LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #4
	subs	x26, x26, #1
	b.ne	LBB0_3
	b	LBB0_10
LBB0_8:
	mov	x0, 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_9:
Lloh13:
	adrp	x8, _r_portalOnly@GOTPAGE
Lloh14:
	ldr	x8, [x8, _r_portalOnly@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	ldr	x8, [x8]
	cbnz	x8, LBB0_11
LBB0_10:
	mov	x0, x19
	mov	x1, x20
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_DRAWSURFS,4,2              ; @MAX_DRAWSURFS
	.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
