	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function RB_SurfaceGrid
LCPI0_0:
	.space	4
	.long	1                               ## 0x1
	.space	4
	.space	4
LCPI0_1:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
LCPI0_2:
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_RB_SurfaceGrid:                        ## @RB_SurfaceGrid
	.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	$200, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAX_GRID_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	shlq	$2, %r14
	movq	%r14, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rbx
	movq	%r14, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	movl	(%r12), %eax
	movq	_tess@GOTPCREL(%rip), %rcx
	movl	%eax, -80(%rbp)                 ## 4-byte Spill
	orl	%eax, (%rcx)
	movl	40(%r12), %esi
	movl	44(%r12), %edi
	callq	_LodErrorForVolume
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	$0, (%rbx)
	movl	4(%r12), %ecx
	leal	-1(%rcx), %eax
	movl	$1, %r14d
	cmpl	$3, %ecx
	jl	LBB0_12
## %bb.1:
	movq	8(%r12), %rcx
	movl	%eax, %r8d
	decq	%r8
	cmpl	$2, %eax
	jne	LBB0_3
## %bb.2:
	movl	$1, %r14d
	movl	$1, %esi
LBB0_9:
	testb	$1, %r8b
	je	LBB0_12
## %bb.10:
	ucomiss	(%rcx,%rsi,4), %xmm0
	jb	LBB0_12
## %bb.11:
	movslq	%r14d, %r14
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	%esi, (%rcx,%r14,4)
	incl	%r14d
LBB0_12:
	movslq	%r14d, %rcx
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rdx,%rcx,4)
	movl	$0, (%r13)
	movl	16(%r12), %ecx
	leal	-1(%rcx), %eax
	cmpl	$2, %ecx
	jle	LBB0_13
## %bb.14:
	movq	24(%r12), %rcx
	movl	%eax, %r8d
	decq	%r8
	cmpl	$2, %eax
	jne	LBB0_16
## %bb.15:
	movl	$1, %esi
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movl	$1, %esi
	movq	_tess@GOTPCREL(%rip), %rbx
LBB0_22:
	testb	$1, %r8b
	je	LBB0_25
## %bb.23:
	ucomiss	(%rcx,%rsi,4), %xmm0
	jb	LBB0_25
## %bb.24:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movslq	%ecx, %rcx
	movl	%esi, (%r13,%rcx,4)
	incl	%ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
LBB0_25:
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movslq	%edx, %rcx
	movl	%eax, (%r13,%rcx,4)
	testl	%edx, %edx
	jle	LBB0_55
## %bb.26:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	incl	%eax
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	jmp	LBB0_27
LBB0_13:
	movl	%eax, 4(%r13)
	movl	$1, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$2, -68(%rbp)                   ## 4-byte Folded Spill
	movq	_tess@GOTPCREL(%rip), %rbx
LBB0_27:
	leal	1(%r14), %r15d
	leal	(%r15,%r15), %eax
	leal	(%rax,%rax,2), %eax
	movl	%eax, -76(%rbp)                 ## 4-byte Spill
	movl	%r15d, %ecx
	leal	-1(%r14), %eax
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	leaq	1(%rax), %r10
	movq	%r10, %r11
	andq	$-4, %r11
	leaq	(%r11,%r11), %rax
	leaq	(%rax,%rax,2), %rax
	movq	%rax, -136(%rbp)                ## 8-byte Spill
	movd	%r15d, %xmm0
	movdqa	LCPI0_0(%rip), %xmm13           ## xmm13 = <u,1,u,u>
	pinsrd	$0, %r15d, %xmm13
	pshufd	$0, %xmm0, %xmm14               ## xmm14 = xmm0[0,0,0,0]
	shlq	$2, %rcx
	movq	%rcx, -192(%rbp)                ## 8-byte Spill
	xorl	%eax, %eax
	movq	%r14, -160(%rbp)                ## 8-byte Spill
	movq	%r15, -152(%rbp)                ## 8-byte Spill
	movq	%r10, -128(%rbp)                ## 8-byte Spill
	movq	%r11, -120(%rbp)                ## 8-byte Spill
	movdqa	%xmm13, -240(%rbp)              ## 16-byte Spill
	movdqa	%xmm14, -224(%rbp)              ## 16-byte Spill
	jmp	LBB0_28
	.p2align	4, 0x90
