	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function encode_codebook
_encode_codebook:                       ## @encode_codebook
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r14
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	(%rdi), %r12
	movq	_AV_PIX_FMT_RGB24@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	xorl	%eax, %eax
	cmpq	%r13, %r12
	sete	%al
	leal	4(%rax,%rax), %edx
	cmovnel	%r8d, %ecx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	imull	%r15d, %edx
	movq	%r9, %rdi
	movl	%ecx, %esi
	callq	_write_chunk_header
                                        ## kill: def $eax killed $eax def $rax
	testl	%r15d, %r15d
	jle	LBB0_6
## %bb.1:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %edx
	addq	$20, %rbx
	shlq	$2, %rsi
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movzbl	-4(%rbx), %ecx
	addb	$-128, %cl
	movb	%cl, 4(%r14,%rax)
	movzbl	(%rbx), %ecx
	addb	$-128, %cl
	movb	%cl, 5(%r14,%rax)
	addq	$6, %rax
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	addq	%rsi, %rbx
	decq	%rdx
	je	LBB0_6
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cltq
	movzbl	-20(%rbx), %ecx
	movb	%cl, (%r14,%rax)
	movzbl	-16(%rbx), %ecx
	movb	%cl, 1(%r14,%rax)
	movzbl	-12(%rbx), %ecx
	movb	%cl, 2(%r14,%rax)
	movzbl	-8(%rbx), %ecx
	movb	%cl, 3(%r14,%rax)
	cmpq	%r13, %r12
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addq	$4, %rax
	jmp	LBB0_5
LBB0_6:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_PIX_FMT_RGB24,8,3           ## @AV_PIX_FMT_RGB24
	.no_dead_strip	_encode_codebook
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function encode_codebook
_encode_codebook:                       ; @encode_codebook
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x5
	mov	x20, x2
	mov	x21, x1
	ldr	x22, [x0]
Lloh0:
	adrp	x8, _AV_PIX_FMT_RGB24@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_PIX_FMT_RGB24@GOTPAGEOFF]
Lloh2:
	ldr	x23, [x8]
	cmp	x22, x23
	mov	w8, #4
	mov	w9, #6
	csel	w24, w9, w8, eq
	csel	w1, w3, w4, eq
	mul	w2, w24, w2
	mov	x0, x5
	bl	_write_chunk_header
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w20, #1
	b.lt	LBB0_6
; %bb.1:
	add	x8, x21, #12
	lsl	x9, x24, #2
	mov	w10, w20
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x8, x8, x9
	mov	x0, x11
	subs	x10, x10, #1
	b.eq	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	sxtw	x12, w0
	ldur	w11, [x8, #-12]
	add	x13, x19, x12
	strb	w11, [x13]
	ldur	w11, [x8, #-8]
	strb	w11, [x13, #1]
	ldur	w11, [x8, #-4]
	strb	w11, [x13, #2]
	ldr	w14, [x8]
	add	x11, x12, #4
	strb	w14, [x13, #3]
	cmp	x22, x23
	b.ne	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrb	w13, [x8, #4]
	eor	w13, w13, #0x80
	add	x14, x12, x19
	strb	w13, [x19, x11]
	ldrb	w11, [x8, #8]
	eor	w13, w11, #0x80
	add	x11, x12, #6
	strb	w13, [x14, #5]
	b	LBB0_2
LBB0_5:
	mov	x0, x11
LBB0_6:
                                        ; kill: def $w0 killed $w0 killed $x0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_PIX_FMT_RGB24,8,3           ; @AV_PIX_FMT_RGB24
	.no_dead_strip	_encode_codebook
.subsections_via_symbols
