	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dvb_ringbuffer_pkt_read        ## -- Begin function dvb_ringbuffer_pkt_read
	.p2align	4, 0x90
_dvb_ringbuffer_pkt_read:               ## @dvb_ringbuffer_pkt_read
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movl	%edx, %ecx
	movq	%rdi, %r15
	movq	(%rdi), %rdi
	movq	8(%r15), %r12
	movl	(%rdi,%rsi,4), %ebx
	shll	$8, %ebx
	leaq	1(%rsi), %rax
	movq	%rax, %rdx
	orq	%r12, %rdx
	shrq	$32, %rdx
	je	LBB0_1
## %bb.2:
	xorl	%edx, %edx
	divq	%r12
	jmp	LBB0_3
LBB0_1:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r12d
                                        ## kill: def $edx killed $edx def $rdx
LBB0_3:
	orl	(%rdi,%rdx,4), %ebx
	cmpl	%ecx, %ebx
	jae	LBB0_5
## %bb.4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subq	(%rax), %rbx
	jmp	LBB0_12
LBB0_5:
	movslq	%ebx, %rax
	movslq	%ecx, %rcx
	leaq	(%rcx,%r8), %rdx
	movq	%rax, %rbx
	subq	%rcx, %rbx
	cmpq	%rax, %rdx
	cmovbeq	%r8, %rbx
	movq	_DVB_RINGBUFFER_PKTHDRSIZE@GOTPCREL(%rip), %rax
	addq	%rcx, %rsi
	addq	(%rax), %rsi
	movq	%rsi, %rax
	orq	%r12, %rax
	shrq	$32, %rax
	je	LBB0_6
## %bb.7:
	movq	%rsi, %rax
	xorl	%edx, %edx
	divq	%r12
	jmp	LBB0_8
LBB0_6:
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%r12d
                                        ## kill: def $edx killed $edx def $rdx
LBB0_8:
	leaq	(%rdx,%rbx), %rax
	cmpq	%r12, %rax
	jbe	LBB0_9
## %bb.10:
	subq	%rdx, %r12
	leaq	(%rdi,%rdx,4), %rsi
	movq	%r14, %rdi
	movq	%r12, %rdx
	callq	_memcpy
	leaq	(%r14,%r12,4), %r14
	movq	%rbx, %rax
	subq	%r12, %rax
	movq	(%r15), %rdi
	xorl	%edx, %edx
	jmp	LBB0_11
LBB0_9:
	movq	%rbx, %rax
LBB0_11:
	leaq	(%rdi,%rdx,4), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	callq	_memcpy
LBB0_12:
	movq	%rbx, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,8,3                     ## @EINVAL
	.comm	_DVB_RINGBUFFER_PKTHDRSIZE,8,3  ## @DVB_RINGBUFFER_PKTHDRSIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dvb_ringbuffer_pkt_read        ; -- Begin function dvb_ringbuffer_pkt_read
	.p2align	2
_dvb_ringbuffer_pkt_read:               ; @dvb_ringbuffer_pkt_read
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
                                        ; kill: def $w2 killed $w2 def $x2
	ldp	x8, x10, [x0]
	ldr	w9, [x8, x1, lsl #2]
	add	x11, x1, #1
	udiv	x12, x11, x10
	msub	x11, x12, x10, x11
	ldr	w11, [x8, x11, lsl #2]
	orr	w9, w11, w9, lsl #8
	cmp	w9, w2
	b.hs	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	neg	x20, x8
	b	LBB0_6
LBB0_2:
	mov	x19, x3
	sxtw	x9, w9
	sxtw	x11, w2
	sub	x12, x9, x11
	add	x13, x11, x4
	cmp	x13, x9
	csel	x20, x12, x4, hi
Lloh3:
	adrp	x9, _DVB_RINGBUFFER_PKTHDRSIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DVB_RINGBUFFER_PKTHDRSIZE@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x11, x11, x1
	add	x9, x11, x9
	udiv	x11, x9, x10
	msub	x9, x11, x10, x9
	add	x11, x9, x20
	cmp	x11, x10
	b.ls	LBB0_4
; %bb.3:
	mov	x21, x0
	sub	x22, x10, x9
	add	x1, x8, x9, lsl #2
	mov	x0, x19
	mov	x2, x22
	bl	_memcpy
	mov	x9, #0
	add	x19, x19, x22, lsl #2
	sub	x2, x20, x22
	ldr	x8, [x21]
	b	LBB0_5
LBB0_4:
	mov	x2, x20
LBB0_5:
	add	x1, x8, x9, lsl #2
	mov	x0, x19
	bl	_memcpy
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,8,3                     ; @EINVAL
	.comm	_DVB_RINGBUFFER_PKTHDRSIZE,8,3  ; @DVB_RINGBUFFER_PKTHDRSIZE
.subsections_via_symbols