LBB0_33:                                ##   in Loop: Header=BB0_28 Depth=1
	leal	-1(%rcx), %r8d
LBB0_54:                                ##   in Loop: Header=BB0_28 Depth=1
	movl	%edi, 8(%rbx)
	imull	%r15d, %ecx
	addl	%ecx, 4(%rbx)
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	addl	%r8d, %eax
	cmpl	-56(%rbp), %eax                 ## 4-byte Folded Reload
	jge	LBB0_55
LBB0_28:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_29 Depth 2
                                        ##     Child Loop BB0_35 Depth 2
                                        ##       Child Loop BB0_37 Depth 3
                                        ##     Child Loop BB0_44 Depth 2
                                        ##       Child Loop BB0_48 Depth 3
                                        ##       Child Loop BB0_51 Depth 3
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	jmp	LBB0_29
	.p2align	4, 0x90
LBB0_31:                                ##   in Loop: Header=BB0_29 Depth=2
	xorl	%eax, %eax
	callq	_RB_EndSurface
	movq	56(%rbx), %rdi
	movl	72(%rbx), %esi
	callq	_RB_BeginSurface
LBB0_29:                                ##   Parent Loop BB0_28 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_SHADER_MAX_VERTEXES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	4(%rbx), %esi
	movl	8(%rbx), %edi
	subl	%esi, %eax
	cltd
	idivl	%r15d
	movl	%eax, %ecx
	movq	_SHADER_MAX_INDEXES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	subl	%edi, %eax
	cltd
	idivl	-76(%rbp)                       ## 4-byte Folded Reload
	cmpl	$2, %ecx
	jl	LBB0_31
## %bb.30:                              ##   in Loop: Header=BB0_29 Depth=2
	testl	%eax, %eax
	jle	LBB0_31
## %bb.32:                              ##   in Loop: Header=BB0_28 Depth=1
	leal	-1(%rcx), %edx
	cmpl	%eax, %ecx
	cmoval	%eax, %edx
	movq	-88(%rbp), %r9                  ## 8-byte Reload
	leal	(%rdx,%r9), %r8d
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, %ecx
	subl	%r9d, %ecx
	cmpl	%eax, %r8d
	cmovlel	%edx, %ecx
	testl	%ecx, %ecx
	jle	LBB0_33
## %bb.34:                              ##   in Loop: Header=BB0_28 Depth=1
	movq	%rbx, %rdx
	movl	%esi, -72(%rbp)                 ## 4-byte Spill
	movslq	%esi, %rbx
	movq	56(%rdx), %rax
	movq	(%rax), %rax
	movq	%rax, -200(%rbp)                ## 8-byte Spill
	leaq	(,%rbx,4), %rax
	movq	40(%rdx), %rsi
	addq	%rax, %rsi
	movq	%rsi, -104(%rbp)                ## 8-byte Spill
	addq	64(%rdx), %rax
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	movq	32(%rdx), %rsi
	movq	(%rsi,%rbx,8), %rsi
	movq	(%rsi), %rsi
	movq	16(%rdx), %r8
	movq	24(%rdx), %rdi
	movq	(%rdi,%rbx,8), %rdi
	movq	(%r8,%rbx,8), %rbx
	movslq	%r9d, %rax
	movq	%rax, -168(%rbp)                ## 8-byte Spill
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	movl	%ecx, %eax
	movq	%rax, -176(%rbp)                ## 8-byte Spill
	xorl	%ecx, %ecx
	jmp	LBB0_35
	.p2align	4, 0x90
