	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cbs_mpeg2_write_slice
_cbs_mpeg2_write_slice:                 ## @cbs_mpeg2_write_slice
	.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
	movq	%rdx, %r15
	movq	(%rsi), %r14
	leaq	16(%r14), %rdx
	movq	%r15, %rsi
	callq	_cbs_mpeg2_write_slice_header
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	(%r14), %rax
	xorl	%ebx, %ebx
	testq	%rax, %rax
	je	LBB0_12
## %bb.3:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	8(%r14), %edx
	movl	12(%r14), %eax
	leal	7(%rax), %r13d
	leal	14(%rax), %r12d
	testl	%r13d, %r13d
	cmovnsl	%r13d, %r12d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	setns	%cl
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	leal	(,%rdx,8), %edx
	cmpl	%eax, %edx
	setg	%al
	andb	%cl, %al
	movzbl	%al, %edi
	callq	_av_assert0
	movl	8(%r14), %eax
	leal	8(,%rax,8), %ebx
	movq	%r15, %rdi
	callq	_put_bits_left
	cmpl	%eax, %ebx
	jle	LBB0_4
## %bb.13:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_1:
	movl	%eax, %ebx
	jmp	LBB0_12
LBB0_4:
	sarl	$3, %r12d
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	subl	%r12d, %ebx
	sarl	$3, %r13d
	movslq	%r13d, %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %r12
	movl	12(%r14), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	andl	$-8, %ecx
	subl	%ecx, %eax
	je	LBB0_6
## %bb.5:
	movq	%rbx, %r14
	movl	$8, %ebx
	subl	%eax, %ebx
	movl	(%r12), %r13d
	addq	$4, %r12
	movl	%ebx, %edi
	callq	_MAX_UINT_BITS
	andl	%eax, %r13d
	movq	%r15, %rdi
	movl	%ebx, %esi
	movq	%r14, %rbx
	movl	%r13d, %edx
	callq	_put_bits
LBB0_6:
	movslq	%ebx, %r13
	movq	%r15, %rdi
	callq	_put_bits_count
	testb	$7, %al
	je	LBB0_14
## %bb.7:
	cmpl	$4, %ebx
	jb	LBB0_8
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_AV_RB32
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_put_bits32
	addq	$-4, %r13
	addq	$16, %r12
	cmpq	$3, %r13
	ja	LBB0_15
LBB0_8:
	testq	%r13, %r13
	je	LBB0_11
## %bb.9:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r12,%rbx,4), %edx
	movq	%r15, %rdi
	movl	$8, %esi
	callq	_put_bits
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_10
LBB0_11:
	movq	%r15, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	leal	7(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	andl	$-8, %esi
	subl	%eax, %esi
	addl	$8, %esi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_put_bits
	jmp	LBB0_12
LBB0_14:
	movq	%r15, %rdi
	callq	_flush_put_bits
	movq	%r15, %rdi
	callq	_put_bits_ptr
	movl	%eax, %edi
	movq	%r12, %rsi
	movq	%r13, %rdx
	callq	_memcpy
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_skip_put_bytes
	xorl	%ebx, %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.no_dead_strip	_cbs_mpeg2_write_slice
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cbs_mpeg2_write_slice
_cbs_mpeg2_write_slice:                 ; @cbs_mpeg2_write_slice
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x2
	ldr	x22, [x1]
	add	x2, x22, #16
	mov	x1, x19
	bl	_cbs_mpeg2_write_slice_header
	tbnz	w0, #31, LBB0_14
; %bb.1:
	ldr	x21, [x22]
	cbz	x21, LBB0_13
; %bb.2:
	ldp	w20, w8, [x22, #8]
	add	w9, w8, #7
	add	w10, w8, #14
	cmp	w9, #0
	csel	w23, w10, w9, lt
	cmp	w8, w20, lsl #3
	cset	w10, lt
	cmp	w8, #0
	csel	w24, w9, w8, lt
	cset	w8, ge
	and	w0, w8, w10
	bl	_av_assert0
	ldr	w8, [x22, #8]
	lsl	w8, w8, #3
	add	w25, w8, #8
	mov	x0, x19
	bl	_put_bits_left
	cmp	w25, w0
	b.le	LBB0_4
; %bb.3:
Lloh0:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_4:
	sub	w8, w20, w23, asr #3
	sxtw	x20, w8
	asr	w8, w24, #3
	add	x21, x21, w8, sxtw #2
	ldr	w8, [x22, #12]
	negs	w9, w8
	and	w9, w9, #0x7
	and	w8, w8, #0x7
	csneg	w8, w8, w9, mi
	cbz	w8, LBB0_6
; %bb.5:
	mov	w9, #8
	sub	w22, w9, w8
	ldr	w23, [x21], #4
	mov	x0, x22
	bl	_MAX_UINT_BITS
	and	w2, w0, w23
	mov	x0, x19
	mov	x1, x22
	bl	_put_bits
LBB0_6:
	mov	x0, x19
	bl	_put_bits_count
	tst	w0, #0x7
	b.eq	LBB0_12
; %bb.7:
	cmp	w20, #4
	b.lo	LBB0_9
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_AV_RB32
	mov	x1, x0
	mov	x0, x19
	bl	_put_bits32
	sub	x20, x20, #4
	add	x21, x21, #16
	cmp	x20, #3
	b.hi	LBB0_8
LBB0_9:
	cbz	x20, LBB0_11
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x21], #4
	mov	x0, x19
	mov	w1, #8
	bl	_put_bits
	subs	x20, x20, #1
	b.ne	LBB0_10
LBB0_11:
	mov	x0, x19
	bl	_put_bits_count
	negs	w8, w0
	and	w8, w8, #0x7
	and	w9, w0, #0x7
	csneg	w8, w9, w8, mi
	mov	w9, #8
	sub	w1, w9, w8
	mov	x0, x19
	mov	w2, #0
	bl	_put_bits
	b	LBB0_13
LBB0_12:
	mov	x0, x19
	bl	_flush_put_bits
	mov	x0, x19
	bl	_put_bits_ptr
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	mov	x0, x19
	mov	x1, x20
	bl	_skip_put_bytes
LBB0_13:
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.no_dead_strip	_cbs_mpeg2_write_slice
.subsections_via_symbols
