	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hisi_nfc_cmdfunc
_hisi_nfc_cmdfunc:                      ## @hisi_nfc_cmdfunc
	.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
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, %r12d
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r13
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r15
	movl	%r14d, (%rax)
	leal	-128(%r14), %eax
	cmpl	$8, %eax
	ja	LBB0_13
## %bb.1:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rdx
	addq	%rcx, %rdx
	movl	%r12d, %eax
	jmpq	*%rdx
LBB0_9:
	movq	_HINFC504_CON@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_hinfc_read
	movl	%eax, %r14d
	movl	(%rbx), %eax
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_11
## %bb.10:
	movq	_HINFC504_CON_ECCTYPE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_HINFC504_CON_ECCTYPE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	notl	%eax
	movl	%r14d, %esi
	andl	%eax, %esi
	movl	(%r12), %edx
	movq	%r15, %rdi
	callq	_hinfc_write
LBB0_11:
	movl	$0, 4(%r15)
	movl	24(%r15), %edi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movq	%r15, %rdi
	callq	_hisi_nfc_send_cmd_status
	movl	(%r12), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_hinfc_write
	jmp	LBB0_14
LBB0_4:
	movl	%r12d, 4(%r15)
LBB0_5:
	movq	%r13, %rdi
	movl	%r12d, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_set_addr
	jmp	LBB0_14
LBB0_12:
	movl	20(%r15), %esi
	movq	%r15, %rdi
	callq	_hisi_nfc_send_cmd_reset
	jmp	LBB0_14
LBB0_6:
	movq	%r15, %rdi
	callq	_hisi_nfc_send_cmd_pageprog
	jmp	LBB0_14