LBB0_40:                                ##   in Loop: Header=BB0_35 Depth=2
	subq	%r11, %rbx
	subq	%r11, %rsi
	subq	%r11, %rdi
	addq	%r10, -112(%rbp)                ## 8-byte Folded Spill
	addq	%r10, -104(%rbp)                ## 8-byte Folded Spill
	movq	-160(%rbp), %r14                ## 8-byte Reload
	movq	-152(%rbp), %r15                ## 8-byte Reload
	movq	-184(%rbp), %rcx                ## 8-byte Reload
LBB0_41:                                ##   in Loop: Header=BB0_35 Depth=2
	incq	%rcx
	cmpq	-176(%rbp), %rcx                ## 8-byte Folded Reload
	jae	LBB0_42
LBB0_35:                                ##   Parent Loop BB0_28 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_37 Depth 3
	testl	%r14d, %r14d
	js	LBB0_41
## %bb.36:                              ##   in Loop: Header=BB0_35 Depth=2
	movq	32(%r12), %r9
	movq	-168(%rbp), %rax                ## 8-byte Reload
	movq	%rcx, -184(%rbp)                ## 8-byte Spill
	leaq	(%rcx,%rax), %r14
	xorl	%r11d, %r11d
	xorl	%r10d, %r10d
	jmp	LBB0_37
	.p2align	4, 0x90
LBB0_39:                                ##   in Loop: Header=BB0_37 Depth=3
	movq	32(%r12), %rax
	movl	(%rax), %eax
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	movl	%eax, (%rcx,%r10)
	movl	-80(%rbp), %eax                 ## 4-byte Reload
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	movl	%eax, (%rcx,%r10)
	addq	$4, %r10
	addq	$-16, %r11
	cmpq	%r10, -192(%rbp)                ## 8-byte Folded Reload
	movq	%r13, %r12
	movq	%r15, %r13
	je	LBB0_40
LBB0_37:                                ##   Parent Loop BB0_28 Depth=1
                                        ##     Parent Loop BB0_35 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	%r13, %r15
	movslq	(%r13,%r14,4), %rax
	movq	%r12, %r13
	movslq	4(%r12), %rcx
	imulq	%rax, %rcx
	leaq	(%rcx,%rcx,4), %rax
	leaq	(%r9,%rax,8), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movslq	(%rcx,%r10), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rax,%rcx,8), %r12
	movq	(%rax,%rcx,8), %r8
	movss	(%r8), %xmm0                    ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rbx,%r10,4)
	movss	4(%r8), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 4(%rbx,%r10,4)
	movss	8(%r8), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 8(%rbx,%r10,4)
	movq	8(%rax,%rcx,8), %rdx
	movss	(%rdx), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rsi,%r10,4)
	movss	4(%rdx), %xmm0                  ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 4(%rsi,%r10,4)
	movq	16(%rax,%rcx,8), %rax
	movss	(%rax), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 8(%rsi,%r10,4)
	movd	4(%rax), %xmm0                  ## xmm0 = mem[0],zero,zero,zero
	movd	%xmm0, 12(%rsi,%r10,4)
	cmpq	$0, -200(%rbp)                  ## 8-byte Folded Reload
	je	LBB0_39
## %bb.38:                              ##   in Loop: Header=BB0_37 Depth=3
	movq	24(%r12), %rax
	movss	(%rax), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rdi,%r10,4)
	movss	4(%rax), %xmm0                  ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 4(%rdi,%r10,4)
	movd	8(%rax), %xmm0                  ## xmm0 = mem[0],zero,zero,zero
	movd	%xmm0, 8(%rdi,%r10,4)
	jmp	LBB0_39
	.p2align	4, 0x90
LBB0_42:                                ##   in Loop: Header=BB0_28 Depth=1
	movq	_tess@GOTPCREL(%rip), %rbx
	movl	8(%rbx), %edi
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	leal	-1(%rcx), %r8d
	cmpl	$2, %ecx
	movq	-128(%rbp), %r10                ## 8-byte Reload
	movq	-120(%rbp), %r11                ## 8-byte Reload
	movdqa	-240(%rbp), %xmm13              ## 16-byte Reload
	movdqa	-224(%rbp), %xmm14              ## 16-byte Reload
	movdqa	LCPI0_1(%rip), %xmm15           ## xmm15 = [0,1,2,3]
	pcmpeqd	%xmm6, %xmm6
	jl	LBB0_54
