	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_sha_append_sg
_mtk_sha_append_sg:                     ## @mtk_sha_append_sg
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rax
	movq	_SHA_BUF_SIZE@GOTPCREL(%rip), %r15
	cmpq	(%r15), %rax
	jge	LBB0_8
## %bb.1:
	movq	%rdi, %rbx
	jmp	LBB0_2
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, 16(%rbx)
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rax
	cmpq	(%r15), %rax
	jge	LBB0_8
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	32(%rbx), %rax
	movq	(%rax), %rdi
	subq	16(%rbx), %rdi
	callq	_min
	movq	(%r15), %rsi
	subq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_min
	testq	%rax, %rax
	je	LBB0_4
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %r14
	movq	(%rbx), %rdi
	movq	16(%rbx), %rdx
	addq	24(%rbx), %rdi
	movq	32(%rbx), %rsi
	movq	%rax, %rcx
	xorl	%r8d, %r8d
	callq	_scatterwalk_map_and_copy
	addq	%r14, (%rbx)
	movq	16(%rbx), %rax
	addq	%r14, %rax
	movq	%rax, 16(%rbx)
	subq	%r14, 8(%rbx)
	movq	32(%rbx), %rdi
	cmpq	(%rdi), %rax
	jne	LBB0_7
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	callq	_sg_next
	movq	%rax, 32(%rbx)
	testq	%rax, %rax
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, 8(%rbx)
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	32(%rbx), %rdi
	cmpq	$0, (%rdi)
	jne	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	callq	_sg_is_last
	testl	%eax, %eax
	jne	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	32(%rbx), %rdi
	callq	_sg_next
	movq	%rax, 32(%rbx)
	jmp	LBB0_7
LBB0_8:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SHA_BUF_SIZE,8,3               ## @SHA_BUF_SIZE
	.no_dead_strip	_mtk_sha_append_sg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_sha_append_sg
_mtk_sha_append_sg:                     ; @mtk_sha_append_sg
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x21, _SHA_BUF_SIZE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SHA_BUF_SIZE@GOTPAGEOFF]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ge	LBB0_12
; %bb.1:
	mov	x19, x0
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x19, #16]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x19]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ge	LBB0_12
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x19, #8]
	cbz	x1, LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x19, #32]
	ldr	x8, [x8]
	ldr	x9, [x19, #16]
	sub	x0, x8, x9
	bl	_min
	ldr	x8, [x21]
	ldr	x9, [x19]
	sub	x1, x8, x9
	bl	_min
	cbz	x0, LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x20, x0
	ldr	x8, [x19]
	ldp	x2, x9, [x19, #16]
	add	x0, x8, x9
	ldr	x1, [x19, #32]
	mov	x3, x20
	mov	w4, #0
	bl	_scatterwalk_map_and_copy
	ldp	x8, x9, [x19]
	add	x8, x8, x20
	ldr	x10, [x19, #16]
	ldr	x0, [x19, #32]
	ldr	x11, [x0]
	add	x10, x10, x20
	cmp	x10, x11
	sub	x9, x9, x20
	str	x8, [x19]
	stp	x9, x10, [x19, #8]
	b.ne	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	bl	_sg_next
	str	x0, [x19, #32]
	cbnz	x0, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x19, #8]
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x0, [x19, #32]
	ldr	x8, [x0]
	cbnz	x8, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	bl	_sg_is_last
	cbnz	w0, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	ldr	x0, [x19, #32]
	bl	_sg_next
	str	x0, [x19, #32]
	b	LBB0_3
LBB0_12:
	mov	w0, #0
	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 AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_SHA_BUF_SIZE,8,3               ; @SHA_BUF_SIZE
	.no_dead_strip	_mtk_sha_append_sg
.subsections_via_symbols
