	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_GridInsertRow                ## -- Begin function R_GridInsertRow
	.p2align	4, 0x90
_R_GridInsertRow:                       ## @R_GridInsertRow
	.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	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movss	%xmm0, -96(%rbp)                ## 4-byte Spill
	movl	%ecx, -100(%rbp)                ## 4-byte Spill
	movl	%edx, %r15d
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAX_GRID_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%rbx, %rax
	imulq	%rbx, %rax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -88(%rbp)                 ## 8-byte Spill
	leaq	(,%rbx,8), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rax
	movl	4(%r14), %ecx
	cmpl	%ebx, %ecx
	jge	LBB0_31
## %bb.1:
	movq	%r14, %r11
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	movl	(%r14), %eax
	leal	1(%rcx), %edx
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
                                        ## kill: def $eax killed $eax def $rax
	testl	%ecx, %ecx
	js	LBB0_32
## %bb.2:
	movq	%rbx, %rsi
	movq	-112(%rbp), %rax                ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rax
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movl	%r15d, %eax
	movq	%rax, -160(%rbp)                ## 8-byte Spill
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, %ecx
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movq	%rdx, -152(%rbp)                ## 8-byte Spill
	decl	%eax
	movl	%eax, -104(%rbp)                ## 4-byte Spill
	movq	%rcx, %rax
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	imulq	%rbx, %rax
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	leaq	(%r14,%rax,4), %r13
	shlq	$2, %rsi
	movq	%rsi, -128(%rbp)                ## 8-byte Spill
	leaq	112(%r14), %r12
	xorl	%edi, %edi
	movl	-56(%rbp), %r10d                ## 4-byte Reload
	movl	%r10d, %eax
	movl	%r10d, %ebx
	xorl	%r8d, %r8d
	movq	%r11, -144(%rbp)                ## 8-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_5 Depth=1
	incl	%r8d
LBB0_4:                                 ##   in Loop: Header=BB0_5 Depth=1
	incq	%rdi
	movq	-128(%rbp), %rcx                ## 8-byte Reload
	addq	%rcx, %r12
	addq	%rcx, %r14
	cmpq	-152(%rbp), %rdi                ## 8-byte Folded Reload
	je	LBB0_32
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_20 Depth 2
                                        ##     Child Loop BB0_23 Depth 2
                                        ##     Child Loop BB0_27 Depth 2
                                        ##     Child Loop BB0_30 Depth 2
                                        ##     Child Loop BB0_9 Depth 2
	cmpq	-136(%rbp), %rdi                ## 8-byte Folded Reload
	jne	LBB0_11
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%r8d, -64(%rbp)                 ## 4-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	testl	%eax, %eax
	jle	LBB0_14
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_9 Depth=2
	incq	%rbx
	movq	-144(%rbp), %r11                ## 8-byte Reload
	movslq	(%r11), %rax
	addq	$4, %r15
	cmpq	%rax, %rbx
	jge	LBB0_14
LBB0_9:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	32(%r11), %rcx
	movl	%eax, %edx
	imull	-104(%rbp), %edx                ## 4-byte Folded Reload
	movslq	%edx, %rdx
	addq	%rbx, %rdx
	leaq	(%rcx,%rdx,4), %rdi
	imull	-80(%rbp), %eax                 ## 4-byte Folded Reload
	cltq
	addq	%rbx, %rax
	leaq	(%rcx,%rax,4), %rsi
	leaq	(%r15,%r13), %rdx
	callq	_LerpDrawVert
	cmpq	%rbx, -160(%rbp)                ## 8-byte Folded Reload
	jne	LBB0_8
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	(%r13,%rbx,4), %esi
	movl	-100(%rbp), %edi                ## 4-byte Reload
	callq	_VectorCopy
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%r11), %rcx
	movslq	%r8d, %rdx
	movss	(%rcx,%rdx,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movq	-120(%rbp), %rcx                ## 8-byte Reload
	movss	%xmm0, (%rcx,%rdi,4)
	testl	%ebx, %ebx
	jle	LBB0_3
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	32(%r11), %r10
	movl	%ebx, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rsi
	movl	%ebx, %r15d
	cmpl	$8, %ebx
	movq	%r10, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	jb	LBB0_13
## %bb.15:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-128(%rbp), %rcx                ## 8-byte Reload
	imulq	%rdi, %rcx
	addq	-88(%rbp), %rcx                 ## 8-byte Folded Reload
	leaq	(%r10,%rsi,4), %rdx
	subq	%rdx, %rcx
	cmpq	$32, %rcx
	jae	LBB0_17
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=1
	xorl	%edx, %edx
LBB0_25:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%ebx, %r10d
	movl	%r8d, %r9d
	movq	%rdi, %r8
	movq	%rdx, %rcx
	notq	%rcx
	addq	%r15, %rcx
	movq	%r15, %rdi
	andq	$3, %rdi
	je	LBB0_28
## %bb.26:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%rsi,%rbx,4), %rbx
	.p2align	4, 0x90
LBB0_27:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rbx,%rdx,4), %esi
	movl	%esi, (%r14,%rdx,4)
	incq	%rdx
	decq	%rdi
	jne	LBB0_27