## %bb.43:                              ##   in Loop: Header=BB0_28 Depth=1
	movq	48(%rbx), %rdx
	xorl	%eax, %eax
	movl	-72(%rbp), %r9d                 ## 4-byte Reload
	jmp	LBB0_44
	.p2align	4, 0x90
LBB0_52:                                ##   in Loop: Header=BB0_44 Depth=2
	movq	_tess@GOTPCREL(%rip), %rbx
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
LBB0_53:                                ##   in Loop: Header=BB0_44 Depth=2
	incl	%eax
	addl	%r15d, %r9d
	cmpl	%r8d, %eax
	je	LBB0_54
LBB0_44:                                ##   Parent Loop BB0_28 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_48 Depth 3
                                        ##       Child Loop BB0_51 Depth 3
	testl	%r14d, %r14d
	jle	LBB0_53
## %bb.45:                              ##   in Loop: Header=BB0_44 Depth=2
	xorl	%ecx, %ecx
	movslq	%edi, %rbx
	cmpl	$3, -144(%rbp)                  ## 4-byte Folded Reload
	jae	LBB0_47
## %bb.46:                              ##   in Loop: Header=BB0_44 Depth=2
	movq	%rbx, %rdi
	jmp	LBB0_50
	.p2align	4, 0x90
LBB0_47:                                ##   in Loop: Header=BB0_44 Depth=2
	movl	%eax, %ecx
	imull	%r15d, %ecx
	addl	-72(%rbp), %ecx                 ## 4-byte Folded Reload
	movq	-136(%rbp), %rsi                ## 8-byte Reload
	leaq	(%rsi,%rbx), %rdi
	movd	%ecx, %xmm0
	pshufd	$0, %xmm0, %xmm8                ## xmm8 = xmm0[0,0,0,0]
	leaq	(%rdx,%rbx,4), %rbx
	movq	%r11, %rcx
	movdqa	%xmm15, %xmm1
	.p2align	4, 0x90
LBB0_48:                                ##   Parent Loop BB0_28 Depth=1
                                        ##     Parent Loop BB0_44 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movdqa	%xmm8, %xmm2
	paddd	%xmm1, %xmm2
	movdqa	%xmm2, %xmm3
	psubd	%xmm6, %xmm3
	movdqa	%xmm2, %xmm4
	paddd	%xmm14, %xmm4
	pmovzxdq	%xmm2, %xmm9                    ## xmm9 = xmm2[0],zero,xmm2[1],zero
	pshufd	$68, %xmm4, %xmm11              ## xmm11 = xmm4[0,1,0,1]
	pshufd	$250, %xmm2, %xmm10             ## xmm10 = xmm2[2,2,3,3]
	pshufd	$238, %xmm4, %xmm12             ## xmm12 = xmm4[2,3,2,3]
	movdqa	%xmm2, %xmm5
	punpckldq	%xmm4, %xmm5            ## xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1]
	shufps	$4, %xmm3, %xmm5                ## xmm5 = xmm5[0,1],xmm3[0,0]
	movaps	%xmm3, %xmm7
	shufps	$85, %xmm4, %xmm7               ## xmm7 = xmm7[1,1],xmm4[1,1]
	punpckhdq	%xmm4, %xmm2            ## xmm2 = xmm2[2],xmm4[2],xmm2[3],xmm4[3]
	shufps	$164, %xmm3, %xmm2              ## xmm2 = xmm2[0,1],xmm3[2,2]
	shufps	$255, %xmm4, %xmm3              ## xmm3 = xmm3[3,3],xmm4[3,3]
	psubd	%xmm6, %xmm4
	pblendw	$48, %xmm9, %xmm11              ## xmm11 = xmm11[0,1,2,3],xmm9[4,5],xmm11[6,7]
	pshufd	$80, %xmm4, %xmm6               ## xmm6 = xmm4[0,0,1,1]
	pblendw	$243, %xmm11, %xmm6             ## xmm6 = xmm11[0,1],xmm6[2,3],xmm11[4,5,6,7]
	pblendw	$48, %xmm10, %xmm12             ## xmm12 = xmm12[0,1,2,3],xmm10[4,5],xmm12[6,7]
	pshufd	$250, %xmm4, %xmm0              ## xmm0 = xmm4[2,2,3,3]
	pblendw	$243, %xmm12, %xmm0             ## xmm0 = xmm12[0,1],xmm0[2,3],xmm12[4,5,6,7]
	insertps	$112, %xmm4, %xmm7              ## xmm7 = xmm7[0,1,2],xmm4[1]
	blendps	$8, %xmm4, %xmm3                ## xmm3 = xmm3[0,1,2],xmm4[3]
	movups	%xmm3, 80(%rbx)
	movups	%xmm2, 48(%rbx)
	movdqa	LCPI0_2(%rip), %xmm2            ## xmm2 = [4,4,4,4]
	movups	%xmm7, 32(%rbx)
	movups	%xmm5, (%rbx)
	movdqu	%xmm0, 64(%rbx)
	movdqu	%xmm6, 16(%rbx)
	pcmpeqd	%xmm6, %xmm6
	paddd	%xmm2, %xmm1
	addq	$96, %rbx
	addq	$-4, %rcx
	jne	LBB0_48
