	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_overlay_mask             ## -- Begin function write_overlay_mask
	.p2align	4, 0x90
_write_overlay_mask:                    ## @write_overlay_mask
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %r12
	movq	_BUZ_MAX_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	leal	31(%r13), %eax
	addl	$62, %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	sarl	$5, %r13d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rdi
	movq	_BUZ_MAX_HEIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	imull	%r13d, %edx
	shll	$2, %edx
	movl	$-1, %esi
	callq	_memset
	testl	%r15d, %r15d
	je	LBB0_10
## %bb.1:
	movl	%r15d, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%r9d, %r9d
	pxor	%xmm1, %xmm1
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r9
	cmpq	-56(%rbp), %r9                  ## 8-byte Folded Reload
	je	LBB0_10
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##       Child Loop BB0_7 Depth 3
	movq	%r9, %rax
	shlq	$4, %rax
	movq	(%r12,%rax), %xmm2              ## xmm2 = mem[0],zero
	movq	8(%r12,%rax), %xmm0             ## xmm0 = mem[0],zero
	movdqa	%xmm2, %xmm3
	pmaxsd	%xmm1, %xmm3
	pminsd	%xmm1, %xmm2
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	paddd	%xmm3, %xmm0
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %xmm4                  ## xmm4 = mem[0],zero
	pcmpgtd	%xmm4, %xmm0
	psubd	%xmm3, %xmm4
	blendvps	%xmm0, %xmm4, %xmm2
	movaps	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pmovsxdq	%xmm0, %xmm0
	movmskpd	%xmm0, %eax
	testb	$2, %al
	je	LBB0_9
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	testb	$1, %al
	je	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	extractps	$1, %xmm2, %eax
	testl	%eax, %eax
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %r10
	pextrd	$1, %xmm3, %r11d
	movl	%eax, %r15d
	movd	%xmm3, %edx
	movd	%xmm2, %eax
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_7 Depth 3
	leal	(%r11,%rsi), %ecx
	imull	%r13d, %ecx
	leaq	(%r10,%rcx,4), %rdi
	movl	%edx, %ecx
	movl	%eax, %ebx
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_6 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	$-2, %r8d
	roll	%cl, %r8d
	movl	%ecx, %r14d
	shrl	$5, %r14d
	andl	%r8d, (%rdi,%r14,4)
	incl	%ecx
	decl	%ebx
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=2
	incq	%rsi
	cmpq	%r15, %rsi
	jb	LBB0_6
	jmp	LBB0_9
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BUZ_MAX_WIDTH,4,2              ## @BUZ_MAX_WIDTH
	.comm	_BUZ_MAX_HEIGHT,4,2             ## @BUZ_MAX_HEIGHT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_overlay_mask             ; -- Begin function write_overlay_mask
	.p2align	2
_write_overlay_mask:                    ; @write_overlay_mask
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _BUZ_MAX_WIDTH@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BUZ_MAX_WIDTH@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	add	w9, w8, #31
	add	w8, w8, #62
	cmp	w9, #0
	csel	w8, w8, w9, lt
	asr	w22, w8, #5
	ldr	x0, [x0]
Lloh3:
	adrp	x8, _BUZ_MAX_HEIGHT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BUZ_MAX_HEIGHT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	mul	w8, w22, w8
	lsl	w2, w8, #2
	mov	w1, #-1
	bl	_memset
	cbz	w21, LBB0_10
; %bb.1:
	mov	x8, #0
	mov	w9, w21
	movi.2d	v0, #0000000000000000
	mov	w10, #1
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x8, x8, #1
	cmp	x8, x9
	b.eq	LBB0_10
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;       Child Loop BB0_8 Depth 3
	add	x11, x19, x8, lsl #4
	ldp	d2, d3, [x11]
	smax.2s	v1, v2, v0
	smin.2s	v2, v2, v0
	add.2s	v2, v3, v2
	add.2s	v3, v2, v1
	ldr	d4, [x20, #8]
	cmgt.2s	v3, v3, v4
	sub.2s	v4, v4, v1
	bit.8b	v2, v4, v3
	cmgt.2s	v3, v2, #0
	mov.s	w11, v3[1]
	tbz	w11, #0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	fmov	w11, s3
	tbz	w11, #0, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov.s	w11, v2[1]
	cbz	w11, LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x12, #0
	ldr	x13, [x20]
	mov.s	w14, v1[1]
	fmov	w0, s1
	fmov	w1, s2
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_8 Depth 3
	add	w15, w14, w12
	mul	w15, w15, w22
	add	x15, x13, w15, uxtw #2
	mov	x16, x0
	mov	x17, x1
LBB0_8:                                 ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_7 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	lsr	w2, w16, #5
	lsl	x2, x2, #2
	ldr	w3, [x15, x2]
	lsl	w4, w10, w16
	bic	w3, w3, w4
	str	w3, [x15, x2]
	add	w16, w16, #1
	subs	w17, w17, #1
	b.ne	LBB0_8
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x12, x12, #1
	cmp	x12, x11
	b.lo	LBB0_7
	b	LBB0_2
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_BUZ_MAX_WIDTH,4,2              ; @BUZ_MAX_WIDTH
	.comm	_BUZ_MAX_HEIGHT,4,2             ; @BUZ_MAX_HEIGHT
.subsections_via_symbols
