	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunxi_nand_chip_init
_sunxi_nand_chip_init:                  ## @sunxi_nand_chip_init
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r13
	movq	%rsi, %rbx
	movq	%rdi, %r14
	leaq	L_.str(%rip), %rsi
	leaq	-44(%rbp), %rdx
	movq	%r13, %rdi
	callq	_of_get_property
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	-44(%rbp), %eax
	movl	%eax, %edx
	sarl	$2, %edx
	movl	%edx, -44(%rbp)
	cmpl	$3, %eax
	ja	LBB0_5
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_5:
	movq	_sels@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_struct_size
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_devm_kzalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	%rax, %r12
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %eax
	movl	%eax, (%r12)
	cmpl	$0, -44(%rbp)
	jle	LBB0_17
## %bb.8:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	$16, %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	leaq	-48(%rbp), %r14
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edx
	movq	%r14, %rcx
	callq	_of_property_read_u32_index
	testl	%eax, %eax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	-48(%rbp), %edx
	movq	_NFC_MAX_CS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jg	LBB0_12
## %bb.14:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%edx, %edi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_test_and_set_bit
	movl	-48(%rbp), %edx
	testq	%rax, %rax
	jne	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	24(%r12), %rax
	movl	%edx, (%rax,%r15,8)
	movq	%r13, %rdi
	leaq	L_.str.6(%rip), %rsi
	movl	%r15d, %edx
	movq	%r14, %rcx
	callq	_of_property_read_u32_index
	movl	-48(%rbp), %ecx
	negl	%eax
	movl	$0, %eax
	sbbl	%eax, %eax
	cmpl	$2, %ecx
	movq	24(%r12), %rdx
	movl	$-1, %esi
	cmovgel	%esi, %ecx
	orl	%eax, %ecx
	movl	%ecx, 4(%rdx,%r15,8)
	incq	%r15
	movslq	-44(%rbp), %rax
	cmpq	%rax, %r15
	jl	LBB0_9
LBB0_17:
	leaq	8(%r12), %r14
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	8(%rcx), %rax
	movq	%rax, 16(%r12)
	movq	_sunxi_nand_controller_ops@GOTPCREL(%rip), %rax
	movq	%rax, 8(%rcx)
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r12)
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_nand_set_flash_node
	movq	%r14, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r15
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r15)
	movl	-44(%rbp), %esi
	movq	%r14, %rdi
	callq	_nand_scan
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_21
## %bb.18:
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_mtd_device_register
	testl	%eax, %eax
	je	LBB0_20