## %bb.49:                              ##   in Loop: Header=BB0_44 Depth=2
	movl	%r11d, %ecx
	cmpq	%r11, %r10
	je	LBB0_52
LBB0_50:                                ##   in Loop: Header=BB0_44 Depth=2
	movl	%r14d, %ebx
	subl	%ecx, %ebx
	addl	%r9d, %ecx
	.p2align	4, 0x90
LBB0_51:                                ##   Parent Loop BB0_28 Depth=1
                                        ##     Parent Loop BB0_44 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	%ecx, (%rdx,%rdi,4)
	movd	%ecx, %xmm0
	pshufd	$80, %xmm0, %xmm0               ## xmm0 = xmm0[0,0,1,1]
	paddd	%xmm13, %xmm0
	pshufd	$20, %xmm0, %xmm1               ## xmm1 = xmm0[0,1,1,0]
	movd	%xmm0, %esi
	incl	%esi
	movdqu	%xmm1, 4(%rdx,%rdi,4)
	movl	%esi, 20(%rdx,%rdi,4)
	addq	$6, %rdi
	incl	%ecx
	decl	%ebx
	jne	LBB0_51
	jmp	LBB0_52
LBB0_55:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_57
## %bb.56:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%r8, %rdi
	andq	$-2, %rdi
	negq	%rdi
	movl	$1, %r14d
	movl	$1, %esi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	leaq	(%rdi,%rsi), %rbx
	addq	$2, %rbx
	addq	$2, %rsi
	cmpq	$1, %rbx
	je	LBB0_9
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	ucomiss	(%rcx,%rsi,4), %xmm0
	jb	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movslq	%r14d, %r14
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movl	%esi, (%rbx,%r14,4)
	incl	%r14d
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	ucomiss	4(%rcx,%rsi,4), %xmm0
	jb	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movslq	%r14d, %r14
	leal	1(%rsi), %ebx
	movl	%ebx, (%rdx,%r14,4)
	incl	%r14d
	jmp	LBB0_8
