	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function xway_select_chip
_xway_select_chip:                      ## @xway_select_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %ebx
	callq	_nand_get_controller_data
	movq	%rax, %r14
	testl	%ebx, %ebx
	je	LBB0_3
## %bb.1:
	cmpl	$-1, %ebx
	jne	LBB0_4
## %bb.2:
	movq	_NAND_CON_CE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_EBU_NAND_CON@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	xorl	%esi, %esi
	callq	_ltq_ebu_w32_mask
	movq	_NAND_CON_NANDM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%rbx), %edx
	xorl	%esi, %esi
	callq	_ltq_ebu_w32_mask
	movl	(%r14), %esi
	movq	_ebu_lock@GOTPCREL(%rip), %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
LBB0_3:
	movl	(%r14), %esi
	movq	_ebu_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	movq	_NAND_CON_NANDM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_EBU_NAND_CON@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	xorl	%edi, %edi
	callq	_ltq_ebu_w32_mask
	movq	_NAND_CON_CE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %edx
	xorl	%edi, %edi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ltq_ebu_w32_mask               ## TAILCALL
LBB0_4:
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_BUG                            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CON_CE,4,2                ## @NAND_CON_CE
	.comm	_EBU_NAND_CON,4,2               ## @EBU_NAND_CON
	.comm	_NAND_CON_NANDM,4,2             ## @NAND_CON_NANDM
	.comm	_ebu_lock,4,2                   ## @ebu_lock
	.no_dead_strip	_xway_select_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function xway_select_chip
_xway_select_chip:                      ; @xway_select_chip
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	bl	_nand_get_controller_data
	mov	x19, x0
	cbz	w20, LBB0_3
; %bb.1:
	cmn	w20, #1
	b.ne	LBB0_4
; %bb.2:
Lloh0:
	adrp	x8, _NAND_CON_CE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_CON_CE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x20, _EBU_NAND_CON@GOTPAGE
Lloh4:
	ldr	x20, [x20, _EBU_NAND_CON@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	w1, #0
	bl	_ltq_ebu_w32_mask
Lloh5:
	adrp	x8, _NAND_CON_NANDM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NAND_CON_NANDM@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	ldr	w2, [x20]
	mov	w1, #0
	bl	_ltq_ebu_w32_mask
	ldr	w1, [x19]
Lloh8:
	adrp	x0, _ebu_lock@GOTPAGE
Lloh9:
	ldr	x0, [x0, _ebu_lock@GOTPAGEOFF]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_spin_unlock_irqrestore
LBB0_3:
	ldr	w1, [x19]
Lloh10:
	adrp	x0, _ebu_lock@GOTPAGE
Lloh11:
	ldr	x0, [x0, _ebu_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
Lloh12:
	adrp	x8, _NAND_CON_NANDM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NAND_CON_NANDM@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x19, _EBU_NAND_CON@GOTPAGE
Lloh16:
	ldr	x19, [x19, _EBU_NAND_CON@GOTPAGEOFF]
	ldr	w2, [x19]
	mov	w0, #0
	bl	_ltq_ebu_w32_mask
Lloh17:
	adrp	x8, _NAND_CON_CE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _NAND_CON_CE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	ldr	w2, [x19]
	mov	w0, #0
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ltq_ebu_w32_mask
LBB0_4:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_BUG
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CON_CE,4,2                ; @NAND_CON_CE
	.comm	_EBU_NAND_CON,4,2               ; @EBU_NAND_CON
	.comm	_NAND_CON_NANDM,4,2             ; @NAND_CON_NANDM
	.comm	_ebu_lock,4,2                   ; @ebu_lock
	.no_dead_strip	_xway_select_chip
.subsections_via_symbols
