	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SurfaceForShader               ## -- Begin function SurfaceForShader
	.p2align	4, 0x90
_SurfaceForShader:                      ## @SurfaceForShader
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	_lastSurface@GOTPCREL(%rip), %r10
	movq	(%r10), %rax
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	cmpq	%rbx, 8(%rax)
	jne	LBB0_4
## %bb.2:
	cmpl	%r15d, (%rax)
	jne	LBB0_4
## %bb.3:
	cmpl	%r14d, 4(%rax)
	je	LBB0_14
LBB0_4:
	movq	_surfaces@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	movq	_numsurfaces@GOTPCREL(%rip), %r8
	movl	(%r8), %ecx
	movq	%rdi, %rax
	testl	%ecx, %ecx
	jle	LBB0_10
## %bb.5:
	movl	%ecx, %edx
	movq	%rdi, %rax
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	addq	$16, %rax
	decl	%edx
	je	LBB0_10
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, 8(%rax)
	jne	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpl	%r15d, (%rax)
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpl	%r14d, 4(%rax)
	jne	LBB0_9
## %bb.13:
	movq	%rax, (%r10)
	jmp	LBB0_14
LBB0_10:
	movq	%rax, (%r10)
	movq	_maxsurfaces@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	cmpl	%esi, %ecx
	jl	LBB0_12
## %bb.11:
	movq	_GROW_SURFACES@GOTPCREL(%rip), %rax
	addl	(%rax), %esi
	movl	%esi, (%r13)
	shll	$4, %esi
	callq	_realloc
	movq	%rax, (%r12)
	movq	_numsurfaces@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rdx
	movq	%rdx, %rcx
	shlq	$4, %rcx
	leaq	(%rax,%rcx), %rdi
	addq	$16, %rdi
	notl	%edx
	addl	(%r13), %edx
	shll	$4, %edx
	xorl	%esi, %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	movq	_lastSurface@GOTPCREL(%rip), %r10
	movq	_numsurfaces@GOTPCREL(%rip), %r8
	movq	(%r12), %rdi
	movl	(%r8), %ecx
LBB0_12:
	leal	1(%rcx), %eax
	movl	%eax, (%r8)
	movslq	%ecx, %rax
	shlq	$4, %rax
	leaq	(%rdi,%rax), %rcx
	movq	%rcx, (%r10)
	movq	%rbx, 8(%rdi,%rax)
	movq	(%r10), %rax
	movl	%r15d, (%rax)
	movl	%r14d, 4(%rax)
LBB0_14:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_lastSurface,8,3                ## @lastSurface
	.comm	_surfaces,8,3                   ## @surfaces
	.comm	_numsurfaces,4,2                ## @numsurfaces
	.comm	_maxsurfaces,4,2                ## @maxsurfaces
	.comm	_GROW_SURFACES,8,3              ## @GROW_SURFACES
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SurfaceForShader               ; -- Begin function SurfaceForShader
	.p2align	2
_SurfaceForShader:                      ; @SurfaceForShader
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x22, _lastSurface@GOTPAGE
Lloh1:
	ldr	x22, [x22, _lastSurface@GOTPAGEOFF]
	ldr	x8, [x22]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	x9, [x8, #8]
	cmp	x9, x21
	b.ne	LBB0_4
; %bb.2:
	ldr	w9, [x8]
	cmp	w9, w20
	b.ne	LBB0_4
; %bb.3:
	ldr	w9, [x8, #4]
	cmp	w9, w19
	b.eq	LBB0_14
LBB0_4:
Lloh2:
	adrp	x24, _surfaces@GOTPAGE
Lloh3:
	ldr	x24, [x24, _surfaces@GOTPAGEOFF]
	ldr	x0, [x24]
Lloh4:
	adrp	x23, _numsurfaces@GOTPAGE
Lloh5:
	ldr	x23, [x23, _numsurfaces@GOTPAGEOFF]
	ldr	w9, [x23]
	mov	x10, x0
	subs	w8, w9, #1
	b.lt	LBB0_11
; %bb.5:
	add	x8, x0, w8, uxtw #4
	add	x10, x8, #16
	mov	x11, x9
	mov	x8, x0
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x8, x8, #16
	subs	w11, w11, #1
	b.eq	LBB0_11
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x8, #8]
	cmp	x12, x21
	b.ne	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w12, [x8]
	cmp	w12, w20
	b.ne	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w12, [x8, #4]
	cmp	w12, w19
	b.ne	LBB0_6
; %bb.10:
	str	x8, [x22]
	b	LBB0_14
LBB0_11:
	str	x10, [x22]
Lloh6:
	adrp	x25, _maxsurfaces@GOTPAGE
Lloh7:
	ldr	x25, [x25, _maxsurfaces@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w9, w8
	b.lt	LBB0_13
; %bb.12:
Lloh8:
	adrp	x9, _GROW_SURFACES@GOTPAGE
Lloh9:
	ldr	x9, [x9, _GROW_SURFACES@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	add	w8, w8, w9
	str	w8, [x25]
	lsl	w1, w8, #4
	bl	_realloc
	str	x0, [x24]
	ldrsw	x8, [x23]
	add	x9, x0, x8, lsl #4
	add	x0, x9, #16
	ldr	w9, [x25]
	mvn	w8, w8
	add	w8, w9, w8
	lsl	w2, w8, #4
	mov	w1, #0
	bl	_memset
	ldr	x0, [x24]
	ldr	w9, [x23]
LBB0_13:
	add	w8, w9, #1
	str	w8, [x23]
	add	x8, x0, w9, sxtw #4
	str	x8, [x22]
	str	x21, [x8, #8]
	ldr	x8, [x22]
	stp	w20, w19, [x8]
LBB0_14:
	mov	x0, x8
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_lastSurface,8,3                ; @lastSurface
	.comm	_surfaces,8,3                   ; @surfaces
	.comm	_numsurfaces,4,2                ; @numsurfaces
	.comm	_maxsurfaces,4,2                ; @maxsurfaces
	.comm	_GROW_SURFACES,8,3              ; @GROW_SURFACES
.subsections_via_symbols