LBB0_16:
	movq	%r8, %rdi
	andq	$-2, %rdi
	negq	%rdi
	movl	$1, %esi
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movl	$1, %esi
	jmp	LBB0_17
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_17 Depth=1
	leaq	(%rdi,%rsi), %rbx
	addq	$2, %rbx
	addq	$2, %rsi
	cmpq	$1, %rbx
	movq	_tess@GOTPCREL(%rip), %rbx
	je	LBB0_22
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	ucomiss	(%rcx,%rsi,4), %xmm0
	jb	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movslq	%ebx, %rbx
	movl	%esi, (%r13,%rbx,4)
	incl	%ebx
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
LBB0_19:                                ##   in Loop: Header=BB0_17 Depth=1
	ucomiss	4(%rcx,%rsi,4), %xmm0
	jb	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movslq	%edx, %rdx
	leal	1(%rsi), %ebx
	movl	%ebx, (%r13,%rdx,4)
	incl	%edx
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_21
LBB0_57:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_GRID_SIZE,4,2              ## @MAX_GRID_SIZE
	.comm	_tess,80,3                      ## @tess
	.comm	_SHADER_MAX_VERTEXES,4,2        ## @SHADER_MAX_VERTEXES
	.comm	_SHADER_MAX_INDEXES,4,2         ## @SHADER_MAX_INDEXES
	.no_dead_strip	_RB_SurfaceGrid
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function RB_SurfaceGrid
_RB_SurfaceGrid:                        ; @RB_SurfaceGrid
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #48
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x8, _MAX_GRID_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_GRID_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x10, x8, #15
	and	x12, x10, #0x7fffffff0
	sub	x20, x9, x12
	mov	sp, x20
	mov	x9, x8
Lloh8:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh9:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	sub	x21, x8, x12
	mov	sp, x21
Lloh10:
	adrp	x22, _tess@GOTPAGE
