	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_speed
_calc_speed:                            ## @calc_speed
	.cfi_startproc
## %bb.0:
	testl	%esi, %esi
	jle	LBB0_13
## %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movl	%esi, %r9d
	cmpl	$16, %esi
	jae	LBB0_3
## %bb.2:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_3:
	movl	%r9d, %ecx
	andl	$-16, %ecx
	leaq	-16(%rcx), %rsi
	movq	%rsi, %rax
	shrq	$4, %rax
	incq	%rax
	movl	%eax, %r8d
	andl	$3, %r8d
	cmpq	$48, %rsi
	jae	LBB0_5
## %bb.4:
	pxor	%xmm0, %xmm0
	xorl	%esi, %esi
	pxor	%xmm1, %xmm1
	jmp	LBB0_7
LBB0_5:
	andq	$-4, %rax
	pxor	%xmm0, %xmm0
	xorl	%esi, %esi
	pxor	%xmm1, %xmm1
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	(%rdi,%rsi,2), %xmm2
	pmaxuw	%xmm0, %xmm2
	movdqu	16(%rdi,%rsi,2), %xmm0
	pmaxuw	%xmm1, %xmm0
	movdqu	32(%rdi,%rsi,2), %xmm1
	movdqu	48(%rdi,%rsi,2), %xmm3
	movdqu	64(%rdi,%rsi,2), %xmm4
	pmaxuw	%xmm1, %xmm4
	pmaxuw	%xmm2, %xmm4
	movdqu	80(%rdi,%rsi,2), %xmm2
	pmaxuw	%xmm3, %xmm2
	pmaxuw	%xmm0, %xmm2
	movdqu	96(%rdi,%rsi,2), %xmm0
	pmaxuw	%xmm4, %xmm0
	movdqu	112(%rdi,%rsi,2), %xmm1
	pmaxuw	%xmm2, %xmm1
	addq	$64, %rsi
	addq	$-4, %rax
	jne	LBB0_6
LBB0_7:
	testq	%r8, %r8
	je	LBB0_10
## %bb.8:
	leaq	(%rdi,%rsi,2), %rax
	addq	$16, %rax
	shlq	$5, %r8
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	-16(%rax,%rsi), %xmm2
	pmaxuw	%xmm2, %xmm0
	movdqu	(%rax,%rsi), %xmm2
	pmaxuw	%xmm2, %xmm1
	addq	$32, %rsi
	cmpq	%rsi, %r8
	jne	LBB0_9
LBB0_10:
	pmaxuw	%xmm1, %xmm0
	pcmpeqd	%xmm1, %xmm1
	pxor	%xmm0, %xmm1
	phminposuw	%xmm1, %xmm0
	movd	%xmm0, %eax
	notl	%eax
	cmpq	%r9, %rcx
	je	LBB0_12
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movzwl	(%rdi,%rcx,2), %esi
	cmpw	%si, %ax
	cmovbel	%esi, %eax
	incq	%rcx
	cmpq	%rcx, %r9
	jne	LBB0_11
LBB0_12:
	testw	%ax, %ax
	popq	%rbp
	je	LBB0_13
## %bb.14:
	movzwl	%ax, %eax
	retq
LBB0_13:
	movl	%edx, %eax
	movzwl	%ax, %eax
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_calc_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_speed
_calc_speed:                            ; @calc_speed
	.cfi_startproc
; %bb.0:
	cmp	w1, #1
	b.lt	LBB0_10
; %bb.1:
	mov	w8, w1
	cmp	w1, #32
	b.hs	LBB0_3
; %bb.2:
	mov	x9, #0
	mov	w10, #0
	b	LBB0_6
LBB0_3:
	and	x9, x8, #0xffffffe0
	add	x10, x0, #32
	movi.2d	v0, #0000000000000000
	mov	x11, x9
	movi.2d	v1, #0000000000000000
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q4, q5, [x10, #-32]
	ldp	q6, q7, [x10], #64
	umax.8h	v0, v0, v4
	umax.8h	v1, v1, v5
	umax.8h	v2, v2, v6
	umax.8h	v3, v3, v7
	subs	x11, x11, #32
	b.ne	LBB0_4
; %bb.5:
	umax.8h	v0, v0, v1
	umax.8h	v0, v0, v2
	umax.8h	v0, v0, v3
	umaxv.8h	h0, v0
	fmov	w10, s0
	cmp	x9, x8
	b.eq	LBB0_8
LBB0_6:
	add	x11, x0, x9, lsl #1
	sub	x8, x8, x9
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldrh	w9, [x11], #2
	and	w10, w10, #0xffff
	cmp	w10, w9
	csel	w10, w10, w9, hi
	subs	x8, x8, #1
	b.ne	LBB0_7
LBB0_8:
	tst	w10, #0xffff
	b.eq	LBB0_10
; %bb.9:
	and	w0, w10, #0xffff
	ret
LBB0_10:
	mov	x10, x2
	and	w0, w10, #0xffff
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_calc_speed
.subsections_via_symbols
