	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_read_fdm
_mtk_nfc_read_fdm:                      ## @mtk_nfc_read_fdm
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	callq	_nand_get_controller_data
	movq	%rax, %r13
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_to_mtk_nand
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	testl	%r14d, %r14d
	jle	LBB0_6
## %bb.1:
	movq	%rax, %rbx
	xorl	%r14d, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	incl	%r14d
	cmpl	-44(%rbp), %r14d                ## 4-byte Folded Reload
	je	LBB0_6
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leal	(%r14,%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_oob_ptr
	movq	%rax, %r15
	movl	%r14d, %edi
	callq	_NFI_FDML
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_nfi_readl
	movl	%eax, %r12d
	movl	%r14d, %edi
	callq	_NFI_FDMM
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_nfi_readl
	cmpl	$0, (%rbx)
	jle	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	$4, %rsi
	movl	%r12d, %edi
	cmovael	%eax, %edi
	movl	%edx, %ecx
	andb	$24, %cl
	sarl	%cl, %edi
	movl	%edi, (%r15,%rsi,4)
	incq	%rsi
	movslq	(%rbx), %rcx
	addl	$8, %edx
	cmpq	%rcx, %rsi
	jl	LBB0_4
	jmp	LBB0_5
LBB0_6:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_mtk_nfc_read_fdm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_nfc_read_fdm
_mtk_nfc_read_fdm:                      ; @mtk_nfc_read_fdm
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	bl	_nand_get_controller_data
	mov	x22, x0
	mov	x0, x21
	bl	_to_mtk_nand
	cmp	w19, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x23, x0
	mov	w24, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w24, w24, #1
	cmp	w24, w19
	b.eq	LBB0_6
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	add	w1, w24, w20
	mov	x0, x21
	bl	_oob_ptr
	mov	x25, x0
	mov	x0, x24
	bl	_NFI_FDML
	mov	x1, x0
	mov	x0, x22
	bl	_nfi_readl
	mov	x26, x0
	mov	x0, x24
	bl	_NFI_FDMM
	mov	x1, x0
	mov	x0, x22
	bl	_nfi_readl
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w8, #0
	mov	x9, #0
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x9, #3
	csel	w10, w0, w26, hi
	and	w11, w8, #0x18
	asr	w10, w10, w11
	str	w10, [x25, x9, lsl #2]
	add	x9, x9, #1
	ldrsw	x10, [x23]
	add	w8, w8, #8
	cmp	x9, x10
	b.lt	LBB0_5
	b	LBB0_2
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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_mtk_nfc_read_fdm
.subsections_via_symbols
