	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_set_fdm
_mtk_nfc_set_fdm:                       ## @mtk_nfc_set_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_mtd_to_nand
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_to_mtk_nand
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movl	(%rbx), %ebx
	movl	(%rax), %edi
	callq	_mtk_ecc_get_parity_bits
	imull	%eax, %ebx
	movl	%ebx, %edi
	movl	$8, %esi
	callq	_DIV_ROUND_UP
	movq	(%r15), %rcx
	subq	%rax, %rcx
	movq	%rcx, (%r14)
	movq	_NFI_FDM_MAX_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	cmovgeq	%rax, %rcx
	movq	%rcx, (%r14)
	movl	$1, 8(%r14)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NFI_FDM_MAX_SIZE,8,3           ## @NFI_FDM_MAX_SIZE
	.no_dead_strip	_mtk_nfc_set_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_set_fdm
_mtk_nfc_set_fdm:                       ; @mtk_nfc_set_fdm
	.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
	mov	x19, x0
	mov	x0, x1
	bl	_mtd_to_nand
	mov	x20, x0
	bl	_to_mtk_nand
	mov	x21, x0
	mov	x0, x20
	bl	_nand_get_controller_data
	ldr	w20, [x20]
	ldr	w0, [x0]
	bl	_mtk_ecc_get_parity_bits
	mul	w0, w0, w20
	mov	w1, #8
	bl	_DIV_ROUND_UP
	ldr	x8, [x21]
	sub	x8, x8, x0
	str	x8, [x19]
Lloh0:
	adrp	x9, _NFI_FDM_MAX_SIZE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NFI_FDM_MAX_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	csel	x8, x8, x9, lt
	str	x8, [x19]
	mov	w8, #1
	str	w8, [x19, #8]
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NFI_FDM_MAX_SIZE,8,3           ; @NFI_FDM_MAX_SIZE
	.no_dead_strip	_mtk_nfc_set_fdm
.subsections_via_symbols