LBB0_28:                                ##   in Loop: Header=BB0_5 Depth=1
	cmpq	$3, %rcx
	movq	%r8, %rdi
	movl	%r9d, %r8d
	movl	%r10d, %ebx
	jb	LBB0_3
## %bb.29:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	leaq	(%rcx,%rsi,4), %rcx
	addq	$12, %rcx
	.p2align	4, 0x90
LBB0_30:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	-12(%rcx,%rdx,4), %esi
	movl	%esi, (%r14,%rdx,4)
	movl	-8(%rcx,%rdx,4), %esi
	movl	%esi, 4(%r14,%rdx,4)
	movl	-4(%rcx,%rdx,4), %esi
	movl	%esi, 8(%r14,%rdx,4)
	movl	(%rcx,%rdx,4), %esi
	movl	%esi, 12(%r14,%rdx,4)
	addq	$4, %rdx
	cmpq	%rdx, %r15
	jne	LBB0_30
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_5 Depth=1
	movss	-96(%rbp), %xmm0                ## 4-byte Reload
                                        ## xmm0 = mem[0],zero,zero,zero
	movq	-120(%rbp), %rcx                ## 8-byte Reload
	movq	-136(%rbp), %rdx                ## 8-byte Reload
	movss	%xmm0, (%rcx,%rdx,4)
	movl	%eax, %ebx
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	-64(%rbp), %r8d                 ## 4-byte Reload
	jmp	LBB0_4
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%ebx, -92(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r9
	movl	%r15d, %edx
	andl	$-8, %edx
	leaq	-8(%rdx), %rcx
	movq	%rcx, %rdi
	shrq	$3, %rdi
	incq	%rdi
	movl	%edi, %r11d
	andl	$3, %r11d
	cmpq	$24, %rcx
	jae	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_5 Depth=1
	xorl	%ecx, %ecx
	jmp	LBB0_21
LBB0_19:                                ##   in Loop: Header=BB0_5 Depth=1
	movabsq	$4611686018427387900, %rcx      ## imm = 0x3FFFFFFFFFFFFFFC
	andq	%rcx, %rdi
	leaq	(%r10,%rsi,4), %rbx
	addq	$112, %rbx
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movups	-112(%rbx,%rcx,4), %xmm0
	movups	-96(%rbx,%rcx,4), %xmm1
	movups	%xmm0, -112(%r12,%rcx,4)
	movups	%xmm1, -96(%r12,%rcx,4)
	movups	-80(%rbx,%rcx,4), %xmm0
	movups	-64(%rbx,%rcx,4), %xmm1
	movups	%xmm0, -80(%r12,%rcx,4)
	movups	%xmm1, -64(%r12,%rcx,4)
	movups	-48(%rbx,%rcx,4), %xmm0
	movups	-32(%rbx,%rcx,4), %xmm1
	movups	%xmm0, -48(%r12,%rcx,4)
	movups	%xmm1, -32(%r12,%rcx,4)
	movups	-16(%rbx,%rcx,4), %xmm0
	movups	(%rbx,%rcx,4), %xmm1
	movups	%xmm0, -16(%r12,%rcx,4)
	movups	%xmm1, (%r12,%rcx,4)
	addq	$32, %rcx
	addq	$-4, %rdi
	jne	LBB0_20
LBB0_21:                                ##   in Loop: Header=BB0_5 Depth=1
	testq	%r11, %r11
	je	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_5 Depth=1
	leaq	(%rcx,%rsi), %rdi
	leaq	(%r10,%rdi,4), %rdi
	addq	$16, %rdi
	leaq	(%r14,%rcx,4), %rcx
	shlq	$5, %r11
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_23:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movups	-16(%rdi,%rbx), %xmm0
	movups	(%rdi,%rbx), %xmm1
	movups	%xmm0, (%rcx,%rbx)
	movups	%xmm1, 16(%rcx,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %r11
	jne	LBB0_23
LBB0_24:                                ##   in Loop: Header=BB0_5 Depth=1
	cmpq	%r15, %rdx
	movq	-144(%rbp), %r11                ## 8-byte Reload
	movq	%r9, %rdi
	movl	-92(%rbp), %ebx                 ## 4-byte Reload
	je	LBB0_3
	jmp	LBB0_25
LBB0_31:
	xorl	%ebx, %ebx
	jmp	LBB0_48
LBB0_32:
	testl	%eax, %eax
	movq	-112(%rbp), %r15                ## 8-byte Reload
	jle	LBB0_47
## %bb.33:
	movq	16(%r11), %rcx
	movl	%eax, %r8d
	xorl	%esi, %esi
	cmpl	$8, %eax
	jb	LBB0_43
## %bb.34:
	movq	%r15, %rax
	subq	%rcx, %rax
	cmpq	$32, %rax
	jb	LBB0_43
## %bb.35:
	movl	%r8d, %esi
	andl	$-8, %esi
	leaq	-8(%rsi), %rdx
	movq	%rdx, %rdi
	shrq	$3, %rdi
	incq	%rdi
	movl	%edi, %eax
	andl	$3, %eax
	cmpq	$24, %rdx
	jae	LBB0_37
## %bb.36:
	xorl	%ebx, %ebx
	jmp	LBB0_39
LBB0_37:
	andq	$-4, %rdi
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_38:                                ## =>This Inner Loop Header: Depth=1
	movups	(%rcx,%rbx,4), %xmm0
	movups	16(%rcx,%rbx,4), %xmm1
	movaps	%xmm0, (%r15,%rbx,4)
	movaps	%xmm1, 16(%r15,%rbx,4)
	movups	32(%rcx,%rbx,4), %xmm0
	movups	48(%rcx,%rbx,4), %xmm1
	movaps	%xmm0, 32(%r15,%rbx,4)
	movaps	%xmm1, 48(%r15,%rbx,4)
	movups	64(%rcx,%rbx,4), %xmm0
	movups	80(%rcx,%rbx,4), %xmm1
	movaps	%xmm0, 64(%r15,%rbx,4)
	movaps	%xmm1, 80(%r15,%rbx,4)
	movups	96(%rcx,%rbx,4), %xmm0
	movups	112(%rcx,%rbx,4), %xmm1
	movaps	%xmm0, 96(%r15,%rbx,4)
	movaps	%xmm1, 112(%r15,%rbx,4)
	addq	$32, %rbx
	addq	$-4, %rdi
	jne	LBB0_38
LBB0_39:
	testq	%rax, %rax
	je	LBB0_42
## %bb.40:
	leaq	(%r15,%rbx,4), %rdi
	addq	$16, %rdi
	leaq	(%rcx,%rbx,4), %rbx
	addq	$16, %rbx
	shlq	$5, %rax
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_41:                                ## =>This Inner Loop Header: Depth=1
	movups	-16(%rbx,%rdx), %xmm0
	movups	(%rbx,%rdx), %xmm1
	movaps	%xmm0, -16(%rdi,%rdx)
	movaps	%xmm1, (%rdi,%rdx)
	addq	$32, %rdx
	cmpq	%rdx, %rax
	jne	LBB0_41
LBB0_42:
	cmpq	%r8, %rsi
	je	LBB0_47
LBB0_43:
	movq	%rsi, %rax
	notq	%rax
	addq	%r8, %rax
	movq	%r8, %rdi
	andq	$3, %rdi
	je	LBB0_45
	.p2align	4, 0x90
LBB0_44:                                ## =>This Inner Loop Header: Depth=1
	movss	(%rcx,%rsi,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r15,%rsi,4)
	incq	%rsi
	decq	%rdi
	jne	LBB0_44
LBB0_45:
	cmpq	$3, %rax
	jb	LBB0_47
	.p2align	4, 0x90
LBB0_46:                                ## =>This Inner Loop Header: Depth=1
	movss	(%rcx,%rsi,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r15,%rsi,4)
	movss	4(%rcx,%rsi,4), %xmm0           ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 4(%r15,%rsi,4)
	movss	8(%rcx,%rsi,4), %xmm0           ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 8(%r15,%rsi,4)
	movss	12(%rcx,%rsi,4), %xmm0          ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 12(%r15,%rsi,4)
	addq	$4, %rsi
	cmpq	%rsi, %r8
	jne	LBB0_46
LBB0_47:
	movl	-56(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edi
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %esi
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
	movq	%r11, %rbx
	callq	_MakeMeshNormals
	movl	28(%rbx), %edi
	callq	_VectorCopy
	movss	24(%rbx), %xmm0                 ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -80(%rbp)                ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_R_FreeSurfaceGridMesh
	movl	%r12d, %edi
	movl	%r13d, %esi
	movq	%r14, %rdx
	movq	%r15, %rcx
	callq	_R_CreateSurfaceGridMesh
	movq	%rax, %rbx
	movss	-80(%rbp), %xmm0                ## 4-byte Reload
                                        ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 24(%rax)
	movl	28(%rax), %esi
	callq	_VectorCopy
LBB0_48:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_50
## %bb.49:
	movq	%rbx, %rax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_50:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_GRID_SIZE,4,2              ## @MAX_GRID_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_R_GridInsertRow                ; -- Begin function R_GridInsertRow
	.p2align	2
_R_GridInsertRow:                       ; @R_GridInsertRow
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [sp, #-112]!            ; 16-byte Folded Spill
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset b8, -104
	.cfi_offset b9, -112
	sub	sp, sp, #80
	fmov	s8, s0
	stur	w3, [x29, #-108]                ; 4-byte Folded Spill
	mov	x25, x1
	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, #-104]
Lloh3:
	adrp	x8, _MAX_GRID_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_GRID_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w12, [x8]
	mul	x8, x12, x12
	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	x8, x8, #15
	and	x8, x8, #0xfffffffffffffff0
	sub	x8, x9, x8
	stur	x8, [x29, #-160]                ; 8-byte Folded Spill
	mov	sp, x8
	lsl	x8, x12, #3
	mov	x9, x8
Lloh8:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh9:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x8, x9, x8
	mov	sp, x8
	ldr	w9, [x0, #4]
	cmp	w9, w12
	b.ge	LBB0_21
; %bb.1:
	stur	x8, [x29, #-168]                ; 8-byte Folded Spill
	ldr	w8, [x19]
	add	w24, w9, #1
	stur	w8, [x29, #-172]                ; 4-byte Folded Spill
                                        ; kill: def $w8 killed $w8 def $x8
	tbnz	w9, #31, LBB0_22
; %bb.2:
	mov	x26, #0
	mov	w17, #0
	lsl	x0, x12, #2
	mov	w22, w2
	mov	w1, w25
	mul	x8, x1, x12
	ldur	x27, [x29, #-160]               ; 8-byte Folded Reload
	add	x20, x27, x8, lsl #2
	ldur	x8, [x29, #-168]                ; 8-byte Folded Reload
	add	x2, x8, x0
	sub	w23, w25, #1
	add	x21, x27, #32
	ldur	w9, [x29, #-172]                ; 4-byte Folded Reload
	mov	x8, x9
                                        ; kill: def $w9 killed $w9 def $x9
	stp	x0, x24, [x29, #-136]           ; 16-byte Folded Spill
	stp	x2, x1, [x29, #-152]            ; 16-byte Folded Spill
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldp	x2, x1, [x29, #-152]            ; 16-byte Folded Reload
	str	s8, [x2, x1, lsl #2]
	mov	x9, x8
	ldp	x24, x17, [x29, #-128]          ; 16-byte Folded Reload
	ldur	x0, [x29, #-136]                ; 8-byte Folded Reload
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x26, x26, #1
	add	x21, x21, x0
	add	x27, x27, x0
	cmp	x26, x24
	b.eq	LBB0_22
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_19 Depth 2
                                        ;     Child Loop BB0_16 Depth 2
                                        ;     Child Loop BB0_9 Depth 2
	cmp	x26, x1
	b.ne	LBB0_11
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	stur	x17, [x29, #-120]               ; 8-byte Folded Spill
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x28, #0
	mov	x24, #0
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=2
	add	x24, x24, #1
	ldrsw	x8, [x19]
	add	x28, x28, #4
	cmp	x24, x8
	b.ge	LBB0_3
LBB0_9:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x9, [x19, #32]
	mul	w10, w8, w23
	add	x10, x24, w10, sxtw
	add	x0, x9, x10, lsl #2
	mul	w8, w8, w25
	add	x8, x24, w8, sxtw
	add	x1, x9, x8, lsl #2
	add	x2, x20, x28
	bl	_LerpDrawVert
	cmp	x22, x24
	b.ne	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	ldr	w1, [x20, x24, lsl #2]
	ldur	w0, [x29, #-108]                ; 4-byte Folded Reload
	bl	_VectorCopy
	b	LBB0_8
LBB0_11:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x10, [x19, #8]
	ldr	s0, [x10, w17, sxtw #2]
	str	s0, [x2, x26, lsl #2]
	cmp	w9, #1
	b.lt	LBB0_17
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
	sxtw	x10, w17
	ldr	x11, [x19, #32]
	sxtw	x12, w9
	mul	x12, x12, x10
	mov	w10, w9
	cmp	w9, #16
	b.lo	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	ldur	x13, [x29, #-160]               ; 8-byte Folded Reload
	madd	x13, x0, x26, x13
	add	x14, x11, x12, lsl #2
	sub	x13, x13, x14
	cmp	x13, #64
	b.hs	LBB0_18
LBB0_14:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x13, #0
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x12, x13, x12
	add	x11, x11, x12, lsl #2
	add	x12, x27, x13, lsl #2
	sub	x10, x10, x13
LBB0_16:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w13, [x11], #4
	str	w13, [x12], #4
	subs	x10, x10, #1
	b.ne	LBB0_16
LBB0_17:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w17, w17, #1
	b	LBB0_4
LBB0_18:                                ;   in Loop: Header=BB0_5 Depth=1
	and	x13, x10, #0xfffffff0
	add	x14, x14, #32
	mov	x15, x21
	mov	x16, x13
LBB0_19:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q0, q1, [x14, #-32]
	ldp	q2, q3, [x14], #64
	stp	q0, q1, [x15, #-32]
	stp	q2, q3, [x15], #64
	subs	x16, x16, #16
	b.ne	LBB0_19
; %bb.20:                               ;   in Loop: Header=BB0_5 Depth=1
	cmp	x13, x10
	b.eq	LBB0_17
	b	LBB0_15
LBB0_21:
	mov	x19, #0
	b	LBB0_31
LBB0_22:
	cmp	w8, #1
	ldur	x21, [x29, #-168]               ; 8-byte Folded Reload
	b.lt	LBB0_30
; %bb.23:
	mov	x9, #0
	ldr	x11, [x19, #16]
	mov	w10, w8
	cmp	w8, #16
	b.lo	LBB0_28
; %bb.24:
	sub	x8, x21, x11
	cmp	x8, #64
	b.lo	LBB0_28
; %bb.25:
	and	x9, x10, #0xfffffff0
	add	x8, x21, #32
	add	x12, x11, #32
	mov	x13, x9
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x12, #-32]
	ldp	q2, q3, [x12], #64
	stp	q0, q1, [x8, #-32]
	stp	q2, q3, [x8], #64
	subs	x13, x13, #16
	b.ne	LBB0_26
; %bb.27:
	cmp	x9, x10
	b.eq	LBB0_30
LBB0_28:
	lsl	x12, x9, #2
	add	x8, x21, x12
	add	x11, x11, x12
	sub	x9, x10, x9
LBB0_29:                                ; =>This Inner Loop Header: Depth=1
	ldr	s0, [x11], #4
	str	s0, [x8], #4
	subs	x9, x9, #1
	b.ne	LBB0_29
LBB0_30:
	ldur	w22, [x29, #-172]               ; 4-byte Folded Reload
	mov	x0, x22
	mov	x1, x24
	ldur	x20, [x29, #-160]               ; 8-byte Folded Reload
	mov	x2, x20
	bl	_MakeMeshNormals
	ldr	w0, [x19, #28]
	bl	_VectorCopy
	ldr	s8, [x19, #24]
	mov	x0, x19
	bl	_R_FreeSurfaceGridMesh
	mov	x0, x22
	mov	x1, x24
	mov	x2, x20
	mov	x3, x21
	bl	_R_CreateSurfaceGridMesh
	mov	x19, x0
	str	s8, [x0, #24]
	ldr	w1, [x0, #28]
	bl	_VectorCopy
LBB0_31:
	ldur	x8, [x29, #-104]
Lloh10:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh11:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_33
; %bb.32:
	mov	x0, x19
	sub	sp, x29, #96
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #112              ; 16-byte Folded Reload
	ret
LBB0_33:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_GRID_SIZE,4,2              ; @MAX_GRID_SIZE
.subsections_via_symbols
