	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function encode_bitstream
_encode_bitstream:                      ## @encode_bitstream
	.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	$136, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, %r12d
	movl	%r8d, %r13d
	movq	%rsi, -152(%rbp)                ## 8-byte Spill
	movq	%rdi, %rbx
	leaq	-164(%rbp), %r15
	movq	%r15, %rdi
	movq	%rdx, -160(%rbp)                ## 8-byte Spill
	movq	%rdx, %rsi
	movl	%ecx, %edx
	callq	_init_put_bits
	leal	15(%r13), %edx
	testl	%r13d, %r13d
	cmovnsl	%r13d, %edx
	sarl	$4, %edx
	decl	%edx
	movq	%r15, %rdi
	movl	$4, %esi
	callq	_put_bits
	movl	(%rbx), %edx
	movq	%r15, %rdi
	movl	$12, %esi
	callq	_put_bits
	leal	15(%r12), %edx
	testl	%r12d, %r12d
	cmovnsl	%r12d, %edx
	sarl	$4, %edx
	decl	%edx
	movq	%r15, %rdi
	movl	$4, %esi
	callq	_put_bits
	movl	4(%rbx), %edx
	movq	%r15, %rdi
	movl	$12, %esi
	callq	_put_bits
	movq	%r15, %rdi
	callq	_flush_put_bits
	movq	%r13, %rsi
	movl	(%rbx), %eax
	movl	4(%rbx), %r8d
	cltd
	idivl	%esi
	movl	%edx, %r15d
	movl	%eax, %ecx
	movl	%r8d, %eax
	cltd
	idivl	%r12d
	movl	%edx, -80(%rbp)                 ## 4-byte Spill
	cmpl	$1, %edx
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	sbbl	$-1, %eax
	movl	%eax, -76(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	jle	LBB0_1
## %bb.2:
	cmpl	$1, %r15d
	movl	%ecx, %eax
	sbbl	$-1, %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	%esi, %eax
	imull	%r12d, %eax
	leal	(%rax,%rax,2), %eax
	cltq
	movq	%rax, -136(%rbp)                ## 8-byte Spill
	movl	$4, %eax
	xorl	%r9d, %r9d
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movq	%r12, -128(%rbp)                ## 8-byte Spill
	movq	%rbx, -144(%rbp)                ## 8-byte Spill
	movq	%rsi, -112(%rbp)                ## 8-byte Spill
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	-144(%rbp), %r14                ## 8-byte Reload
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	-104(%rbp), %r9                 ## 8-byte Reload
	incl	%r9d
	cmpl	-76(%rbp), %r9d                 ## 4-byte Folded Reload
	movq	-128(%rbp), %r12                ## 8-byte Reload
	je	LBB0_13
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	cmpl	-84(%rbp), %r9d                 ## 4-byte Folded Reload
	movl	-80(%rbp), %edx                 ## 4-byte Reload
	movl	%edx, %r8d
	cmovll	%r12d, %r8d
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	movq	%r9, -104(%rbp)                 ## 8-byte Spill
	jle	LBB0_12
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r9d, %edx
	imull	%r12d, %edx
	addl	%r8d, %edx
	notl	%edx
	movl	%edx, -92(%rbp)                 ## 4-byte Spill
	leal	(%r8,%r8,2), %edx
	movl	%edx, -88(%rbp)                 ## 4-byte Spill
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	movq	%r8, -120(%rbp)                 ## 8-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=2
	movq	-64(%rbp), %rsi
	leaq	-72(%rbp), %rdi
	callq	_bytestream_put_be16
	movl	-64(%rbp), %eax
	addl	%eax, %ebx
	addl	$2, %ebx
	movl	8(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	callq	_ff_dlog
	movq	%rbx, %rax
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=2
	movq	-112(%rbp), %rsi                ## 8-byte Reload
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movq	-120(%rbp), %r8                 ## 8-byte Reload
	incl	%r13d
	addl	%esi, %r12d
	cmpl	%r13d, -56(%rbp)                ## 4-byte Folded Reload
	je	LBB0_12
LBB0_5:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	%ecx, %r13d
	cmovll	%esi, %r15d
	movq	%rax, %rbx
	cltq
	movq	-160(%rbp), %rcx                ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rax
	movq	%rax, -72(%rbp)
	movq	-152(%rbp), %rcx                ## 8-byte Reload
	movq	(%rcx), %rax
	movq	8(%rcx), %rcx
	movl	(%rcx), %edi
	movl	12(%r14), %esi
	movl	4(%r14), %edx
	addl	-92(%rbp), %edx                 ## 4-byte Folded Reload
	movl	(%rax), %eax
	movl	%r12d, %ecx
                                        ## kill: def $r8d killed $r8d killed $r8
	movl	%r15d, %r9d
	pushq	16(%rbp)
	pushq	%rax
	callq	_copy_region_enc
	addq	$16, %rsp
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=2
	movq	24(%rbp), %rax
	cmpl	$0, (%rax)
	je	LBB0_10
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=2
	movq	-136(%rbp), %rax                ## 8-byte Reload
	movq	%rax, -64(%rbp)
	movq	-72(%rbp), %rdi
	addq	$8, %rdi
	movl	12(%r14), %edx
	imull	-88(%rbp), %r15d                ## 4-byte Folded Reload
	leaq	-64(%rbp), %rsi
	movl	%r15d, %ecx
	movl	$9, %r8d
	callq	_compress2
	movq	_Z_OK@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=2
	movl	8(%r14), %edi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movl	%r13d, %ecx
	movq	-104(%rbp), %r8                 ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_av_log
	jmp	LBB0_9
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=2
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	leaq	-72(%rbp), %rdi
	xorl	%esi, %esi
	callq	_bytestream_put_be16
	movq	%rbx, %rax
	addl	$2, %eax
	jmp	LBB0_11
LBB0_1:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$4, %eax
LBB0_13:
	xorl	%edx, %edx
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	sete	%dl
	movq	24(%rbp), %rcx
	movl	%edx, (%rcx)
                                        ## kill: def $eax killed $eax killed $rax
	addq	$136, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_Z_OK,4,2                       ## @Z_OK
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error while compressing block %dx%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"buf_pos = %d\n"

	.no_dead_strip	_encode_bitstream
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function encode_bitstream
_encode_bitstream:                      ; @encode_bitstream
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #208
	.cfi_def_cfa_offset 208
	stp	x28, x27, [sp, #112]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #128]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #144]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #160]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #176]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #192]            ; 16-byte Folded Spill
	add	x29, sp, #192
	.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
	str	x7, [sp, #32]                   ; 8-byte Folded Spill
	stp	x2, x6, [sp, #64]               ; 16-byte Folded Spill
	mov	x20, x5
	mov	x22, x4
	mov	x24, x1
	mov	x25, x0
	sub	x0, x29, #84
	mov	x1, x2
	mov	x2, x3
	bl	_init_put_bits
	add	w8, w22, #15
	cmp	w22, #0
	csel	w8, w8, w22, lt
	asr	w8, w8, #4
	sub	w2, w8, #1
	mov	w26, #4
	sub	x0, x29, #84
	mov	w1, #4
	bl	_put_bits
	ldr	w2, [x25]
	sub	x0, x29, #84
	mov	w1, #12
	bl	_put_bits
	add	w8, w20, #15
	cmp	w20, #0
	csel	w8, w8, w20, lt
	asr	w8, w8, #4
	sub	w2, w8, #1
	sub	x0, x29, #84
	mov	w1, #4
	bl	_put_bits
	ldr	w2, [x25, #4]
	sub	x0, x29, #84
	mov	w1, #12
	bl	_put_bits
	sub	x0, x29, #84
	bl	_flush_put_bits
	ldr	w8, [x25, #4]
	sdiv	w9, w8, w20
	msub	w8, w9, w20, w8
	stp	w8, w9, [sp, #20]               ; 8-byte Folded Spill
	cmp	w8, #0
	cinc	w8, w9, ne
	str	w8, [sp, #16]                   ; 4-byte Folded Spill
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.1:
	mov	w9, #0
	str	wzr, [sp, #28]                  ; 4-byte Folded Spill
	ldr	w8, [x25]
	sdiv	w10, w8, w22
	msub	w8, w10, w22, w8
	stp	w8, w10, [sp, #56]              ; 8-byte Folded Spill
	cmp	w8, #0
	cinc	w8, w10, ne
	str	w8, [sp, #84]                   ; 4-byte Folded Spill
	mul	w8, w22, w20
	add	w8, w8, w8, lsl #1
	sxtw	x8, w8
	str	x8, [sp, #48]                   ; 8-byte Folded Spill
	mov	w26, #4
	str	w20, [sp, #12]                  ; 4-byte Folded Spill
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [sp, #44]                   ; 4-byte Folded Reload
	add	w9, w9, #1
	ldp	w20, w8, [sp, #12]              ; 8-byte Folded Reload
	cmp	w9, w8
	b.eq	LBB0_13
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldr	w8, [sp, #24]                   ; 4-byte Folded Reload
	cmp	w9, w8
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	csel	w21, w20, w8, lt
	ldr	w8, [sp, #84]                   ; 4-byte Folded Reload
	cmp	w8, #1
	str	w9, [sp, #44]                   ; 4-byte Folded Spill
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w19, #0
	mov	w28, #0
	madd	w8, w9, w20, w21
	mvn	w27, w8
	add	w23, w21, w21, lsl #1
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=2
	ldr	x1, [sp, #88]
	add	x0, sp, #96
	bl	_bytestream_put_be16
	ldr	w8, [sp, #88]
	add	w8, w26, w8
	add	w26, w8, #2
	ldr	w0, [x25, #8]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x26
	bl	_ff_dlog
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	add	w28, w28, #1
	add	w19, w19, w22
	ldr	w8, [sp, #84]                   ; 4-byte Folded Reload
	cmp	w8, w28
	b.eq	LBB0_2
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [sp, #60]                   ; 4-byte Folded Reload
	cmp	w28, w8
	ldr	w8, [sp, #56]                   ; 4-byte Folded Reload
	csel	w20, w22, w8, lt
	ldp	x8, x7, [sp, #64]               ; 16-byte Folded Reload
	add	x8, x8, w26, sxtw #2
	str	x8, [sp, #96]
	ldp	x9, x8, [x24]
	ldr	w0, [x8]
	ldr	w1, [x25, #12]
	ldr	w8, [x25, #4]
	add	w2, w8, w27
	ldr	w6, [x9]
	mov	x3, x19
	mov	x4, x21
	mov	x5, x20
	bl	_copy_region_enc
	cbnz	w0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	ldr	w8, [x8]
	cbz	w8, LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=2
	ldr	x8, [sp, #48]                   ; 8-byte Folded Reload
	str	x8, [sp, #88]
	ldr	x8, [sp, #96]
	add	x0, x8, #8
	ldr	w2, [x25, #12]
	mul	w3, w23, w20
	add	x1, sp, #88
	mov	w4, #9
	bl	_compress2
Lloh2:
	adrp	x8, _Z_OK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _Z_OK@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w0, w8
	b.eq	LBB0_5
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=2
	ldr	w0, [x25, #8]
Lloh5:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
	mov	x3, x28
	ldr	w4, [sp, #44]                   ; 4-byte Folded Reload
	bl	_av_log
	b	LBB0_5
LBB0_11:                                ;   in Loop: Header=BB0_7 Depth=2
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	add	w8, w8, #1
	str	w8, [sp, #28]                   ; 4-byte Folded Spill
	add	x0, sp, #96
	mov	x1, #0
	bl	_bytestream_put_be16
	add	w26, w26, #2
	b	LBB0_6
LBB0_12:
	str	wzr, [sp, #28]                  ; 4-byte Folded Spill
LBB0_13:
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	cmp	w8, #0
	cset	w8, eq
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	str	w8, [x9]
	mov	x0, x26
	ldp	x29, x30, [sp, #192]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #176]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #160]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #144]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #128]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #208
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_Z_OK,4,2                       ; @Z_OK
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error while compressing block %dx%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"buf_pos = %d\n"

	.no_dead_strip	_encode_bitstream
.subsections_via_symbols
