	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sahara_sha_hw_links_create
_sahara_sha_hw_links_create:            ## @sahara_sha_hw_links_create
	.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
	movl	%edx, %r14d
	movq	%rdi, %r15
	movq	8(%rsi), %rdi
	movq	%rdi, 24(%r15)
	movl	(%rsi), %esi
	callq	_sg_nents_for_len
	movl	%eax, (%r15)
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%eax, %edx
	movq	_SAHARA_MAX_HW_LINK@GOTPCREL(%rip), %rax
	cmpq	%rdx, (%rax)
	jge	LBB0_4
## %bb.3:
	movl	32(%r15), %edi
	addq	40(%r15), %rdx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_12
LBB0_1:
	movl	32(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movl	(%r15), %r14d
	jmp	LBB0_12
LBB0_4:
	movq	24(%r15), %r12
	movl	32(%r15), %edi
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	callq	_dma_map_sg
	testl	%eax, %eax
	je	LBB0_13
## %bb.5:
	movl	(%r15), %eax
	leal	(%rax,%r14), %ecx
	cmpl	%r14d, %ecx
	jbe	LBB0_12
## %bb.6:
	movl	%r14d, %ebx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%r15), %rax
	movq	8(%rax,%rbx,8), %rax
	incq	%rbx
	movq	%rax, (%rdx)
	movq	%r12, %rdi
	callq	_sg_next
	movq	%rax, %r12
	movl	(%r15), %eax
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	leal	(%rax,%r14), %ecx
	cmpq	%rcx, %rbx
	jae	LBB0_11
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%r12), %esi
	movq	16(%r15), %rdx
	movq	(%rdx,%rbx,8), %rdx
	movl	%esi, 12(%rdx)
	movl	(%r12), %esi
	movl	%esi, 8(%rdx)
	decl	%ecx
	cmpq	%rcx, %rbx
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	$0, (%rdx)
	incq	%rbx
	jmp	LBB0_10
LBB0_13:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_12
LBB0_11:
	movl	%ebx, %r14d
LBB0_12:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid numbers of src SG.\n"

	.comm	_SAHARA_MAX_HW_LINK,8,3         ## @SAHARA_MAX_HW_LINK
L_.str.1:                               ## @.str.1
	.asciz	"not enough hw links (%d)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_EFAULT,4,2                     ## @EFAULT
	.no_dead_strip	_sahara_sha_hw_links_create
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sahara_sha_hw_links_create
_sahara_sha_hw_links_create:            ; @sahara_sha_hw_links_create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x2
	mov	x20, x0
	ldr	x0, [x1, #8]
	str	x0, [x20, #24]
	ldr	w1, [x1]
	bl	_sg_nents_for_len
	str	w0, [x20]
	tbnz	w0, #31, LBB0_3
; %bb.1:
	mov	w2, w0
Lloh0:
	adrp	x8, _SAHARA_MAX_HW_LINK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SAHARA_MAX_HW_LINK@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x2
	b.ge	LBB0_4
; %bb.2:
	ldr	w0, [x20, #32]
	ldr	x8, [x20, #40]
	add	x8, x8, x2
	str	x8, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_3:
	ldr	w0, [x20, #32]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	w19, [x20]
	b	LBB0_13
LBB0_4:
	ldr	x21, [x20, #24]
	ldr	w0, [x20, #32]
Lloh9:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh11:
	ldr	w3, [x8]
	mov	x1, x21
	bl	_dma_map_sg
	cbz	w0, LBB0_11
; %bb.5:
	ldr	w8, [x20]
	add	w9, w8, w19
	cmp	w9, w19
	b.ls	LBB0_13
; %bb.6:
	mov	w22, w19
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x20, #8]
	add	x22, x22, #1
	ldr	x8, [x8, x22, lsl #3]
	str	x8, [x10]
	mov	x0, x21
	bl	_sg_next
	mov	x21, x0
	ldr	w8, [x20]
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	w9, w8, w19
	cmp	x22, x9
	b.hs	LBB0_14
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x20, #16]
	ldr	x10, [x10, x22, lsl #3]
	ldr	d0, [x21]
	str	d0, [x10, #8]
	sub	w9, w9, #1
	cmp	x22, x9
	b.ne	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	str	xzr, [x10]
	add	x22, x22, #1
	b	LBB0_8
LBB0_11:
Lloh12:
	adrp	x8, _EFAULT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_13:
	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
	add	sp, sp, #64
	ret
LBB0_14:
	mov	x19, x22
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid numbers of src SG.\n"

	.comm	_SAHARA_MAX_HW_LINK,8,3         ; @SAHARA_MAX_HW_LINK
l_.str.1:                               ; @.str.1
	.asciz	"not enough hw links (%d)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_EFAULT,4,2                     ; @EFAULT
	.no_dead_strip	_sahara_sha_hw_links_create
.subsections_via_symbols