LBB0_13:
	movl	16(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	callq	_dev_err
	jmp	LBB0_14
LBB0_2:
	movl	(%r13), %eax
	addl	%r12d, %eax
LBB0_3:
	movl	%eax, 4(%r15)
	movq	%r13, %rdi
	movl	%r12d, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_set_addr
	movq	%r15, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_hisi_nfc_send_cmd_readstart    ## TAILCALL
LBB0_8:
	movl	%r12d, 4(%r15)
	movl	24(%r15), %edi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movq	%r15, %rdi
	callq	_hisi_nfc_send_cmd_readid
	jmp	LBB0_14
LBB0_7:
	movq	%r15, %rdi
	callq	_hisi_nfc_send_cmd_erase
LBB0_14:
	movq	8(%r15), %rax
	movq	$-1, (%rax)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_9, LBB0_9-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_8, LBB0_8-LJTI0_0
.set L0_0_set_3, LBB0_3-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
LJTI0_0:
	.long	L0_0_set_9
	.long	L0_0_set_4
	.long	L0_0_set_12
	.long	L0_0_set_2
	.long	L0_0_set_8
	.long	L0_0_set_3
	.long	L0_0_set_6
	.long	L0_0_set_7
	.long	L0_0_set_5
	.end_data_region
                                        ## -- End function
	.comm	_HINFC504_CON,4,2               ## @HINFC504_CON
	.comm	_NAND_ECC_HW,4,2                ## @NAND_ECC_HW
	.comm	_HINFC504_CON_ECCTYPE_MASK,4,2  ## @HINFC504_CON_ECCTYPE_MASK
	.comm	_HINFC504_CON_ECCTYPE_SHIFT,4,2 ## @HINFC504_CON_ECCTYPE_SHIFT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error: unsupported cmd(cmd=%x, col=%x, page=%x)\n"

	.no_dead_strip	_hisi_nfc_cmdfunc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hisi_nfc_cmdfunc
_hisi_nfc_cmdfunc:                      ; @hisi_nfc_cmdfunc
	.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	x20, x3
	mov	x21, x2
	mov	x24, x1
	mov	x22, x0
	bl	_nand_to_mtd
	mov	x23, x0
	mov	x0, x22
	bl	_nand_get_controller_data
	mov	x19, x0
	str	w24, [x0]
	sub	w8, w24, #128
	cmp	w8, #8
	b.hi	LBB0_9
; %bb.1:
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_2
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	mov	x8, x21
	br	x10
LBB0_2:
Lloh2:
	adrp	x21, _HINFC504_CON@GOTPAGE
Lloh3:
	ldr	x21, [x21, _HINFC504_CON@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_hinfc_read
	mov	x20, x0
	ldr	w8, [x22]
Lloh4:
	adrp	x9, _NAND_ECC_HW@GOTPAGE
Lloh5:
	ldr	x9, [x9, _NAND_ECC_HW@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_4
; %bb.3:
Lloh7:
	adrp	x8, _HINFC504_CON_ECCTYPE_MASK@GOTPAGE
Lloh8:
	ldr	x8, [x8, _HINFC504_CON_ECCTYPE_MASK@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _HINFC504_CON_ECCTYPE_SHIFT@GOTPAGE
Lloh11:
	ldr	x9, [x9, _HINFC504_CON_ECCTYPE_SHIFT@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	bic	w1, w20, w8
	ldr	w2, [x21]
	mov	x0, x19
	bl	_hinfc_write
LBB0_4:
	str	wzr, [x19, #4]
	ldr	w0, [x19, #24]
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	mov	x0, x19
	bl	_hisi_nfc_send_cmd_status
	ldr	w2, [x21]
	mov	x0, x19
	mov	x1, x20
	bl	_hinfc_write
	b	LBB0_14
LBB0_5:
	str	w21, [x19, #4]
LBB0_6:
	mov	x0, x23
	mov	x1, x21
	mov	x2, x20
	bl	_set_addr
	b	LBB0_14
LBB0_7:
	ldr	w1, [x19, #20]
	mov	x0, x19
	bl	_hisi_nfc_send_cmd_reset
	b	LBB0_14
LBB0_8:
	mov	x0, x19
	bl	_hisi_nfc_send_cmd_pageprog
	b	LBB0_14
LBB0_9:
	ldr	w0, [x19, #16]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x24
	mov	x3, x21
	mov	x4, x20
	bl	_dev_err
	b	LBB0_14
LBB0_10:
	ldr	w8, [x23]
	add	w8, w8, w21
LBB0_11:
	str	w8, [x19, #4]
	mov	x0, x23
	mov	x1, x21
	mov	x2, x20
	bl	_set_addr
	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
	b	_hisi_nfc_send_cmd_readstart
LBB0_12:
	str	w21, [x19, #4]
	ldr	w0, [x19, #24]
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	mov	x0, x19
	bl	_hisi_nfc_send_cmd_readid
	b	LBB0_14
LBB0_13:
	mov	x0, x19
	bl	_hisi_nfc_send_cmd_erase
LBB0_14:
	ldr	x8, [x19, #8]
	movi.2d	v0, #0xffffffffffffffff
	str	d0, [x8]
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_5-LBB0_2)>>2
	.byte	(LBB0_7-LBB0_2)>>2
	.byte	(LBB0_10-LBB0_2)>>2
	.byte	(LBB0_12-LBB0_2)>>2
	.byte	(LBB0_11-LBB0_2)>>2
	.byte	(LBB0_8-LBB0_2)>>2
	.byte	(LBB0_13-LBB0_2)>>2
	.byte	(LBB0_6-LBB0_2)>>2
                                        ; -- End function
	.comm	_HINFC504_CON,4,2               ; @HINFC504_CON
	.comm	_NAND_ECC_HW,4,2                ; @NAND_ECC_HW
	.comm	_HINFC504_CON_ECCTYPE_MASK,4,2  ; @HINFC504_CON_ECCTYPE_MASK
	.comm	_HINFC504_CON_ECCTYPE_SHIFT,4,2 ; @HINFC504_CON_ECCTYPE_SHIFT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error: unsupported cmd(cmd=%x, col=%x, page=%x)\n"

	.no_dead_strip	_hisi_nfc_cmdfunc
.subsections_via_symbols
