	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function b1dma_detect
_b1dma_detect:                          ## @b1dma_detect
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_AMCC_MCSR@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	$10, %edi
	callq	_mdelay
	movl	(%r14), %edx
	movq	%rbx, %rdi
	movl	$251658240, %esi                ## imm = 0xF000000
	callq	_b1dma_writel
	movl	$10, %edi
	callq	_mdelay
	movl	(%r14), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	$42, %edi
	callq	_mdelay
	movq	_AMCC_RXLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movq	_AMCC_TXLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	$0, (%rbx)
	movq	_AMCC_INTCSR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_b1dma_readl
	movl	$1, %r14d
	cmpl	$230, %eax
	jne	LBB0_9
## %bb.1:
	movq	_AMCC_RXPTR@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movl	$-1, %esi
	callq	_b1dma_writel
	movq	_AMCC_TXPTR@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movq	%rbx, %rdi
	movl	$-1, %esi
	callq	_b1dma_writel
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_b1dma_readl
	movl	$2, %r14d
	cmpl	$-4, %eax
	jne	LBB0_9
## %bb.2:
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_b1dma_readl
	cmpl	$-4, %eax
	jne	LBB0_9
## %bb.3:
	movl	(%r12), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	(%r15), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_b1dma_writel
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_b1dma_readl
	movl	$3, %r14d
	testl	%eax, %eax
	jne	LBB0_9
## %bb.4:
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_b1dma_readl
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:
	movl	4(%rbx), %edi
	movl	$16, %esi
	xorl	%edx, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$7, %esi
	xorl	%edx, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$2, %esi
	movl	$2, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$3, %esi
	movl	$2, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$2, %esi
	callq	_t1inp
	andl	$254, %eax
	movl	$4, %r14d
	cmpl	$2, %eax
	jne	LBB0_9
## %bb.6:
	movl	4(%rbx), %edi
	movl	$3, %esi
	callq	_t1inp
	cmpl	$3, %eax
	jne	LBB0_9
## %bb.7:
	movl	4(%rbx), %edi
	movl	$2, %esi
	xorl	%edx, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$3, %esi
	xorl	%edx, %edx
	callq	_t1outp
	movl	4(%rbx), %edi
	movl	$2, %esi
	callq	_t1inp
	movl	$5, %r14d
	testb	$-2, %al
	jne	LBB0_9
## %bb.8:
	movl	4(%rbx), %edi
	movl	$3, %esi
	callq	_t1inp
	xorl	%ecx, %ecx
	cmpl	$1, %eax
	setne	%cl
	leal	(%rcx,%rcx,4), %r14d
LBB0_9:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AMCC_MCSR,4,2                  ## @AMCC_MCSR
	.comm	_AMCC_RXLEN,4,2                 ## @AMCC_RXLEN
	.comm	_AMCC_TXLEN,4,2                 ## @AMCC_TXLEN
	.comm	_AMCC_INTCSR,4,2                ## @AMCC_INTCSR
	.comm	_AMCC_RXPTR,4,2                 ## @AMCC_RXPTR
	.comm	_AMCC_TXPTR,4,2                 ## @AMCC_TXPTR
	.no_dead_strip	_b1dma_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function b1dma_detect
_b1dma_detect:                          ; @b1dma_detect
	.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
Lloh0:
	adrp	x20, _AMCC_MCSR@GOTPAGE
Lloh1:
	ldr	x20, [x20, _AMCC_MCSR@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	w1, #0
	bl	_b1dma_writel
	mov	w0, #10
	bl	_mdelay
	ldr	w2, [x20]
	mov	x0, x19
	mov	w1, #251658240
	bl	_b1dma_writel
	mov	w0, #10
	bl	_mdelay
	ldr	w2, [x20]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
	mov	w0, #42
	bl	_mdelay
Lloh2:
	adrp	x8, _AMCC_RXLEN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AMCC_RXLEN@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
Lloh5:
	adrp	x8, _AMCC_TXLEN@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AMCC_TXLEN@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
	str	wzr, [x19]
Lloh8:
	adrp	x8, _AMCC_INTCSR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AMCC_INTCSR@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
	ldr	w1, [x20]
	mov	x0, x19
	bl	_b1dma_readl
	cmp	w0, #230
	b.ne	LBB0_6
; %bb.1:
Lloh11:
	adrp	x20, _AMCC_RXPTR@GOTPAGE
Lloh12:
	ldr	x20, [x20, _AMCC_RXPTR@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	x0, x19
	mov	w1, #-1
	bl	_b1dma_writel
Lloh13:
	adrp	x21, _AMCC_TXPTR@GOTPAGE
Lloh14:
	ldr	x21, [x21, _AMCC_TXPTR@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x19
	mov	w1, #-1
	bl	_b1dma_writel
	ldr	w1, [x20]
	mov	x0, x19
	bl	_b1dma_readl
	cmn	w0, #4
	b.ne	LBB0_7
; %bb.2:
	ldr	w1, [x21]
	mov	x0, x19
	bl	_b1dma_readl
	cmn	w0, #4
	b.ne	LBB0_7
; %bb.3:
	ldr	w2, [x20]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
	ldr	w2, [x21]
	mov	x0, x19
	mov	w1, #0
	bl	_b1dma_writel
	ldr	w1, [x20]
	mov	x0, x19
	bl	_b1dma_readl
	cbnz	w0, LBB0_5
; %bb.4:
	ldr	w1, [x21]
	mov	x0, x19
	bl	_b1dma_readl
	cbz	w0, LBB0_9
LBB0_5:
	mov	w20, #3
	b	LBB0_8
LBB0_6:
	mov	w20, #1
	b	LBB0_8
LBB0_7:
	mov	w20, #2
LBB0_8:
	mov	x0, x20
	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_9:
	ldr	w0, [x19, #4]
	mov	w1, #16
	mov	w2, #0
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #7
	mov	w2, #0
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #2
	mov	w2, #2
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #3
	mov	w2, #2
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #2
	bl	_t1inp
	and	w8, w0, #0xfe
	cmp	w8, #2
	b.ne	LBB0_13
; %bb.10:
	ldr	w0, [x19, #4]
	mov	w1, #3
	bl	_t1inp
	cmp	w0, #3
	b.ne	LBB0_13
; %bb.11:
	ldr	w0, [x19, #4]
	mov	w1, #2
	mov	w2, #0
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #3
	mov	w2, #0
	bl	_t1outp
	ldr	w0, [x19, #4]
	mov	w1, #2
	bl	_t1inp
	mov	w20, #5
	tst	w0, #0xfe
	b.ne	LBB0_8
; %bb.12:
	ldr	w0, [x19, #4]
	mov	w1, #3
	bl	_t1inp
	cmp	w0, #1
	csel	w20, wzr, w20, eq
	b	LBB0_8
LBB0_13:
	mov	w20, #4
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_AMCC_MCSR,4,2                  ; @AMCC_MCSR
	.comm	_AMCC_RXLEN,4,2                 ; @AMCC_RXLEN
	.comm	_AMCC_TXLEN,4,2                 ; @AMCC_TXLEN
	.comm	_AMCC_INTCSR,4,2                ; @AMCC_INTCSR
	.comm	_AMCC_RXPTR,4,2                 ; @AMCC_RXPTR
	.comm	_AMCC_TXPTR,4,2                 ; @AMCC_TXPTR
	.no_dead_strip	_b1dma_detect
.subsections_via_symbols
