	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_calc_grid                      ## -- Begin function calc_grid
	.p2align	4, 0x90
_calc_grid:                             ## @calc_grid
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_dt@GOTPCREL(%rip), %rax
	movsd	(%rax), %xmm0                   ## xmm0 = mem[0],zero
	movq	_ANIMATION_SPEED@GOTPCREL(%rip), %rax
	mulsd	(%rax), %xmm0
	movq	_GRIDW@GOTPCREL(%rip), %rax
	movl	(%rax), %r11d
	movq	_GRIDH@GOTPCREL(%rip), %rax
	movl	(%rax), %r10d
	testl	%r11d, %r11d
	jle	LBB0_4
## %bb.1:
	movq	_p@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	_ax@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movl	%r10d, %r9d
	andl	$-4, %r9d
	leaq	-4(%r9), %r8
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	shrq	$2, %r8
	incq	%r8
	movq	%r8, %rax
	andq	$-2, %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movl	%r10d, %r12d
	andl	$3, %r12d
	xorl	%edi, %edi
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%r11, %rdi
	je	LBB0_4
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_25 Depth 2
                                        ##     Child Loop BB0_31 Depth 2
                                        ##     Child Loop BB0_33 Depth 2
	movq	%rdi, %rax
	incq	%rdi
	testl	%r10d, %r10d
	jle	LBB0_3
## %bb.18:                              ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%r11, %rdi
	movl	%edi, %ecx
	movl	$0, %edx
	cmoveq	%rdx, %rcx
	movq	(%r13,%rax,8), %rsi
	movq	(%r13,%rcx,8), %rbx
	movq	(%r15,%rax,8), %rdx
	movl	$0, %r14d
	cmpl	$4, %r10d
	jae	LBB0_19
LBB0_29:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rax
	notq	%rax
	addq	%r10, %rax
	testq	%r12, %r12
	je	LBB0_32
## %bb.30:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %rcx
	.p2align	4, 0x90
LBB0_31:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsd	(%rsi,%r14,8), %xmm1            ## xmm1 = mem[0],zero
	subsd	(%rbx,%r14,8), %xmm1
	movsd	%xmm1, (%rdx,%r14,8)
	incq	%r14
	decq	%rcx
	jne	LBB0_31
LBB0_32:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpq	$3, %rax
	jb	LBB0_3
	.p2align	4, 0x90
LBB0_33:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsd	(%rsi,%r14,8), %xmm1            ## xmm1 = mem[0],zero
	subsd	(%rbx,%r14,8), %xmm1
	movsd	%xmm1, (%rdx,%r14,8)
	movsd	8(%rsi,%r14,8), %xmm1           ## xmm1 = mem[0],zero
	subsd	8(%rbx,%r14,8), %xmm1
	movsd	%xmm1, 8(%rdx,%r14,8)
	movsd	16(%rsi,%r14,8), %xmm1          ## xmm1 = mem[0],zero
	subsd	16(%rbx,%r14,8), %xmm1
	movsd	%xmm1, 16(%rdx,%r14,8)
	movsd	24(%rsi,%r14,8), %xmm1          ## xmm1 = mem[0],zero
	subsd	24(%rbx,%r14,8), %xmm1
	movsd	%xmm1, 24(%rdx,%r14,8)
	addq	$4, %r14
	cmpq	%r14, %r10
	jne	LBB0_33
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%rdx, %rax
	subq	%rsi, %rax
	cmpq	$32, %rax
	jb	LBB0_20
## %bb.21:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%rdx, %rax
	subq	%rbx, %rax
	movl	$0, %r14d
	cmpq	$32, %rax
	jb	LBB0_29