## %bb.19:
	movl	%eax, %r15d
	leaq	L_.str.7(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	callq	_nand_release
	movl	%r15d, %ebx
	jmp	LBB0_21
LBB0_6:
	leaq	L_.str.2(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_10:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_21
LBB0_12:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_13
LBB0_15:
	leaq	L_.str.5(%rip), %rsi
LBB0_13:
	xorl	%ebx, %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_4
LBB0_20:
	addq	$4, %r12
	movq	%r12, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_list_add_tail
LBB0_21:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"reg"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"invalid reg property size\n"

	.comm	_sels,4,2                       ## @sels
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"could not allocate chip\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.3:                               ## @.str.3
	.asciz	"could not retrieve reg property: %d\n"

	.comm	_NFC_MAX_CS,4,2                 ## @NFC_MAX_CS
L_.str.4:                               ## @.str.4
	.asciz	"invalid reg value: %u (max CS = 7)\n"

L_.str.5:                               ## @.str.5
	.asciz	"CS %d already assigned\n"

L_.str.6:                               ## @.str.6
	.asciz	"allwinner,rb"

	.comm	_sunxi_nand_controller_ops,4,2  ## @sunxi_nand_controller_ops
	.comm	_NAND_ECC_HW,4,2                ## @NAND_ECC_HW
L_.str.7:                               ## @.str.7
	.asciz	"failed to register mtd device: %d\n"

	.no_dead_strip	_sunxi_nand_chip_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunxi_nand_chip_init
_sunxi_nand_chip_init:                  ; @sunxi_nand_chip_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #28
	mov	x0, x22
	bl	_of_get_property
	cbz	w0, LBB0_4
; %bb.1:
	ldr	w8, [sp, #28]
	asr	w2, w8, #2
	str	w2, [sp, #28]
	cmp	w8, #3
	b.hi	LBB0_7
; %bb.2:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_3:
	mov	x0, x19
	bl	_dev_err
LBB0_4:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w28, w8
LBB0_6:
	mov	x0, x28
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_7:
Lloh6:
	adrp	x8, _sels@GOTPAGE
Lloh7:
	ldr	x8, [x8, _sels@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	bl	_struct_size
	mov	x1, x0
Lloh9:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_devm_kzalloc
	cbz	x0, LBB0_17
; %bb.8:
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
	mov	x21, x0
	ldr	w8, [sp, #28]
	str	w8, [x0]
	ldr	w8, [sp, #28]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.9:
	mov	x23, #0
	mov	x24, #0
	add	x25, x20, #16
Lloh12:
	adrp	x26, l_.str@PAGE
Lloh13:
	add	x26, x26, l_.str@PAGEOFF
Lloh14:
	adrp	x27, _NFC_MAX_CS@GOTPAGE
Lloh15:
	ldr	x27, [x27, _NFC_MAX_CS@GOTPAGEOFF]
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	x3, sp, #24
	mov	x0, x22
	mov	x1, x26
	mov	x2, x24
	bl	_of_property_read_u32_index
	cbnz	w0, LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w0, [sp, #24]
	ldr	w8, [x27]
	cmp	w0, w8
	b.gt	LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	x1, x25
	bl	_test_and_set_bit
	ldr	w8, [sp, #24]
	cbnz	x0, LBB0_20
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x9, [x21, #24]
	str	w8, [x9, x23]
	add	x3, sp, #24
	mov	x0, x22
Lloh16:
	adrp	x1, l_.str.6@PAGE
Lloh17:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	x2, x24
	bl	_of_property_read_u32_index
	ldr	w8, [sp, #24]
	cmp	w8, #2
	ccmp	w0, #0, #0, lt
	ldr	x9, [x21, #24]
	add	x9, x9, x23
	csinv	w8, w8, wzr, eq
	str	w8, [x9, #4]
	add	x24, x24, #1
	ldrsw	x8, [sp, #28]
	add	x23, x23, #8
	cmp	x24, x8
	b.lt	LBB0_10
LBB0_14:
Lloh18:
	adrp	x8, _NAND_ECC_HW@GOTPAGE
Lloh19:
	ldr	x8, [x8, _NAND_ECC_HW@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x21, #8]!
Lloh21:
	adrp	x8, _sunxi_nand_controller_ops@GOTPAGE
Lloh22:
	ldr	x8, [x8, _sunxi_nand_controller_ops@GOTPAGEOFF]
	mov	x9, x20
	str	x8, [x9, #8]!
	str	x9, [x21, #8]
	mov	x0, x21
	mov	x1, x22
	bl	_nand_set_flash_node
	mov	x0, x21
	bl	_nand_to_mtd
	mov	x22, x0
	str	x19, [x0]
	ldr	w1, [sp, #28]
	mov	x0, x21
	bl	_nand_scan
	mov	x28, x0
	cbnz	w0, LBB0_6
; %bb.15:
	mov	x0, x22
	mov	x1, #0
	mov	w2, #0
	bl	_mtd_device_register
	mov	x28, x0
	cbz	w0, LBB0_21
; %bb.16:
	str	x28, [sp]
Lloh23:
	adrp	x1, l_.str.7@PAGE
Lloh24:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	mov	x0, x21
	bl	_nand_release
                                        ; kill: def $w28 killed $w28 killed $x28 def $x28
	b	LBB0_6
LBB0_17:
Lloh25:
	adrp	x1, l_.str.2@PAGE
Lloh26:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh27:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_18:
	mov	x28, x0
	str	x28, [sp]
Lloh29:
	adrp	x1, l_.str.3@PAGE
Lloh30:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	b	LBB0_6
LBB0_19:
	str	x0, [sp]
Lloh31:
	adrp	x1, l_.str.4@PAGE
Lloh32:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_3
LBB0_20:
	str	x8, [sp]
Lloh33:
	adrp	x1, l_.str.5@PAGE
Lloh34:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_3
LBB0_21:
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x0, x8, #4
	mov	x1, x20
	bl	_list_add_tail
	b	LBB0_6
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"reg"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"invalid reg property size\n"

	.comm	_sels,4,2                       ; @sels
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"could not allocate chip\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.3:                               ; @.str.3
	.asciz	"could not retrieve reg property: %d\n"

	.comm	_NFC_MAX_CS,4,2                 ; @NFC_MAX_CS
l_.str.4:                               ; @.str.4
	.asciz	"invalid reg value: %u (max CS = 7)\n"

l_.str.5:                               ; @.str.5
	.asciz	"CS %d already assigned\n"

l_.str.6:                               ; @.str.6
	.asciz	"allwinner,rb"

	.comm	_sunxi_nand_controller_ops,4,2  ; @sunxi_nand_controller_ops
	.comm	_NAND_ECC_HW,4,2                ; @NAND_ECC_HW
l_.str.7:                               ; @.str.7
	.asciz	"failed to register mtd device: %d\n"

	.no_dead_strip	_sunxi_nand_chip_init
.subsections_via_symbols