Lloh11:
	ldr	x22, [x22, _tess@GOTPAGEOFF]
	ldr	w23, [x0]
	ldr	w8, [x22]
	orr	w8, w8, w23
	str	w8, [x22]
	ldr	w0, [x0, #44]
	ldr	w1, [x19, #40]
	bl	_LodErrorForVolume
	str	wzr, [x20]
	ldr	w9, [x19, #4]
	sub	w8, w9, #1
	cmp	w9, #3
	b.lt	LBB0_5
; %bb.1:
	ldr	x9, [x19, #8]
	mov	w10, #1
	mov	w24, #1
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x10, x10, #1
	cmp	x8, x10
	b.eq	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	s1, [x9, x10, lsl #2]
	fcmp	s1, s0
	b.hi	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	str	w10, [x20, w24, sxtw #2]
	add	w24, w24, #1
	b	LBB0_2
LBB0_5:
	mov	w24, #1
LBB0_6:
	str	w8, [x20, w24, sxtw #2]
	str	wzr, [x21]
	ldr	w9, [x19, #16]
	sub	w8, w9, #1
	cmp	w9, #2
	b.le	LBB0_11
; %bb.7:
	ldr	x9, [x19, #24]
	mov	w10, #1
	mov	w11, #1
	stur	w11, [x29, #-100]               ; 4-byte Folded Spill
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	x10, x10, #1
	cmp	x8, x10
	b.eq	LBB0_12
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	s1, [x9, x10, lsl #2]
	fcmp	s1, s0
	b.hi	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldur	w11, [x29, #-100]               ; 4-byte Folded Reload
	str	w10, [x21, w11, sxtw #2]
	add	w11, w11, #1
	stur	w11, [x29, #-100]               ; 4-byte Folded Spill
	b	LBB0_8
LBB0_11:
	str	w8, [x21, #4]
	mov	w8, #1
	stur	w8, [x29, #-100]                ; 4-byte Folded Spill
	mov	w8, #2
	b	LBB0_14
LBB0_12:
	ldur	w9, [x29, #-100]                ; 4-byte Folded Reload
	str	w8, [x21, w9, sxtw #2]
	cmp	w9, #1
	b.lt	LBB0_35
; %bb.13:
	ldur	w8, [x29, #-100]                ; 4-byte Folded Reload
	add	w8, w8, #1
LBB0_14:
	stur	w8, [x29, #-104]                ; 4-byte Folded Spill
	mov	w9, #0
	add	w28, w24, #1
	add	w8, w28, w28, lsl #1
	lsl	w25, w8, #1
	movi.2s	v2, #1
	mov.s	v2[0], w28
	lsl	x26, x28, #2
	mov	w27, #40
	stur	q2, [x29, #-128]                ; 16-byte Folded Spill
	b	LBB0_17
LBB0_15:                                ;   in Loop: Header=BB0_17 Depth=1
	sub	w11, w9, #1
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	w8, [x22, #4]
	madd	w8, w9, w28, w8
	stp	w8, w10, [x22, #4]
	ldur	x9, [x29, #-96]                 ; 8-byte Folded Reload
	add	w9, w11, w9
	ldur	w8, [x29, #-100]                ; 4-byte Folded Reload
	cmp	w9, w8
	b.ge	LBB0_35
LBB0_17:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_18 Depth 2
                                        ;     Child Loop BB0_24 Depth 2
                                        ;       Child Loop BB0_27 Depth 3
                                        ;     Child Loop BB0_32 Depth 2
                                        ;       Child Loop BB0_34 Depth 3
	stur	x9, [x29, #-96]                 ; 8-byte Folded Spill
LBB0_18:                                ;   Parent Loop BB0_17 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
Lloh12:
	adrp	x8, _SHADER_MAX_VERTEXES@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SHADER_MAX_VERTEXES@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x8]
	ldp	w8, w10, [x22, #4]
	sub	w9, w9, w8
	sdiv	w9, w9, w28
Lloh15:
	adrp	x11, _SHADER_MAX_INDEXES@GOTPAGE
Lloh16:
	ldr	x11, [x11, _SHADER_MAX_INDEXES@GOTPAGEOFF]
Lloh17:
	ldr	w11, [x11]
	sub	w11, w11, w10
	cmp	w9, #2
	sdiv	w11, w11, w25
	ccmp	w11, #0, #4, ge
	b.gt	LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=2
	bl	_RB_EndSurface
	ldr	x0, [x22, #56]
	ldr	w1, [x22, #72]
	bl	_RB_BeginSurface
	b	LBB0_18
LBB0_20:                                ;   in Loop: Header=BB0_17 Depth=1
	sub	w12, w9, #1
	cmp	w9, w11
	csel	w9, w11, w12, hi
	ldur	w13, [x29, #-104]               ; 4-byte Folded Reload
	ldur	x0, [x29, #-96]                 ; 8-byte Folded Reload
	sub	w11, w13, w0
	add	w12, w9, w0
	cmp	w12, w13
	csel	w9, w11, w9, gt
	cmp	w9, #0
	b.le	LBB0_15
; %bb.21:                               ;   in Loop: Header=BB0_17 Depth=1
	mov	x10, #0
	sxtw	x14, w8
	ldp	x11, x13, [x22, #56]
	ldr	x11, [x11]
	lsl	x15, x14, #2
	ldp	x16, x12, [x22, #32]
	add	x12, x12, x15
	add	x13, x13, x15
	lsl	x17, x14, #3
	ldr	x14, [x16, x17]
	ldr	x14, [x14]
	ldp	x16, x15, [x22, #16]
	ldr	x15, [x15, x17]
	ldr	x16, [x16, x17]
	sxtw	x17, w0
	ldur	q2, [x29, #-128]                ; 16-byte Folded Reload
	b	LBB0_24
LBB0_22:                                ;   in Loop: Header=BB0_24 Depth=2
	add	x16, x16, x1
	add	x14, x14, x1
	add	x15, x15, x1
	add	x12, x12, x0
	add	x13, x13, x0
LBB0_23:                                ;   in Loop: Header=BB0_24 Depth=2
	add	x10, x10, #1
	cmp	x10, x9
	b.hs	LBB0_29
LBB0_24:                                ;   Parent Loop BB0_17 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_27 Depth 3
	tbnz	w24, #31, LBB0_23
; %bb.25:                               ;   in Loop: Header=BB0_24 Depth=2
	mov	x1, #0
	mov	x0, #0
	ldr	x2, [x19, #32]
	add	x3, x10, x17
	b	LBB0_27
LBB0_26:                                ;   in Loop: Header=BB0_27 Depth=3
	ldr	x4, [x4, #32]
	ldr	w4, [x4]
	str	w4, [x13, x0]
	str	w23, [x12, x0]
	add	x0, x0, #4
	add	x1, x1, #16
	cmp	x26, x0
	b.eq	LBB0_22
LBB0_27:                                ;   Parent Loop BB0_17 Depth=1
                                        ;     Parent Loop BB0_24 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	lsl	x5, x0, #2
	add	x6, x16, x5
	ldr	w4, [x21, x3, lsl #2]
	ldr	w7, [x19, #4]
	mul	w4, w7, w4
	smaddl	x4, w4, w27, x2
	ldrsw	x7, [x20, x0]
	madd	x4, x7, x27, x4
	ldp	x7, x30, [x4]
	ldr	s0, [x7]
	str	s0, [x6]
	ldr	s0, [x7, #4]
	str	s0, [x6, #4]
	ldr	s0, [x7, #8]
	add	x5, x14, x5
	str	s0, [x6, #8]
	ldr	s0, [x30]
	str	s0, [x5]
	ldr	s0, [x30, #4]
	str	s0, [x5, #4]
	ldr	x6, [x4, #16]
	ldr	s0, [x6]
	str	s0, [x5, #8]
	ldr	s0, [x6, #4]
	str	s0, [x5, #12]
	cbz	x11, LBB0_26
; %bb.28:                               ;   in Loop: Header=BB0_27 Depth=3
	ldr	x5, [x4, #24]
	ldr	s0, [x5]
	add	x6, x15, x1
	str	s0, [x6]
	ldr	s0, [x5, #4]
	str	s0, [x6, #4]
	ldr	s0, [x5, #8]
	str	s0, [x6, #8]
	b	LBB0_26
LBB0_29:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	w10, [x22, #8]
	sub	w11, w9, #1
	cmp	w9, #2
	b.lt	LBB0_16
; %bb.30:                               ;   in Loop: Header=BB0_17 Depth=1
	mov	w12, #0
	ldr	x13, [x22, #48]
	b	LBB0_32
LBB0_31:                                ;   in Loop: Header=BB0_32 Depth=2
	add	w12, w12, #1
	add	w8, w8, w28
	cmp	w12, w11
	b.eq	LBB0_16
LBB0_32:                                ;   Parent Loop BB0_17 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_34 Depth 3
	cmp	w24, #1
	b.lt	LBB0_31
; %bb.33:                               ;   in Loop: Header=BB0_32 Depth=2
	add	x14, x13, w10, sxtw #2
	mov	x15, x8
	mov	x16, x24
LBB0_34:                                ;   Parent Loop BB0_17 Depth=1
                                        ;     Parent Loop BB0_32 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	dup.2s	v0, w15
	str	w15, [x14]
	add.2s	v0, v0, v2
	rev64.4s	v1, v0
	zip1.4s	v1, v0, v1
	fmov	w17, s0
	add	w17, w17, #1
	stur	q1, [x14, #4]
	str	w17, [x14, #20]
	add	x14, x14, #24
	add	w10, w10, #6
	add	w15, w15, #1
	subs	w16, w16, #1
	b.ne	LBB0_34
	b	LBB0_31
LBB0_35:
	ldur	x8, [x29, #-88]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_37
; %bb.36:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_37:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_GRID_SIZE,4,2              ; @MAX_GRID_SIZE
	.comm	_tess,80,3                      ; @tess
	.comm	_SHADER_MAX_VERTEXES,4,2        ; @SHADER_MAX_VERTEXES
	.comm	_SHADER_MAX_INDEXES,4,2         ; @SHADER_MAX_INDEXES
	.no_dead_strip	_RB_SurfaceGrid
.subsections_via_symbols