## %bb.22:                              ##   in Loop: Header=BB0_2 Depth=1
	cmpq	$0, -72(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_23
## %bb.24:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_25:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movupd	(%rsi,%rax,8), %xmm1
	movupd	16(%rsi,%rax,8), %xmm2
	movupd	(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm1
	movupd	16(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm2
	movupd	%xmm1, (%rdx,%rax,8)
	movupd	%xmm2, 16(%rdx,%rax,8)
	movupd	32(%rsi,%rax,8), %xmm1
	movupd	48(%rsi,%rax,8), %xmm2
	movupd	32(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm1
	movupd	48(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm2
	movupd	%xmm1, 32(%rdx,%rax,8)
	movupd	%xmm2, 48(%rdx,%rax,8)
	addq	$8, %rax
	addq	$-2, %rcx
	jne	LBB0_25
## %bb.26:                              ##   in Loop: Header=BB0_2 Depth=1
	testb	$1, %r8b
	je	LBB0_28
LBB0_27:                                ##   in Loop: Header=BB0_2 Depth=1
	movupd	(%rsi,%rax,8), %xmm1
	movupd	16(%rsi,%rax,8), %xmm2
	movupd	(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm1
	movupd	16(%rbx,%rax,8), %xmm3
	subpd	%xmm3, %xmm2
	movupd	%xmm1, (%rdx,%rax,8)
	movupd	%xmm2, 16(%rdx,%rax,8)
LBB0_28:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r9, %r14
	cmpq	%r10, %r9
	je	LBB0_3
	jmp	LBB0_29
LBB0_20:                                ##   in Loop: Header=BB0_2 Depth=1
	xorl	%r14d, %r14d
	jmp	LBB0_29
LBB0_23:                                ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	testb	$1, %r8b
	jne	LBB0_27
	jmp	LBB0_28
LBB0_4:
	testl	%r10d, %r10d
	movq	%r11, -72(%rbp)                 ## 8-byte Spill
	jle	LBB0_13
## %bb.5:
	movq	_p@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_ay@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	movl	%r11d, %r14d
	andl	$-2, %r14d
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpq	%r10, %r9
	je	LBB0_13
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	movq	%r9, %rbx
	incq	%r9
	testl	%r11d, %r11d
	jle	LBB0_12
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpq	%r10, %r9
	movl	%r9d, %ecx
	cmoveq	%r8, %rcx
	movl	$0, %edi
	cmpl	$1, %r11d
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rax,%rdi,8), %rsi
	movsd	(%rsi,%rbx,8), %xmm1            ## xmm1 = mem[0],zero
	subsd	(%rsi,%rcx,8), %xmm1
	movq	(%rdx,%rdi,8), %rsi
	movsd	%xmm1, (%rsi,%rbx,8)
	movq	8(%rax,%rdi,8), %rsi
	movsd	(%rsi,%rbx,8), %xmm1            ## xmm1 = mem[0],zero
	subsd	(%rsi,%rcx,8), %xmm1
	movq	8(%rdx,%rdi,8), %rsi
	movsd	%xmm1, (%rsi,%rbx,8)
	addq	$2, %rdi
	cmpq	%rdi, %r14
	jne	LBB0_9
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	testb	$1, %r11b
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	(%rax,%rdi,8), %r11
	movsd	(%r11,%rbx,8), %xmm1            ## xmm1 = mem[0],zero
	subsd	(%r11,%rcx,8), %xmm1
	movq	-72(%rbp), %r11                 ## 8-byte Reload
	movq	(%rdx,%rdi,8), %rcx
	movsd	%xmm1, (%rcx,%rbx,8)
	jmp	LBB0_12
LBB0_13:
	testl	%r11d, %r11d
	jle	LBB0_68
## %bb.14:
	movq	_vx@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	_ax@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_vy@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	_ay@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movl	%r10d, %eax
	andl	$-2, %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	addq	$-2, %rax
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	movq	%rax, %rcx
	shrq	%rcx
	incq	%rcx
	movddup	%xmm0, %xmm1                    ## xmm1 = xmm0[0,0]
	movq	%rcx, %rax
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	andq	$-2, %rcx
	movq	%rcx, -128(%rbp)                ## 8-byte Spill
	movq	%r10, %rax
	negq	%rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%edx, %edx
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_54:                                ##   in Loop: Header=BB0_15 Depth=1
	incq	%rdx
	cmpq	%r11, %rdx
	je	LBB0_55
LBB0_15:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_46 Depth 2
                                        ##     Child Loop BB0_53 Depth 2
	testl	%r10d, %r10d
	jle	LBB0_54
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	(%rsi,%rdx,8), %r8
	movq	(%rdi,%rdx,8), %r9
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax,%rdx,8), %r15
	movq	(%rbx,%rdx,8), %r14
	cmpl	$1, %r10d
	jne	LBB0_34
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	xorl	%ecx, %ecx
LBB0_50:                                ##   in Loop: Header=BB0_15 Depth=1
	movq	%rcx, %rax
	testb	$1, %r10b
	je	LBB0_52
## %bb.51:                              ##   in Loop: Header=BB0_15 Depth=1
	movsd	(%r9,%rcx,8), %xmm2             ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	(%r8,%rcx,8), %xmm2
	movsd	%xmm2, (%r8,%rcx,8)
	movsd	(%r14,%rcx,8), %xmm2            ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	(%r15,%rcx,8), %xmm2
	movsd	%xmm2, (%r15,%rcx,8)
	movq	%rcx, %rax
	orq	$1, %rax
LBB0_52:                                ##   in Loop: Header=BB0_15 Depth=1
	notq	%rcx
	cmpq	-80(%rbp), %rcx                 ## 8-byte Folded Reload
	je	LBB0_54
	.p2align	4, 0x90
LBB0_53:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsd	(%r9,%rax,8), %xmm2             ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	(%r8,%rax,8), %xmm2
	movsd	%xmm2, (%r8,%rax,8)
	movsd	(%r14,%rax,8), %xmm2            ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	(%r15,%rax,8), %xmm2
	movsd	%xmm2, (%r15,%rax,8)
	movsd	8(%r9,%rax,8), %xmm2            ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	8(%r8,%rax,8), %xmm2
	movsd	%xmm2, 8(%r8,%rax,8)
	movsd	8(%r14,%rax,8), %xmm2           ## xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	addsd	8(%r15,%rax,8), %xmm2
	movsd	%xmm2, 8(%r15,%rax,8)
	addq	$2, %rax
	cmpq	%rax, %r10
	jne	LBB0_53
	jmp	LBB0_54
	.p2align	4, 0x90
LBB0_34:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%r8,%r10,8), %rax
	leaq	(%r15,%r10,8), %rsi
	leaq	(%r9,%r10,8), %rdi
	leaq	(%r14,%r10,8), %rbx
	cmpq	%rsi, %r8
	setb	-120(%rbp)                      ## 1-byte Folded Spill
	cmpq	%rax, %r15
	setb	%r11b
	cmpq	%rdi, %r8
	setb	%cl
	cmpq	%rax, %r9
	setb	-112(%rbp)                      ## 1-byte Folded Spill
	cmpq	%rbx, %r8
	setb	%r13b
	cmpq	%rax, %r14
	setb	-104(%rbp)                      ## 1-byte Folded Spill
	cmpq	%rdi, %r15
	setb	%al
	cmpq	%rsi, %r9
	setb	%dil
	cmpq	%rbx, %r15
	setb	%r12b
	cmpq	%rsi, %r14
	setb	%sil
	testb	%r11b, -120(%rbp)               ## 1-byte Folded Reload
	jne	LBB0_35
## %bb.36:                              ##   in Loop: Header=BB0_15 Depth=1
	andb	-112(%rbp), %cl                 ## 1-byte Folded Reload
	movq	-72(%rbp), %r11                 ## 8-byte Reload
	jne	LBB0_37
## %bb.39:                              ##   in Loop: Header=BB0_15 Depth=1
	andb	-104(%rbp), %r13b               ## 1-byte Folded Reload
	jne	LBB0_37
## %bb.40:                              ##   in Loop: Header=BB0_15 Depth=1
	andb	%dil, %al
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_41
## %bb.42:                              ##   in Loop: Header=BB0_15 Depth=1
	movl	$0, %ecx
	andb	%sil, %r12b
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jne	LBB0_50
## %bb.43:                              ##   in Loop: Header=BB0_15 Depth=1
	cmpq	$0, -144(%rbp)                  ## 8-byte Folded Reload
	je	LBB0_44
## %bb.45:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	-128(%rbp), %rax                ## 8-byte Reload
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_46:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movupd	(%r8,%r12,8), %xmm2
	movupd	(%r9,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, (%r8,%r12,8)
	movupd	(%r15,%r12,8), %xmm2
	movupd	(%r14,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, (%r15,%r12,8)
	movupd	16(%r8,%r12,8), %xmm2
	movupd	16(%r9,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, 16(%r8,%r12,8)
	movupd	16(%r15,%r12,8), %xmm2
	movupd	16(%r14,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, 16(%r15,%r12,8)
	addq	$4, %r12
	addq	$-2, %rax
	jne	LBB0_46
## %bb.47:                              ##   in Loop: Header=BB0_15 Depth=1
	testb	$1, -136(%rbp)                  ## 1-byte Folded Reload
	je	LBB0_49
LBB0_48:                                ##   in Loop: Header=BB0_15 Depth=1
	movupd	(%r8,%r12,8), %xmm2
	movupd	(%r9,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, (%r8,%r12,8)
	movupd	(%r15,%r12,8), %xmm2
	movupd	(%r14,%r12,8), %xmm3
	mulpd	%xmm1, %xmm3
	addpd	%xmm2, %xmm3
	movupd	%xmm3, (%r15,%r12,8)
LBB0_49:                                ##   in Loop: Header=BB0_15 Depth=1
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, %rcx
	cmpq	%r10, %rax
	je	LBB0_54
	jmp	LBB0_50
LBB0_44:                                ##   in Loop: Header=BB0_15 Depth=1
	xorl	%r12d, %r12d
	testb	$1, -136(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_48
	jmp	LBB0_49
LBB0_41:                                ##   in Loop: Header=BB0_15 Depth=1
	xorl	%ecx, %ecx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_50
LBB0_37:                                ##   in Loop: Header=BB0_15 Depth=1
	xorl	%ecx, %ecx
	jmp	LBB0_38
LBB0_35:                                ##   in Loop: Header=BB0_15 Depth=1
	xorl	%ecx, %ecx
	movq	-72(%rbp), %r11                 ## 8-byte Reload
LBB0_38:                                ##   in Loop: Header=BB0_15 Depth=1
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_50
LBB0_55:
	cmpl	$2, %r11d
	jl	LBB0_68
## %bb.56:
	movq	_p@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	_vx@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_vy@GOTPCREL(%rip), %rax
	movq	(%rax), %r9
	leaq	-1(%r10), %r14
	movq	%r14, %r12
	andq	$-4, %r12
	leaq	1(%r12), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movl	$1, %r13d
	movq	%r8, -80(%rbp)                  ## 8-byte Spill
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%r9, -56(%rbp)                  ## 8-byte Spill
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_57
	.p2align	4, 0x90
LBB0_67:                                ##   in Loop: Header=BB0_57 Depth=1
	incq	%r13
	cmpq	%r11, %r13
	je	LBB0_68
LBB0_57:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_64 Depth 2
                                        ##     Child Loop BB0_66 Depth 2
	cmpl	$2, %r10d
	jl	LBB0_67
## %bb.58:                              ##   in Loop: Header=BB0_57 Depth=1
	movq	(%r8,%r13,8), %rdx
	movq	-8(%rcx,%r13,8), %rsi
	movq	(%rcx,%r13,8), %rax
	movq	(%r9,%r13,8), %rbx
	movl	$1, %edi
	cmpq	$4, %r14
	jae	LBB0_59
	.p2align	4, 0x90
LBB0_66:                                ##   Parent Loop BB0_57 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsd	(%rsi,%rdi,8), %xmm2            ## xmm2 = mem[0],zero
	subsd	(%rax,%rdi,8), %xmm2
	addsd	-8(%rbx,%rdi,8), %xmm2
	subsd	(%rbx,%rdi,8), %xmm2
	mulsd	%xmm0, %xmm2
	addsd	(%rdx,%rdi,8), %xmm2
	movsd	%xmm2, (%rdx,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %r10
	jne	LBB0_66
	jmp	LBB0_67
	.p2align	4, 0x90
LBB0_59:                                ##   in Loop: Header=BB0_57 Depth=1
	leaq	8(%rdx), %r8
	leaq	(%rdx,%r10,8), %r11
	leaq	8(%rsi), %rcx
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	leaq	(%rsi,%r10,8), %r9
	leaq	8(%rax), %rcx
	movq	%rcx, -112(%rbp)                ## 8-byte Spill
	leaq	(%rax,%r10,8), %r15
	leaq	(%rbx,%r10,8), %r14
	movq	%r14, -120(%rbp)                ## 8-byte Spill
	cmpq	%r9, %r8
	setb	-88(%rbp)                       ## 1-byte Folded Spill
	cmpq	%r11, -104(%rbp)                ## 8-byte Folded Reload
	setb	%cl
	cmpq	%r15, %r8
	setb	%r15b
	cmpq	%r11, -112(%rbp)                ## 8-byte Folded Reload
	setb	%r14b
	cmpq	-120(%rbp), %r8                 ## 8-byte Folded Reload
	setb	%r9b
	cmpq	%r11, %rbx
	setb	%r11b
	testb	%cl, -88(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_60
## %bb.61:                              ##   in Loop: Header=BB0_57 Depth=1
	andb	%r14b, %r15b
	jne	LBB0_60
## %bb.62:                              ##   in Loop: Header=BB0_57 Depth=1
	andb	%r11b, %r9b
	movq	-72(%rbp), %r11                 ## 8-byte Reload
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jne	LBB0_66
## %bb.63:                              ##   in Loop: Header=BB0_57 Depth=1
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_64:                                ##   Parent Loop BB0_57 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movupd	8(%rdx,%rdi,8), %xmm2
	movupd	24(%rdx,%rdi,8), %xmm3
	movupd	8(%rsi,%rdi,8), %xmm4
	movupd	24(%rsi,%rdi,8), %xmm5
	movupd	8(%rax,%rdi,8), %xmm6
	subpd	%xmm6, %xmm4
	movupd	24(%rax,%rdi,8), %xmm6
	subpd	%xmm6, %xmm5
	movupd	(%rbx,%rdi,8), %xmm6
	addpd	%xmm4, %xmm6
	movupd	8(%rbx,%rdi,8), %xmm4
	subpd	%xmm4, %xmm6
	movupd	16(%rbx,%rdi,8), %xmm4
	addpd	%xmm5, %xmm4
	movupd	24(%rbx,%rdi,8), %xmm5
	subpd	%xmm5, %xmm4
	mulpd	%xmm1, %xmm6
	addpd	%xmm2, %xmm6
	mulpd	%xmm1, %xmm4
	addpd	%xmm3, %xmm4
	movupd	%xmm6, 8(%rdx,%rdi,8)
	movupd	%xmm4, 24(%rdx,%rdi,8)
	addq	$4, %rdi
	cmpq	%rdi, %r12
	jne	LBB0_64
## %bb.65:                              ##   in Loop: Header=BB0_57 Depth=1
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	cmpq	%r12, %r14
	jne	LBB0_66
	jmp	LBB0_67
LBB0_60:                                ##   in Loop: Header=BB0_57 Depth=1
	movq	-72(%rbp), %r11                 ## 8-byte Reload
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_66
LBB0_68:
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_dt,8,3                         ## @dt
	.comm	_ANIMATION_SPEED,8,3            ## @ANIMATION_SPEED
	.comm	_GRIDW,4,2                      ## @GRIDW
	.comm	_GRIDH,4,2                      ## @GRIDH
	.comm	_p,8,3                          ## @p
	.comm	_ax,8,3                         ## @ax
	.comm	_ay,8,3                         ## @ay
	.comm	_vx,8,3                         ## @vx
	.comm	_vy,8,3                         ## @vy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_calc_grid                      ; -- Begin function calc_grid
	.p2align	2
_calc_grid:                             ; @calc_grid
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	.cfi_offset w19, -8
	.cfi_offset w20, -16
	.cfi_offset w21, -24
	.cfi_offset w22, -32
Lloh0:
	adrp	x8, _dt@GOTPAGE
Lloh1:
	ldr	x8, [x8, _dt@GOTPAGEOFF]
Lloh2:
	ldr	d0, [x8]
Lloh3:
	adrp	x8, _ANIMATION_SPEED@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ANIMATION_SPEED@GOTPAGEOFF]
Lloh5:
	ldr	d1, [x8]
Lloh6:
	adrp	x8, _GRIDW@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GRIDW@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _GRIDH@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GRIDH@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _ax@GOTPAGE
Lloh13:
	ldr	x10, [x10, _ax@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.1:
	mov	x15, #0
Lloh14:
	adrp	x11, _p@GOTPAGE
Lloh15:
	ldr	x11, [x11, _p@GOTPAGEOFF]
Lloh16:
	ldr	x11, [x11]
	ldr	x12, [x10]
	and	x13, x9, #0xfffffff8
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x15, x14
	cmp	x14, x8
	b.eq	LBB0_12
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;     Child Loop BB0_11 Depth 2
	add	x14, x15, #1
	cmp	w9, #1
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, #0
	lsl	x17, x15, #3
	ldr	x15, [x11, x17]
	and	x16, x14, #0xffffffff
	cmp	x14, x8
	csel	x16, xzr, x16, eq
	ldr	x16, [x11, x16, lsl #3]
	ldr	x17, [x12, x17]
	cmp	w9, #8
	b.lo	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, #0
	sub	x1, x17, x15
	cmp	x1, #64
	b.lo	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	sub	x1, x17, x16
	cmp	x1, #64
	b.lo	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x0, x17, #32
	add	x1, x15, #32
	add	x2, x16, #32
	mov	x3, x13
LBB0_8:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q2, q3, [x1, #-32]
	ldp	q4, q5, [x1], #64
	ldp	q6, q7, [x2, #-32]
	ldp	q16, q17, [x2], #64
	fsub.2d	v2, v2, v6
	fsub.2d	v3, v3, v7
	fsub.2d	v4, v4, v16
	fsub.2d	v5, v5, v17
	stp	q2, q3, [x0, #-32]
	stp	q4, q5, [x0], #64
	subs	x3, x3, #8
	b.ne	LBB0_8
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x13
	cmp	x13, x9
	b.eq	LBB0_2
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	lsl	x1, x0, #3
	add	x17, x17, x1
	add	x16, x16, x1
	add	x15, x15, x1
	sub	x0, x9, x0
LBB0_11:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	d2, [x15], #8
	ldr	d3, [x16], #8
	fsub	d2, d2, d3
	str	d2, [x17], #8
	subs	x0, x0, #1
	b.ne	LBB0_11
	b	LBB0_2
LBB0_12:
Lloh17:
	adrp	x17, _ay@GOTPAGE
Lloh18:
	ldr	x17, [x17, _ay@GOTPAGEOFF]
	cmp	w9, #1
	b.lt	LBB0_18
; %bb.13:
	mov	x12, #0
Lloh19:
	adrp	x11, _p@GOTPAGE
Lloh20:
	ldr	x11, [x11, _p@GOTPAGEOFF]
Lloh21:
	ldr	x11, [x11]
	ldr	x13, [x17]
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	mov	x12, x14
	cmp	x14, x9
	b.eq	LBB0_18
LBB0_15:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
	add	x14, x12, #1
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	and	x15, x14, #0xffffffff
	cmp	x14, x9
	csel	x15, xzr, x15, eq
	mov	x16, x8
	mov	x0, x11
	mov	x1, x13
LBB0_17:                                ;   Parent Loop BB0_15 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x2, [x0], #8
	lsl	x3, x12, #3
	ldr	d2, [x2, x3]
	ldr	d3, [x2, x15, lsl #3]
	fsub	d2, d2, d3
	ldr	x2, [x1], #8
	str	d2, [x2, x3]
	subs	x16, x16, #1
	b.ne	LBB0_17
	b	LBB0_14
LBB0_18:
	cmp	w8, #1
	b.lt	LBB0_48
; %bb.19:
	mov	x12, #0
	fmul	d0, d0, d1
Lloh22:
	adrp	x11, _vx@GOTPAGE
Lloh23:
	ldr	x11, [x11, _vx@GOTPAGEOFF]
	ldr	x14, [x11]
	ldr	x15, [x10]
Lloh24:
	adrp	x13, _vy@GOTPAGE
Lloh25:
	ldr	x13, [x13, _vy@GOTPAGEOFF]
	ldr	x16, [x13]
	ldr	x17, [x17]
	and	x0, x9, #0xfffffffc
	dup.2d	v1, v0[0]
	lsl	x10, x9, #3
	b	LBB0_21
LBB0_20:                                ;   in Loop: Header=BB0_21 Depth=1
	add	x12, x12, #1
	cmp	x12, x8
	b.eq	LBB0_34
LBB0_21:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_30 Depth 2
                                        ;     Child Loop BB0_33 Depth 2
	cmp	w9, #1
	b.lt	LBB0_20
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	lsl	x4, x12, #3
	ldr	x1, [x14, x4]
	ldr	x2, [x15, x4]
	ldr	x3, [x16, x4]
	ldr	x4, [x17, x4]
	cmp	w9, #4
	b.hs	LBB0_24
; %bb.23:                               ;   in Loop: Header=BB0_21 Depth=1
	mov	x5, #0
	b	LBB0_32
LBB0_24:                                ;   in Loop: Header=BB0_21 Depth=1
	mov	x5, #0
	add	x21, x1, x10
	add	x22, x3, x10
	add	x19, x2, x10
	cmp	x1, x19
	ccmp	x2, x21, #2, lo
	cset	w6, lo
	add	x20, x4, x10
	cmp	x1, x20
	ccmp	x4, x21, #2, lo
	cset	w7, lo
	cmp	x3, x19
	ccmp	x2, x22, #2, lo
	cset	w19, lo
	cmp	x3, x20
	ccmp	x4, x22, #2, lo
	cset	w20, lo
	cmp	x3, x21
	ccmp	x1, x22, #2, lo
	b.lo	LBB0_32
; %bb.25:                               ;   in Loop: Header=BB0_21 Depth=1
	tbnz	w6, #0, LBB0_32
; %bb.26:                               ;   in Loop: Header=BB0_21 Depth=1
	tbnz	w7, #0, LBB0_32
; %bb.27:                               ;   in Loop: Header=BB0_21 Depth=1
	tbnz	w19, #0, LBB0_32
; %bb.28:                               ;   in Loop: Header=BB0_21 Depth=1
	tbnz	w20, #0, LBB0_32
; %bb.29:                               ;   in Loop: Header=BB0_21 Depth=1
	add	x5, x1, #16
	add	x6, x4, #16
	add	x7, x2, #16
	add	x19, x3, #16
	mov	x20, x0
LBB0_30:                                ;   Parent Loop BB0_21 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q2, q3, [x5, #-16]
	ldp	q4, q5, [x7, #-16]
	fmla.2d	v2, v1, v4
	fmla.2d	v3, v1, v5
	stp	q2, q3, [x5, #-16]
	ldp	q2, q3, [x19, #-16]
	ldp	q4, q5, [x6, #-16]
	fmla.2d	v2, v1, v4
	fmla.2d	v3, v1, v5
	add	x5, x5, #32
	stp	q2, q3, [x19, #-16]
	add	x6, x6, #32
	add	x7, x7, #32
	add	x19, x19, #32
	subs	x20, x20, #4
	b.ne	LBB0_30
; %bb.31:                               ;   in Loop: Header=BB0_21 Depth=1
	mov	x5, x0
	cmp	x0, x9
	b.eq	LBB0_20
LBB0_32:                                ;   in Loop: Header=BB0_21 Depth=1
	lsl	x6, x5, #3
	add	x4, x4, x6
	add	x3, x3, x6
	add	x2, x2, x6
	add	x1, x1, x6
	sub	x5, x9, x5
LBB0_33:                                ;   Parent Loop BB0_21 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	d2, [x1]
	ldr	d3, [x2], #8
	fmadd	d2, d3, d0, d2
	str	d2, [x1], #8
	ldr	d2, [x3]
	ldr	d3, [x4], #8
	fmadd	d2, d3, d0, d2
	str	d2, [x3], #8
	subs	x5, x5, #1
	b.ne	LBB0_33
	b	LBB0_20
LBB0_34:
	cmp	w8, #2
	b.lt	LBB0_48
; %bb.35:
Lloh26:
	adrp	x12, _p@GOTPAGE
Lloh27:
	ldr	x12, [x12, _p@GOTPAGEOFF]
Lloh28:
	ldr	x12, [x12]
	ldr	x11, [x11]
	ldr	x13, [x13]
	sub	x14, x9, #1
	and	x15, x14, #0xfffffffffffffff8
	orr	x16, x15, #0x1
	dup.2d	v1, v0[0]
	mov	w17, #1
	b	LBB0_37
LBB0_36:                                ;   in Loop: Header=BB0_37 Depth=1
	add	x17, x17, #1
	cmp	x17, x8
	b.eq	LBB0_48
LBB0_37:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_46 Depth 2
                                        ;     Child Loop BB0_41 Depth 2
	cmp	w9, #2
	b.lt	LBB0_36
; %bb.38:                               ;   in Loop: Header=BB0_37 Depth=1
	lsl	x3, x17, #3
	ldr	x0, [x12, x3]
	add	x2, x11, x3
	ldp	x1, x2, [x2, #-8]
	ldr	x3, [x13, x3]
	cmp	x14, #8
	b.hs	LBB0_42
LBB0_39:                                ;   in Loop: Header=BB0_37 Depth=1
	mov	w5, #1
LBB0_40:                                ;   in Loop: Header=BB0_37 Depth=1
	sub	x4, x9, x5
	lsl	x5, x5, #3
	add	x3, x3, x5
	add	x2, x2, x5
	add	x1, x1, x5
	add	x0, x0, x5
LBB0_41:                                ;   Parent Loop BB0_37 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	d2, [x0]
	ldr	d3, [x1], #8
	ldr	d4, [x2], #8
	fsub	d3, d3, d4
	ldur	d4, [x3, #-8]
	fadd	d3, d3, d4
	ldr	d4, [x3], #8
	fsub	d3, d3, d4
	fmadd	d2, d3, d0, d2
	str	d2, [x0], #8
	subs	x4, x4, #1
	b.ne	LBB0_41
	b	LBB0_36
LBB0_42:                                ;   in Loop: Header=BB0_37 Depth=1
	add	x5, x0, #8
	add	x7, x1, #8
	add	x19, x0, x10
	add	x20, x1, x10
	add	x4, x2, #8
	add	x6, x2, x10
	cmp	x5, x6
	ccmp	x4, x19, #2, lo
	cset	w4, lo
	add	x6, x3, x10
	cmp	x5, x6
	ccmp	x3, x19, #2, lo
	cset	w6, lo
	cmp	x7, x19
	ccmp	x5, x20, #2, lo
	b.lo	LBB0_39
; %bb.43:                               ;   in Loop: Header=BB0_37 Depth=1
	mov	w5, #1
	tbnz	w4, #0, LBB0_40
; %bb.44:                               ;   in Loop: Header=BB0_37 Depth=1
	tbnz	w6, #0, LBB0_40
; %bb.45:                               ;   in Loop: Header=BB0_37 Depth=1
	add	x4, x2, #40
	add	x5, x3, #32
	add	x6, x1, #40
	add	x7, x0, #40
	mov	x19, x15
LBB0_46:                                ;   Parent Loop BB0_37 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q2, q3, [x7, #-32]
	ldp	q4, q5, [x7]
	ldp	q6, q7, [x6, #-32]
	ldp	q16, q17, [x6], #64
	ldp	q18, q19, [x4, #-32]
	ldp	q20, q21, [x4], #64
	fsub.2d	v6, v6, v18
	fsub.2d	v7, v7, v19
	fsub.2d	v16, v16, v20
	fsub.2d	v17, v17, v21
	ldp	q18, q19, [x5, #-32]
	ldp	q20, q21, [x5]
	fadd.2d	v6, v6, v18
	fadd.2d	v7, v7, v19
	fadd.2d	v16, v16, v20
	fadd.2d	v17, v17, v21
	ldur	q18, [x5, #-24]
	ldur	q19, [x5, #-8]
	ldur	q20, [x5, #8]
	ldur	q21, [x5, #24]
	fsub.2d	v6, v6, v18
	fsub.2d	v7, v7, v19
	fsub.2d	v16, v16, v20
	fsub.2d	v17, v17, v21
	fmla.2d	v2, v1, v6
	fmla.2d	v3, v1, v7
	fmla.2d	v4, v1, v16
	fmla.2d	v5, v1, v17
	stp	q2, q3, [x7, #-32]
	stp	q4, q5, [x7], #64
	add	x5, x5, #64
	subs	x19, x19, #8
	b.ne	LBB0_46
; %bb.47:                               ;   in Loop: Header=BB0_37 Depth=1
	mov	x5, x16
	cmp	x14, x15
	b.eq	LBB0_36
	b	LBB0_40
LBB0_48:
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_dt,8,3                         ; @dt
	.comm	_ANIMATION_SPEED,8,3            ; @ANIMATION_SPEED
	.comm	_GRIDW,4,2                      ; @GRIDW
	.comm	_GRIDH,4,2                      ; @GRIDH
	.comm	_p,8,3                          ; @p
	.comm	_ax,8,3                         ; @ax
	.comm	_ay,8,3                         ; @ay
	.comm	_vx,8,3                         ; @vx
	.comm	_vy,8,3                         ; @vy
.subsections_via_symbols
