	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cio2_buffer_done
_cio2_buffer_done:                      ## @cio2_buffer_done
	.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	%esi, %r14d
	movq	(%rdi), %r15
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %r13
	xorl	%eax, %eax
	callq	_ktime_get_ns
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_CIO2_QUEUES@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jbe	LBB0_12
## %bb.1:
	movq	(%r13), %rdx
	movq	24(%r13), %rax
	movq	_CIO2_MAX_LOPS@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	imulq	%rdx, %rcx
	movq	_CIO2_FBPT_CTRL_VALID@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%esi, 4(%rax,%rcx,8)
	je	LBB0_2
## %bb.13:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_warn                       ## TAILCALL
LBB0_12:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_2:
	leaq	(%rax,%rcx,8), %r14
	leaq	12(%r13), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leaq	8(%r13), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	xorl	%edx, %edx
	divq	%rcx
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_CIO2_FBPT_CTRL_VALID@GOTPCREL(%rip), %rsi
	movq	%rdx, (%r13)
	movq	24(%r13), %rax
	movq	(%rbx), %rcx
	imulq	%rdx, %rcx
	leaq	(%rax,%rcx,8), %r14
	movl	(%rsi), %esi
	testl	%esi, 4(%rax,%rcx,8)
	jne	LBB0_11
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%r13), %rax
	movq	(%rax,%rdx,8), %r12
	testq	%r12, %r12
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rbx
	movl	8(%r14), %r15d
	movq	$0, (%rax,%rdx,8)
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_atomic_dec
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movl	12(%r12), %edx
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 8(%r12)
	movq	_V4L2_FIELD_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r12)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_atomic_read
	movl	%eax, 16(%r12)
	movq	(%r12), %rax
	movl	(%rax), %edx
	cmpl	%r15d, %edx
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_dev_warn
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_VB2_BUF_STATE_DONE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_vb2_buffer_done
	movq	%rbx, %r15
	movq	_CIO2_MAX_LOPS@GOTPCREL(%rip), %rbx
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_atomic_inc
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_cio2_fbpt_entry_init_dummy
	movq	(%r13), %rax
	incq	%rax
	movq	_CIO2_MAX_BUFFERS@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	jmp	LBB0_10
LBB0_11:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CIO2_QUEUES,4,2                ## @CIO2_QUEUES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bad DMA channel %i\n"

	.comm	_CIO2_MAX_LOPS,8,3              ## @CIO2_MAX_LOPS
	.comm	_CIO2_FBPT_CTRL_VALID,4,2       ## @CIO2_FBPT_CTRL_VALID
L_.str.1:                               ## @.str.1
	.asciz	"buffer %i done\n"

	.comm	_V4L2_FIELD_NONE,4,2            ## @V4L2_FIELD_NONE
L_.str.2:                               ## @.str.2
	.asciz	"buffer length is %d received %d\n"

	.comm	_VB2_BUF_STATE_DONE,4,2         ## @VB2_BUF_STATE_DONE
	.comm	_CIO2_MAX_BUFFERS,4,2           ## @CIO2_MAX_BUFFERS
L_.str.3:                               ## @.str.3
	.asciz	"no ready buffers found on DMA channel %u\n"

	.no_dead_strip	_cio2_buffer_done
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cio2_buffer_done
_cio2_buffer_done:                      ; @cio2_buffer_done
	.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	x22, x1
	mov	x20, x0
	ldp	x19, x28, [x0]
	bl	_ktime_get_ns
Lloh0:
	adrp	x8, _CIO2_QUEUES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CIO2_QUEUES@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ls	LBB0_3
; %bb.1:
	ldr	x9, [x28, #24]
	ldr	x8, [x28]
Lloh3:
	adrp	x26, _CIO2_MAX_LOPS@GOTPAGE
Lloh4:
	ldr	x26, [x26, _CIO2_MAX_LOPS@GOTPAGEOFF]
	ldr	x10, [x26]
	mul	x10, x10, x8
	add	x24, x9, x10, lsl #3
	ldr	w9, [x24, #4]
Lloh5:
	adrp	x25, _CIO2_FBPT_CTRL_VALID@GOTPAGE
Lloh6:
	ldr	x25, [x25, _CIO2_FBPT_CTRL_VALID@GOTPAGEOFF]
	ldr	w10, [x25]
	tst	w10, w9
	b.eq	LBB0_4
; %bb.2:
	ldr	x0, [x20]
Lloh7:
	adrp	x1, l_.str.3@PAGE
Lloh8:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x22
	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
	b	_dev_warn
LBB0_3:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	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
	b	_dev_err
LBB0_4:
	mov	x21, x0
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	add	x22, x28, #12
	add	x23, x28, #8
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
Lloh11:
	adrp	x8, _VB2_BUF_STATE_DONE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VB2_BUF_STATE_DONE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x27
	bl	_vb2_buffer_done
	mov	x26, x19
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x0, x23
	bl	_atomic_inc
	mov	x0, x20
	mov	x1, x24
	bl	_cio2_fbpt_entry_init_dummy
	ldr	x8, [x28]
	add	x8, x8, #1
Lloh14:
	adrp	x9, _CIO2_MAX_BUFFERS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _CIO2_MAX_BUFFERS@GOTPAGEOFF]
Lloh16:
	ldrsw	x9, [x9]
	udiv	x10, x8, x9
	msub	x8, x10, x9, x8
	str	x8, [x28]
	ldr	x9, [x28, #24]
	ldr	x10, [x26]
	mul	x10, x10, x8
	add	x24, x9, x10, lsl #3
	ldr	w9, [x24, #4]
	ldr	w10, [x25]
	tst	w10, w9
	b.ne	LBB0_10
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x28, #16]
	ldr	x27, [x9, x8, lsl #3]
	cbz	x27, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x19, x26
	ldr	w26, [x24, #8]
	str	xzr, [x9, x8, lsl #3]
	mov	x0, x22
	bl	_atomic_dec
	ldr	x0, [x20]
	ldr	w2, [x27, #12]
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	str	w21, [x27, #8]
Lloh19:
	adrp	x8, _V4L2_FIELD_NONE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _V4L2_FIELD_NONE@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	str	w8, [x27, #20]
	mov	x0, x23
	bl	_atomic_read
	str	w0, [x27, #16]
	ldr	x8, [x27]
	ldr	w2, [x8]
	cmp	w2, w26
	b.eq	LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	str	x26, [sp]
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_warn
	b	LBB0_5
LBB0_10:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_CIO2_QUEUES,4,2                ; @CIO2_QUEUES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bad DMA channel %i\n"

	.comm	_CIO2_MAX_LOPS,8,3              ; @CIO2_MAX_LOPS
	.comm	_CIO2_FBPT_CTRL_VALID,4,2       ; @CIO2_FBPT_CTRL_VALID
l_.str.1:                               ; @.str.1
	.asciz	"buffer %i done\n"

	.comm	_V4L2_FIELD_NONE,4,2            ; @V4L2_FIELD_NONE
l_.str.2:                               ; @.str.2
	.asciz	"buffer length is %d received %d\n"

	.comm	_VB2_BUF_STATE_DONE,4,2         ; @VB2_BUF_STATE_DONE
	.comm	_CIO2_MAX_BUFFERS,4,2           ; @CIO2_MAX_BUFFERS
l_.str.3:                               ; @.str.3
	.asciz	"no ready buffers found on DMA channel %u\n"

	.no_dead_strip	_cio2_buffer_done
.subsections_via_symbols
