	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmnand_attach_chip
_brcmnand_attach_chip:                  ## @brcmnand_attach_chip
	.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, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r15
	movq	_NAND_NO_SUBPAGE_WRITE@GOTPCREL(%rip), %rax
	movl	8(%rbx), %ecx
	orl	(%rax), %ecx
	movl	(%rbx), %eax
	movq	_NAND_USE_BOUNCE_BUFFER@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movl	%ecx, 8(%rbx)
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	movq	_NAND_BBT_NO_OOB@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%rbx)
LBB0_2:
	movq	%r15, %rdi
	callq	_brcmnand_setup_dev
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_ENXIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	xorl	%eax, %eax
	cmpq	$0, (%r15)
	setne	%al
	shll	$9, %eax
	addl	$512, %eax                      ## imm = 0x200
	movl	%eax, 4(%rbx)
	movl	$1, (%r14)
	movq	%r15, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_brcmstb_choose_ecc_layout      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ## @NAND_NO_SUBPAGE_WRITE
	.comm	_NAND_USE_BOUNCE_BUFFER,4,2     ## @NAND_USE_BOUNCE_BUFFER
	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ## @NAND_BBT_NO_OOB
	.comm	_ENXIO,4,2                      ## @ENXIO
	.no_dead_strip	_brcmnand_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmnand_attach_chip
_brcmnand_attach_chip:                  ; @brcmnand_attach_chip
	.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
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x19
	bl	_nand_get_controller_data
	mov	x21, x0
Lloh0:
	adrp	x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x19, #8]
	orr	w8, w9, w8
Lloh3:
	adrp	x9, _NAND_USE_BOUNCE_BUFFER@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NAND_USE_BOUNCE_BUFFER@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x19, #8]
	ldr	w8, [x19]
Lloh6:
	adrp	x9, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
Lloh9:
	adrp	x9, _NAND_BBT_NO_OOB@GOTPAGE
Lloh10:
	ldr	x9, [x9, _NAND_BBT_NO_OOB@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x19]
LBB0_2:
	mov	x0, x21
	bl	_brcmnand_setup_dev
	cbz	x0, LBB0_4
; %bb.3:
Lloh12:
	adrp	x8, _ENXIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w0, w8
	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
LBB0_4:
	ldr	x8, [x21]
	cmp	x8, #0
	mov	w8, #1024
	mov	w9, #512
	csel	w8, w9, w8, eq
	str	w8, [x19, #4]
	mov	w8, #1
	str	w8, [x20]
	mov	x0, x21
	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
	b	_brcmstb_choose_ecc_layout
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ; @NAND_NO_SUBPAGE_WRITE
	.comm	_NAND_USE_BOUNCE_BUFFER,4,2     ; @NAND_USE_BOUNCE_BUFFER
	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ; @NAND_BBT_NO_OOB
	.comm	_ENXIO,4,2                      ; @ENXIO
	.no_dead_strip	_brcmnand_attach_chip
.subsections_via_symbols
