	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ffmmal_add_packet
_ffmmal_add_packet:                     ## @ffmmal_add_packet
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	(%rdi), %r14
	movq	$0, -56(%rbp)
	movl	(%rsi), %edi
	testl	%edi, %edi
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.1:
	movq	%rsi, %rbx
	movq	32(%rsi), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.4:
	movq	%rax, %rdi
	callq	_av_buffer_ref
	movq	%rax, -56(%rbp)
	testq	%rax, %rax
	je	LBB0_24
## %bb.5:
	leaq	24(%rbx), %r15
	movq	%rbx, %r12
	jmp	LBB0_6
LBB0_8:
	xorl	%ebx, %ebx
	cmpl	$0, (%r14)
	jne	LBB0_31
## %bb.9:
	cmpl	$0, 40(%r14)
	je	LBB0_32
## %bb.10:
	xorl	%r13d, %r13d
	leaq	L_.str(%rip), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_11
LBB0_2:
	callq	_av_buffer_alloc
	movq	%rax, -56(%rbp)
	testq	%rax, %rax
	je	LBB0_24
## %bb.3:
	movq	%rax, %r12
	movq	%rax, %r15
	addq	$8, %r15
	movq	8(%rax), %rdi
	movq	24(%rbx), %rsi
	movl	(%rbx), %edx
	callq	_memcpy
LBB0_6:
	movq	(%r15), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	(%r12), %r13d
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_11
## %bb.7:
	incl	40(%r14)
LBB0_11:
	leaq	24(%r14), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_29:                                ##   in Loop: Header=BB0_12 Depth=1
	leaq	(%r15,%r12,4), %r15
	movq	%rbx, 8(%r14)
	testl	%r13d, %r13d
	je	LBB0_30
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	$56, %edi
	callq	_av_mallocz
	testq	%rax, %rax
	je	LBB0_24
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rax, %rbx
	movq	%r15, 48(%rax)
	movq	32(%r14), %rax
	movq	(%rax), %rax
	movq	(%rax), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_FFMIN
	movq	%rax, %r12
	movq	%rax, 24(%rbx)
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_MMAL_BUFFER_HEADER_FLAG_CONFIG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%rbx)
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=1
	cmpq	-64(%rbp), %r15                 ## 8-byte Folded Reload
	jne	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_MMAL_BUFFER_HEADER_FLAG_FRAME_START@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%rbx)
LBB0_17:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	8(%rsi), %rax
	movq	_AV_NOPTS_VALUE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rcx, %rax
	movq	_MMAL_TIME_UNKNOWN@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmoveq	%rdx, %rax
	movq	%rax, 40(%rbx)
	movq	16(%rsi), %rax
	cmpq	%rcx, %rax
	cmoveq	%rdx, %rax
	movq	%rax, 32(%rbx)
	movq	%r12, %rax
	subl	%r12d, %r13d
	je	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_12 Depth=1
	testq	%rax, %rax
	je	LBB0_20
LBB0_21:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	-56(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_25
## %bb.22:                              ##   in Loop: Header=BB0_12 Depth=1
	callq	_av_buffer_ref
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_23
LBB0_25:                                ##   in Loop: Header=BB0_12 Depth=1
	cmpq	$0, 16(%r14)
	jne	LBB0_27
## %bb.26:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, 16(%r14)
LBB0_27:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	8(%r14), %rax
	testq	%rax, %rax
	je	LBB0_29
## %bb.28:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, (%rax)
	jmp	LBB0_29
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_MMAL_BUFFER_HEADER_FLAG_FRAME_END@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%rbx)
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	callq	_atomic_fetch_add
	movq	24(%rbx), %rax
	testq	%rax, %rax
	jne	LBB0_21
LBB0_20:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_MMAL_BUFFER_HEADER_FLAG_EOS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%rbx)
	movl	$1, (%r14)
	jmp	LBB0_21
LBB0_23:
	movq	%rbx, %rdi
	callq	_av_free
LBB0_24:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_AVERROR
	movl	%eax, %ebx
	jmp	LBB0_31
