	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function td_fill_desc
_td_fill_desc:                          ## @td_fill_desc
	.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
	movl	%ecx, %r14d
	movq	%rdx, %r13
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	%rdx, %rdi
	callq	_sg_dma_len
	movq	_USHRT_MAX@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_3
## %bb.1:
	movq	%rbx, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_2
LBB0_3:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	%r13, %rdi
	callq	_sg_dma_len
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_chan2dev
	movl	%eax, %r12d
	testb	$3, %r14b
	je	LBB0_5
## %bb.4:
	movq	%r13, %rdi
	callq	_sg_dma_len
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%r12d, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_6
LBB0_5:
	movq	%r13, %rdi
	callq	_sg_dma_address
	movslq	%eax, %rcx
	leaq	L_.str.2(%rip), %rsi
	movl	%r12d, %edi
	movq	%r15, %rdx
	callq	_dev_dbg
	movq	%r13, %rdi
	callq	_sg_dma_address
	shrl	$24, %eax
	movl	%eax, 28(%r15)
	movq	%r13, %rdi
	callq	_sg_dma_address
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, 24(%r15)
	movq	%r13, %rdi
	callq	_sg_dma_address
	movzbl	%ah, %eax
	movl	%eax, 20(%r15)
	movq	%r13, %rdi
	callq	_sg_dma_address
	movzbl	%al, %eax
	movl	%eax, 16(%r15)
	movq	%r13, %rdi
	callq	_sg_dma_len
	movzbl	%ah, %eax
	movl	%eax, 12(%r15)
	movq	%r13, %rdi
	callq	_sg_dma_len
	movzbl	%al, %eax
	movl	%eax, 8(%r15)
	movl	$0, 4(%r15)
	xorl	%eax, %eax
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	setne	%al
	addl	%eax, %eax
	addl	$33, %eax
	movl	%eax, (%r15)
	xorl	%ebx, %ebx
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USHRT_MAX,4,2                  ## @USHRT_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Too big sg element\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Incorrect length: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"desc: %p, addr: 0x%llx\n"

	.no_dead_strip	_td_fill_desc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function td_fill_desc
_td_fill_desc:                          ; @td_fill_desc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x3
	mov	x21, x2
	mov	x20, x1
	mov	x22, x0
	mov	x0, x2
	bl	_sg_dma_len
Lloh0:
	adrp	x8, _USHRT_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _USHRT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, w8
	b.le	LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_chan2dev
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	mov	x0, x21
	bl	_sg_dma_len
	and	w23, w0, #0x3
	mov	x0, x22
	bl	_chan2dev
	mov	x22, x0
	cbz	w23, LBB0_5
; %bb.3:
	mov	x0, x21
	bl	_sg_dma_len
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
LBB0_4:
	bl	_dev_err
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_5:
	mov	x0, x21
	bl	_sg_dma_address
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x3, w0
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x22
	mov	x2, x20
	bl	_dev_dbg
	mov	x0, x21
	bl	_sg_dma_address
	lsr	w8, w0, #24
	str	w8, [x20, #28]
	mov	x0, x21
	bl	_sg_dma_address
	ubfx	w8, w0, #16, #8
	str	w8, [x20, #24]
	mov	x0, x21
	bl	_sg_dma_address
	ubfx	w8, w0, #8, #8
	str	w8, [x20, #20]
	mov	x0, x21
	bl	_sg_dma_address
	and	w8, w0, #0xff
	str	w8, [x20, #16]
	mov	x0, x21
	bl	_sg_dma_len
	ubfx	w8, w0, #8, #8
	str	w8, [x20, #12]
	mov	x0, x21
	bl	_sg_dma_len
	mov	x8, x0
	mov	w0, #0
	and	w8, w8, #0xff
	stp	wzr, w8, [x20, #4]
	mov	w8, #35
	mov	w9, #33
	cmp	w19, #0
	csel	w8, w9, w8, eq
	str	w8, [x20]
LBB0_6:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_USHRT_MAX,4,2                  ; @USHRT_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Too big sg element\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Incorrect length: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"desc: %p, addr: 0x%llx\n"

	.no_dead_strip	_td_fill_desc
.subsections_via_symbols
