	.file	"extr_cbs_mpeg2.c_cbs_mpeg2_write_slice.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cbs_mpeg2_write_slice, @function
cbs_mpeg2_write_slice:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdx
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	mov	rbx, QWORD PTR [rsi]
	mov	rsi, rbp
	lea	rdx, 16[rbx]
	call	cbs_mpeg2_write_slice_header@PLT
	test	eax, eax
	js	.L1
	mov	rsi, QWORD PTR [rbx]
	test	rsi, rsi
	je	.L11
	mov	edx, DWORD PTR 12[rbx]
	mov	edi, DWORD PTR 8[rbx]
	mov	eax, edx
	lea	ecx, 14[rdx]
	mov	r13d, edi
	add	eax, 7
	cmovns	ecx, eax
	sar	ecx, 3
	sub	r13d, ecx
	test	edx, edx
	cmovns	eax, edx
	movsx	r13, r13d
	xor	r8d, r8d
	sar	eax, 3
	cdqe
	lea	r12, [rsi+rax*4]
	test	edx, edx
	js	.L3
	sal	edi, 3
	xor	r8d, r8d
	cmp	edx, edi
	setl	r8b
.L3:
	mov	edi, r8d
	call	av_assert0@PLT
	mov	eax, DWORD PTR 8[rbx]
	mov	rdi, rbp
	lea	r14d, 8[0+rax*8]
	call	put_bits_left@PLT
	cmp	r14d, eax
	jg	.L25
	mov	eax, DWORD PTR 12[rbx]
	test	al, 7
	jne	.L26
.L5:
	mov	rdi, rbp
	call	put_bits_count@PLT
	test	al, 7
	je	.L6
	mov	r14, r12
	mov	rbx, r13
	cmp	r13, 3
	jbe	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	mov	rdi, r14
	sub	rbx, 4
	add	r14, 16
	call	AV_RB32@PLT
	mov	rdi, rbp
	mov	esi, eax
	call	put_bits32@PLT
	cmp	rbx, 3
	ja	.L7
	sub	r13, 4
	mov	rax, r13
	and	r13d, 3
	shr	rax, 2
	add	rax, 1
	sal	rax, 4
	add	r12, rax
.L8:
	test	r13, r13
	je	.L9
	lea	rbx, [r12+r13*4]
.L10:
	mov	edx, DWORD PTR [r12]
	mov	esi, 8
	mov	rdi, rbp
	add	r12, 4
	call	put_bits@PLT
	cmp	r12, rbx
	jne	.L10
.L9:
	mov	rdi, rbp
	call	put_bits_count@PLT
	mov	rdi, rbp
	cdq
	shr	edx, 29
	add	eax, edx
	and	eax, 7
	sub	edx, eax
	lea	esi, 8[rdx]
	xor	edx, edx
	call	put_bits@PLT
	xor	eax, eax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	mov	edi, DWORD PTR ENOSPC[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	AVERROR@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	mov	rdi, rbp
	call	flush_put_bits@PLT
	mov	rdi, rbp
	call	put_bits_ptr@PLT
	mov	rdx, r13
	mov	rsi, r12
	mov	edi, eax
	call	memcpy@PLT
	mov	rsi, r13
	mov	rdi, rbp
	call	skip_put_bytes@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	cdq
	mov	r15d, 8
	lea	r14, 4[r12]
	mov	r12d, DWORD PTR [r12]
	shr	edx, 29
	mov	edi, r15d
	add	eax, edx
	and	eax, 7
	sub	eax, edx
	sub	edi, eax
	call	MAX_UINT_BITS@PLT
	mov	ecx, DWORD PTR 12[rbx]
	mov	edx, r12d
	mov	rdi, rbp
	and	edx, eax
	mov	r12, r14
	mov	esi, ecx
	sar	esi, 31
	shr	esi, 29
	add	ecx, esi
	and	ecx, 7
	sub	ecx, esi
	mov	esi, r15d
	sub	esi, ecx
	call	put_bits@PLT
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	cbs_mpeg2_write_slice, .-cbs_mpeg2_write_slice
	.comm	ENOSPC,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cbs_mpeg2.c_cbs_mpeg2_write_slice.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cbs_mpeg2_write_slice, %function
cbs_mpeg2_write_slice:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r6, [r1]
	mov	r5, r2
	mov	r1, r2
	add	r2, r6, #12
	bl	cbs_mpeg2_write_slice_header
	cmp	r0, #0
	poplt	{r4, r5, r6, r7, r8, r9, r10, pc}
	ldr	r4, [r6]
	cmp	r4, #0
	beq	.L23
	ldmib	r6, {r1, r3}
	adds	r2, r3, #7
	addmi	r7, r3, #14
	movpl	r7, r2
	cmp	r3, #0
	movge	r2, r3
	asr	r10, r2, #3
	movlt	r0, #0
	add	r8, r4, r10, lsl #2
	sub	r7, r1, r7, asr #3
	blt	.L3
	cmp	r3, r1, lsl #3
	movlt	r0, #1
	movge	r0, #0
.L3:
	bl	av_assert0
	mov	r0, r5
	ldr	r9, [r6, #4]
	bl	put_bits_left
	add	r9, r9, #1
	lsl	r9, r9, #3
	cmp	r9, r0
	bgt	.L25
	ldr	r3, [r6, #8]
	ands	r1, r3, #7
	bne	.L26
.L5:
	mov	r0, r5
	bl	put_bits_count
	ands	r4, r0, #7
	beq	.L6
	cmp	r7, #3
	movhi	r6, r8
	movhi	r4, r7
	bls	.L8
.L7:
	mov	r0, r6
	bl	AV_RB32
	sub	r4, r4, #4
	mov	r1, r0
	mov	r0, r5
	bl	put_bits32
	cmp	r4, #3
	add	r6, r6, #16
	bhi	.L7
	sub	r7, r7, #4
	lsr	r3, r7, #2
	add	r3, r3, #1
	add	r8, r8, r3, lsl #4
	and	r7, r7, #3
.L8:
	cmp	r7, #0
	beq	.L9
	add	r7, r8, r7, lsl #2
.L10:
	ldr	r2, [r8], #4
	mov	r1, #8
	mov	r0, r5
	bl	put_bits
	cmp	r8, r7
	bne	.L10
.L9:
	mov	r0, r5
	bl	put_bits_count
	rsbs	r3, r0, #0
	and	r3, r3, #7
	and	r1, r0, #7
	rsbpl	r1, r3, #0
	mov	r0, r5
	mov	r2, #0
	rsb	r1, r1, #8
	bl	put_bits
.L23:
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L25:
	ldr	r3, .L27
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r0, [r3]
	b	AVERROR
.L6:
	mov	r0, r5
	bl	flush_put_bits
	mov	r0, r5
	bl	put_bits_ptr
	mov	r2, r7
	mov	r1, r8
	bl	memcpy
	mov	r1, r7
	mov	r0, r5
	bl	skip_put_bytes
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L26:
	rsbs	r3, r3, #0
	and	r3, r3, #7
	rsbpl	r1, r3, #0
	rsb	r6, r1, #8
	mov	r0, r6
	ldr	r4, [r4, r10, lsl #2]
	bl	MAX_UINT_BITS
	mov	r1, r6
	and	r2, r4, r0
	mov	r0, r5
	add	r8, r8, #4
	bl	put_bits
	b	.L5
.L28:
	.align	2
.L27:
	.word	ENOSPC
	.size	cbs_mpeg2_write_slice, .-cbs_mpeg2_write_slice
	.comm	ENOSPC,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