LBB0_32:
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, (%r14)
LBB0_30:
	xorl	%ebx, %ebx
LBB0_31:
	leaq	-56(%rbp), %rdi
	callq	_av_buffer_unref
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MMAL_BUFFER_HEADER_FLAG_CONFIG,4,2 ## @MMAL_BUFFER_HEADER_FLAG_CONFIG
	.comm	_MMAL_BUFFER_HEADER_FLAG_FRAME_START,4,2 ## @MMAL_BUFFER_HEADER_FLAG_FRAME_START
	.comm	_AV_NOPTS_VALUE,8,3             ## @AV_NOPTS_VALUE
	.comm	_MMAL_TIME_UNKNOWN,8,3          ## @MMAL_TIME_UNKNOWN
	.comm	_MMAL_BUFFER_HEADER_FLAG_FRAME_END,4,2 ## @MMAL_BUFFER_HEADER_FLAG_FRAME_END
	.comm	_MMAL_BUFFER_HEADER_FLAG_EOS,4,2 ## @MMAL_BUFFER_HEADER_FLAG_EOS
	.no_dead_strip	_ffmmal_add_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ffmmal_add_packet
_ffmmal_add_packet:                     ; @ffmmal_add_packet
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x2
	mov	x20, x1
	ldr	x25, [x0]
	str	xzr, [sp, #8]
	ldr	w0, [x1]
	cbz	w0, LBB0_4
; %bb.1:
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_6
; %bb.2:
	mov	x0, x8
	bl	_av_buffer_ref
	str	x0, [sp, #8]
	cbz	x0, LBB0_30
; %bb.3:
	add	x22, x20, #24
	mov	x21, x20
	b	LBB0_8
LBB0_4:
	ldr	w8, [x25]
	cbz	w8, LBB0_10
LBB0_5:
	mov	w19, #0
	b	LBB0_31
LBB0_6:
	bl	_av_buffer_alloc
	str	x0, [sp, #8]
	cbz	x0, LBB0_30
; %bb.7:
	mov	x21, x0
	mov	x22, x0
	ldr	x0, [x22, #8]!
	ldr	x1, [x20, #24]
	ldr	w2, [x20]
	bl	_memcpy
LBB0_8:
	ldr	x22, [x22]
	ldr	w21, [x21]
	cbnz	w19, LBB0_12
; %bb.9:
	ldr	w8, [x25, #40]
	add	w8, w8, #1
	str	w8, [x25, #40]
	b	LBB0_12
LBB0_10:
	ldr	w8, [x25, #40]
	cbz	w8, LBB0_32
; %bb.11:
	mov	w21, #0
Lloh0:
	adrp	x22, l_.str@PAGE
Lloh1:
	add	x22, x22, l_.str@PAGEOFF
LBB0_12:
	add	x8, x25, #24
	str	x8, [sp]                        ; 8-byte Folded Spill
Lloh2:
	adrp	x28, _AV_NOPTS_VALUE@GOTPAGE
Lloh3:
	ldr	x28, [x28, _AV_NOPTS_VALUE@GOTPAGEOFF]
Lloh4:
	adrp	x27, _MMAL_TIME_UNKNOWN@GOTPAGE
Lloh5:
	ldr	x27, [x27, _MMAL_TIME_UNKNOWN@GOTPAGEOFF]
	mov	x26, x22
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x26, x26, x24, lsl #2
	str	x23, [x25, #8]
	cbz	w21, LBB0_5
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	mov	w0, #56
	bl	_av_mallocz
	cbz	x0, LBB0_30
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x23, x0
	str	x26, [x0, #48]
	ldr	x8, [x25, #32]
	ldr	x8, [x8]
	ldr	x8, [x8]
	ldr	w1, [x8]
	mov	x0, x21
	bl	_FFMIN
	mov	x24, x0
	str	x0, [x23, #24]
	cbz	w19, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
Lloh6:
	adrp	x8, _MMAL_BUFFER_HEADER_FLAG_CONFIG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MMAL_BUFFER_HEADER_FLAG_CONFIG@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x23, #16]
	orr	w8, w9, w8
	str	w8, [x23, #16]
LBB0_17:                                ;   in Loop: Header=BB0_14 Depth=1
	cmp	x26, x22
	b.ne	LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_14 Depth=1
Lloh9:
	adrp	x8, _MMAL_BUFFER_HEADER_FLAG_FRAME_START@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MMAL_BUFFER_HEADER_FLAG_FRAME_START@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	ldr	w9, [x23, #16]
	orr	w8, w9, w8
	str	w8, [x23, #16]
LBB0_19:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [x28]
	ldr	x9, [x27]
	ldp	x10, x11, [x20, #8]
	cmp	x10, x8
	csel	x10, x9, x10, eq
	cmp	x11, x8
	csel	x8, x9, x11, eq
	stp	x8, x10, [x23, #32]
	mov	x8, x24
	sub	w21, w21, w24
	cbz	w21, LBB0_22
; %bb.20:                               ;   in Loop: Header=BB0_14 Depth=1
	cbz	x8, LBB0_23
LBB0_21:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	x0, [sp, #8]
	cbnz	x0, LBB0_24
	b	LBB0_25
LBB0_22:                                ;   in Loop: Header=BB0_14 Depth=1
Lloh12:
	adrp	x8, _MMAL_BUFFER_HEADER_FLAG_FRAME_END@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MMAL_BUFFER_HEADER_FLAG_FRAME_END@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x23, #16]
	orr	w8, w9, w8
	str	w8, [x23, #16]
	ldr	x0, [sp]                        ; 8-byte Folded Reload
	mov	w1, #1
	bl	_atomic_fetch_add
	ldr	x8, [x23, #24]
	cbnz	x8, LBB0_21
LBB0_23:                                ;   in Loop: Header=BB0_14 Depth=1
Lloh15:
	adrp	x8, _MMAL_BUFFER_HEADER_FLAG_EOS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MMAL_BUFFER_HEADER_FLAG_EOS@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	w9, [x23, #16]
	orr	w8, w9, w8
	str	w8, [x23, #16]
	mov	w8, #1
	str	w8, [x25]
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_25
LBB0_24:                                ;   in Loop: Header=BB0_14 Depth=1
	bl	_av_buffer_ref
	str	x0, [x23, #8]
	cbz	x0, LBB0_29
LBB0_25:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [x25, #16]
	cbz	x8, LBB0_27
; %bb.26:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [x25, #8]
	cbnz	x8, LBB0_28
	b	LBB0_13
LBB0_27:                                ;   in Loop: Header=BB0_14 Depth=1
	str	x23, [x25, #16]
	ldr	x8, [x25, #8]
	cbz	x8, LBB0_13
LBB0_28:                                ;   in Loop: Header=BB0_14 Depth=1
	str	x23, [x8]
	b	LBB0_13
LBB0_29:
	mov	x0, x23
	bl	_av_free
LBB0_30:
Lloh18:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	bl	_AVERROR
	mov	x19, x0
LBB0_31:
	add	x0, sp, #8
	bl	_av_buffer_unref
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_32:
	mov	w19, #0
	movi.2s	v0, #1
	str	d0, [x25]
	b	LBB0_31
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MMAL_BUFFER_HEADER_FLAG_CONFIG,4,2 ; @MMAL_BUFFER_HEADER_FLAG_CONFIG
	.comm	_MMAL_BUFFER_HEADER_FLAG_FRAME_START,4,2 ; @MMAL_BUFFER_HEADER_FLAG_FRAME_START
	.comm	_AV_NOPTS_VALUE,8,3             ; @AV_NOPTS_VALUE
	.comm	_MMAL_TIME_UNKNOWN,8,3          ; @MMAL_TIME_UNKNOWN
	.comm	_MMAL_BUFFER_HEADER_FLAG_FRAME_END,4,2 ; @MMAL_BUFFER_HEADER_FLAG_FRAME_END
	.comm	_MMAL_BUFFER_HEADER_FLAG_EOS,4,2 ; @MMAL_BUFFER_HEADER_FLAG_EOS
	.no_dead_strip	_ffmmal_add_packet
.subsections_via_symbols
