	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rate_control
_rate_control:                          ## @rate_control
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rdi
	movq	16(%rsi), %r12
	movl	(%rsi), %ebx
	movl	4(%rsi), %r14d
	movl	8(%rsi), %r15d
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movl	%r15d, %esi
	callq	_count_hq_slice
	movl	%eax, %r13d
	cmpl	%ebx, %eax
	jg	LBB0_2
## %bb.1:
	cmpl	%r14d, %r13d
	jge	LBB0_11
LBB0_2:
	xorl	%eax, %eax
	cmpl	%ebx, %r13d
	setg	%al
	leal	(%r15,%rax,2), %edi
	decl	%edi
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movl	(%r12), %edx
	decl	%edx
	xorl	%esi, %esi
	callq	_av_clip
	movq	%rax, %r15
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %esi
	callq	_count_hq_slice
	movl	%eax, %r13d
	cmpl	$-1, %r15d
	je	LBB0_3
## %bb.8:
	movl	%r14d, -64(%rbp)                ## 4-byte Spill
	movl	%ebx, -68(%rbp)                 ## 4-byte Spill
	movl	$1, %ebx
	movl	$-1, %r14d
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_9 Depth=1
	addl	%r15d, %edi
	movl	(%r12), %edx
	decl	%edx
	xorl	%esi, %esi
	callq	_av_clip
	movq	%r15, %r14
	movq	%rax, %r15
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %esi
	callq	_count_hq_slice
	movl	%eax, %r13d
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	cmpl	%r15d, %esi
	je	LBB0_7
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
                                        ## kill: def $r15d killed $r15d killed $r15 def $r15
	movl	%ebx, %edi
	shrl	$31, %edi
	addl	%ebx, %edi
	sarl	%edi
	movl	(%r12), %eax
	movl	%eax, %ecx
	decl	%ecx
	shrl	$31, %ecx
	leal	(%rax,%rcx), %edx
	decl	%edx
	sarl	%edx
	movl	$1, %esi
	callq	_av_clip
	movq	%rax, %rbx
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, %r13d
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	jg	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	%ecx, %r13d
	jge	LBB0_11
LBB0_4:                                 ##   in Loop: Header=BB0_9 Depth=1
	movl	%ebx, %edi
	movl	%r13d, -60(%rbp)                ## 4-byte Spill
	cmpl	%eax, %r13d
	jg	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_9 Depth=1
	movl	%ebx, %edi
	negl	%edi
	jmp	LBB0_6
LBB0_3:
	movl	$-1, %esi
                                        ## implicit-def: $eax
                                        ## kill: killed $eax
	movl	$-1, %r14d
	movq	-48(%rbp), %r12                 ## 8-byte Reload
LBB0_7:
	movl	%r14d, %edi
	callq	_FFMAX
	cmpl	%r14d, %eax
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	cmovnel	%r13d, %ecx
	movl	%ecx, %r13d
	movl	%eax, %r15d
LBB0_11:
	movl	(%r12), %edx
	decl	%edx
	movl	%r15d, %edi
	xorl	%esi, %esi
	callq	_av_clip
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	%eax, 8(%rbx)
	sarl	$3, %r13d
	movl	%r13d, %edi
	callq	_SSIZE_ROUND
	movl	%eax, 12(%rbx)
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_rate_control
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rate_control
_rate_control:                          ; @rate_control
	.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
	mov	x19, x1
	ldr	x26, [x1, #16]
	ldp	w27, w28, [x1]
	ldr	w20, [x1, #8]
	mov	x0, x1
	mov	x1, x20
	bl	_count_hq_slice
	mov	x21, x0
	cmp	w0, w27
	ccmp	w0, w28, #8, le
	b.ge	LBB0_8
; %bb.1:
	sub	w8, w20, #1
	cmp	w21, w27
	csinc	w0, w8, w20, le
	ldr	w8, [x26]
	sub	w2, w8, #1
	mov	w1, #0
	bl	_av_clip
	mov	x25, x0
	mov	x0, x19
	mov	x1, x25
	bl	_count_hq_slice
	mov	x24, x0
	cmn	w25, #1
	b.eq	LBB0_6
; %bb.2:
	mov	w23, #1
	mov	w20, #-1
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	cmp	w21, w27
	cneg	w8, w23, le
	add	w0, w8, w20
	ldr	w8, [x26]
	sub	w2, w8, #1
	mov	w1, #0
	bl	_av_clip
	mov	x25, x0
	mov	x0, x19
	mov	x1, x25
	bl	_count_hq_slice
	mov	x24, x0
	cmp	w22, w25
	b.eq	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x22, x20
	mov	x20, x25
	mov	x21, x24
	cmp	w23, #0
	cinc	w8, w23, lt
	asr	w0, w8, #1
	ldr	w8, [x26]
	sub	w9, w8, #1
	cmp	w9, #0
	csel	w8, w8, w9, lt
	asr	w2, w8, #1
	mov	w1, #1
	bl	_av_clip
	mov	x23, x0
	cmp	w24, w27
	b.gt	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w21, w28
	b.lt	LBB0_3
	b	LBB0_8
LBB0_6:
	mov	w22, #-1
                                        ; implicit-def: $w21
	mov	w20, #-1
LBB0_7:
	mov	x0, x20
	mov	x1, x22
	bl	_FFMAX
	cmp	w0, w20
	csel	w21, w21, w24, eq
	mov	x20, x0
LBB0_8:
	ldr	w8, [x26]
	sub	w2, w8, #1
	mov	x0, x20
	mov	w1, #0
	bl	_av_clip
	str	w0, [x19, #8]
	asr	w0, w21, #3
	bl	_SSIZE_ROUND
	str	w0, [x19, #12]
	mov	w0, #0
	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
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_rate_control
.subsections_via_symbols
