	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sg_to_link_tbl
_sg_to_link_tbl:                        ## @sg_to_link_tbl
	.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	%rcx, %rbx
	movl	%edx, %r15d
	movl	%esi, %r14d
	testl	%esi, %esi
	je	LBB0_3
## %bb.1:
	movq	%rdi, %r12
	movl	%r14d, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_sg_dma_address
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_to_talitos_ptr
	movq	%r12, %rdi
	callq	_sg_dma_len
	movl	%eax, %edi
	callq	_cpu_to_be16
	movq	%rax, 8(%rbx)
	movq	$0, (%rbx)
	addq	$16, %rbx
	movq	%r12, %rdi
	callq	_sg_dma_len
	subl	%eax, %r15d
	movq	%r12, %rdi
	callq	_scatterwalk_sg_next
	movq	%rax, %r12
	decl	%r13d
	jne	LBB0_2
LBB0_3:
	movq	-8(%rbx), %rdi
	callq	_be16_to_cpu
	movl	%r15d, %ecx
	negl	%ecx
	cmpl	%ecx, %eax
	jle	LBB0_5
## %bb.4:
	leaq	-8(%rbx), %r12
	jmp	LBB0_8
LBB0_5:
	addq	$-8, %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdi
	callq	_be16_to_cpu
	addl	%eax, %r15d
	movq	$0, (%rbx)
	decl	%r14d
	movq	-16(%rbx), %rdi
	addq	$-16, %rbx
	callq	_be16_to_cpu
	movl	%r15d, %ecx
	negl	%ecx
	cmpl	%ecx, %eax
	jle	LBB0_6
## %bb.7:
	movq	%rbx, %r12
	addq	$8, %rbx
LBB0_8:
	movq	(%r12), %rdi
	callq	_be16_to_cpu
	addl	%eax, %r15d
	movl	%r15d, %edi
	callq	_cpu_to_be16
	movq	%rax, (%r12)
	movq	_DESC_PTR_LNKTBL_RETURN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -16(%rbx)
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DESC_PTR_LNKTBL_RETURN,8,3     ## @DESC_PTR_LNKTBL_RETURN
	.no_dead_strip	_sg_to_link_tbl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sg_to_link_tbl
_sg_to_link_tbl:                        ; @sg_to_link_tbl
	.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	x21, x3
	mov	x20, x2
	mov	x19, x1
	cbz	w1, LBB0_3
; %bb.1:
	mov	x22, x0
	mov	x23, x19
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	sub	w23, w23, #1
	mov	x0, x22
	bl	_sg_dma_address
	mov	x1, x0
	mov	x0, x21
	bl	_to_talitos_ptr
	mov	x0, x22
	bl	_sg_dma_len
	bl	_cpu_to_be16
	stp	xzr, x0, [x21], #16
	mov	x0, x22
	bl	_sg_dma_len
	sub	w20, w20, w0
	mov	x0, x22
	bl	_scatterwalk_sg_next
	mov	x22, x0
	cbnz	w23, LBB0_2
LBB0_3:
	mov	x22, x21
	ldr	x0, [x22, #-8]!
	bl	_be16_to_cpu
	neg	w8, w20
	cmp	w0, w8
	b.gt	LBB0_7
; %bb.4:
	sub	x22, x21, #8
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x22]
	bl	_be16_to_cpu
	add	w20, w0, w20
	str	xzr, [x22]
	sub	w19, w19, #1
	ldr	x0, [x22, #-16]!
	bl	_be16_to_cpu
	neg	w8, w20
	cmp	w0, w8
	b.le	LBB0_5
; %bb.6:
	add	x21, x22, #8
LBB0_7:
	ldr	x0, [x22]
	bl	_be16_to_cpu
	add	w0, w0, w20
	bl	_cpu_to_be16
	str	x0, [x22]
Lloh0:
	adrp	x8, _DESC_PTR_LNKTBL_RETURN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DESC_PTR_LNKTBL_RETURN@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x21, #-16]
	mov	x0, x19
	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
	.cfi_endproc
                                        ; -- End function
	.comm	_DESC_PTR_LNKTBL_RETURN,8,3     ; @DESC_PTR_LNKTBL_RETURN
	.no_dead_strip	_sg_to_link_tbl
.subsections_via_symbols
