	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ff_mjpeg_encode_stuffing       ## -- Begin function ff_mjpeg_encode_stuffing
	.p2align	4, 0x90
_ff_mjpeg_encode_stuffing:              ## @ff_mjpeg_encode_stuffing
	.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	%rdi, %r13
	leaq	48(%rdi), %r14
	movl	(%rdi), %r15d
	cmpl	$1, 96(%rdi)
	sbbl	$0, %r15d
	movq	8(%rdi), %rax
	movq	_HUFFMAN_TABLE_OPTIMAL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	88(%r13), %r12
	movq	%r12, %rdi
	callq	_ff_mjpeg_build_optimal_huffman
	movl	4(%r12), %esi
	movl	12(%r12), %edi
	callq	_ff_init_uni_ac_vlc
	movl	(%r12), %esi
	movl	8(%r12), %edi
	callq	_ff_init_uni_ac_vlc
	movq	(%r12), %xmm0                   ## xmm0 = mem[0],zero
	pshufd	$80, %xmm0, %xmm0               ## xmm0 = xmm0[0,0,1,1]
	movdqu	%xmm0, 68(%r13)
	movq	40(%r13), %rdi
	leaq	64(%r13), %rdx
	movl	60(%r13), %ecx
	movl	56(%r13), %r8d
	movl	52(%r13), %r9d
	movq	%r14, %rsi
	callq	_ff_mjpeg_encode_picture_header
	movq	%r13, %rdi
	callq	_ff_mjpeg_encode_picture_frame
LBB0_2:
	movq	%r14, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	leal	7(%rax), %ebx
	testl	%eax, %eax
	cmovnsl	%eax, %ebx
	sarl	$3, %ebx
	addl	$100, %ebx
	movq	%r14, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	sarl	$2, %edx
	addl	$1000, %edx                     ## imm = 0x3E8
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_ff_mpv_reallocate_putbitbuffer
	movl	%eax, %r12d
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	16(%r13), %esi
	movq	%r14, %rdi
	callq	_ff_mjpeg_escape_FF
	movq	40(%r13), %rax
	movq	_FF_THREAD_SLICE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_7
## %bb.5:
	cmpl	20(%r13), %r15d
	jge	LBB0_7
## %bb.6:
	movq	_RST0@GOTPCREL(%rip), %rax
	andl	$7, %r15d
	addq	(%rax), %r15
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_put_marker
LBB0_7:
	movq	%r14, %rdi
	callq	_put_bits_count
	sarl	$3, %eax
	movl	%eax, 16(%r13)
	jmp	LBB0_8
LBB0_3:
	movq	40(%r13), %rdi
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	callq	_av_log
LBB0_8:
	movb	32(%r13), %cl
	movl	$128, %eax
	shll	%cl, %eax
	movq	24(%r13), %rdx
	movl	%eax, (%rdx)
	movb	32(%r13), %cl
	movl	$128, %eax
	shll	%cl, %eax
	movl	$128, %esi
	movl	%eax, 4(%rdx)
	movb	32(%r13), %cl
	shll	%cl, %esi
	movl	%esi, 8(%rdx)
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HUFFMAN_TABLE_OPTIMAL,8,3      ## @HUFFMAN_TABLE_OPTIMAL
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Buffer reallocation failed\n"

	.comm	_FF_THREAD_SLICE,4,2            ## @FF_THREAD_SLICE
	.comm	_RST0,8,3                       ## @RST0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ff_mjpeg_encode_stuffing       ; -- Begin function ff_mjpeg_encode_stuffing
	.p2align	2
_ff_mjpeg_encode_stuffing:              ; @ff_mjpeg_encode_stuffing
	.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, x0
	add	x20, x0, #48
	ldr	w22, [x0]
	ldr	w8, [x0, #96]
	cmp	w8, #0
	cset	w23, eq
	ldr	x8, [x0, #8]
Lloh0:
	adrp	x9, _HUFFMAN_TABLE_OPTIMAL@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HUFFMAN_TABLE_OPTIMAL@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	ldr	x21, [x19, #88]
	mov	x0, x21
	bl	_ff_mjpeg_build_optimal_huffman
	ldr	w0, [x21, #12]
	ldr	w1, [x21, #4]
	bl	_ff_init_uni_ac_vlc
	ldr	w0, [x21, #8]
	ldr	w1, [x21]
	bl	_ff_init_uni_ac_vlc
	add	x8, x19, #68
	ldr	d0, [x21]
	fmov	d1, d0
	st2.2s	{ v0, v1 }, [x8]
	ldr	x0, [x19, #40]
	add	x2, x19, #64
	ldp	w4, w3, [x19, #56]
	ldr	w5, [x19, #52]
	mov	x1, x20
	bl	_ff_mjpeg_encode_picture_header
	mov	x0, x19
	bl	_ff_mjpeg_encode_picture_frame
LBB0_2:
	mov	x0, x20
	bl	_put_bits_count
	add	w8, w0, #7
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w8, w8, #3
	add	w21, w8, #100
	mov	x0, x20
	bl	_put_bits_count
	add	w8, w0, #3
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w8, w8, #2
	add	w2, w8, #1000
	mov	x0, x19
	mov	x1, x21
	bl	_ff_mpv_reallocate_putbitbuffer
	mov	x21, x0
	tbnz	w0, #31, LBB0_7
; %bb.3:
	ldr	w1, [x19, #16]
	mov	x0, x20
	bl	_ff_mjpeg_escape_FF
	ldr	x8, [x19, #40]
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _FF_THREAD_SLICE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _FF_THREAD_SLICE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	ldr	w9, [x19, #20]
	sub	w8, w22, w23
	cmp	w8, w9
	b.ge	LBB0_6
; %bb.5:
Lloh6:
	adrp	x9, _RST0@GOTPAGE
Lloh7:
	ldr	x9, [x9, _RST0@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	and	w8, w8, #0x7
	add	x1, x9, x8
	mov	x0, x20
	bl	_put_marker
LBB0_6:
	mov	x0, x20
	bl	_put_bits_count
	asr	w8, w0, #3
	str	w8, [x19, #16]
	b	LBB0_8
LBB0_7:
	ldr	x0, [x19, #40]
Lloh9:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x2, l_.str@PAGE
Lloh13:
	add	x2, x2, l_.str@PAGEOFF
	bl	_av_log
LBB0_8:
	ldr	x8, [x19, #24]
	ldr	w9, [x19, #32]
	mov	w10, #128
	lsl	w9, w10, w9
	str	w9, [x8]
	ldr	w9, [x19, #32]
	lsl	w9, w10, w9
	str	w9, [x8, #4]
	ldr	w9, [x19, #32]
	lsl	w9, w10, w9
	str	w9, [x8, #8]
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_HUFFMAN_TABLE_OPTIMAL,8,3      ; @HUFFMAN_TABLE_OPTIMAL
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Buffer reallocation failed\n"

	.comm	_FF_THREAD_SLICE,4,2            ; @FF_THREAD_SLICE
	.comm	_RST0,8,3                       ; @RST0
.subsections_via_symbols
