	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function debiread
_debiread:                              ## @debiread
	.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, %r13d
	leal	-32765(%r13), %eax
	xorl	%ebx, %ebx
	cmpl	$-32764, %eax                   ## imm = 0x8004
	jb	LBB0_5
## %bb.1:
	movl	%edx, %r12d
	movl	%esi, %r15d
	movq	%rdi, %r14
	callq	_wait_for_debi_done
	testq	%rax, %rax
	js	LBB0_5
## %bb.2:
	movl	(%r14), %edi
	callq	_virt_to_bus
	movq	_SAA7146_DEBI_AD@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movl	%eax, %edi
	callq	_saawrite
	movl	%r13d, %eax
	shll	$17, %eax
	movzwl	%r12w, %ecx
	leal	(%rax,%rcx), %edi
	addl	$65536, %edi                    ## imm = 0x10000
	movq	_SAA7146_DEBI_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movq	_SAA7146_DEBI_CONFIG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_saawrite
	movq	_SAA7146_MC2_UPLD_DEBI@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	shll	$16, %edi
	orl	%eax, %edi
	movq	_SAA7146_MC2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	cmpl	$4, %r13d
	jbe	LBB0_4
## %bb.3:
	movl	%r13d, %ebx
	jmp	LBB0_5
LBB0_4:
	movq	%r14, %rdi
	callq	_wait_for_debi_done
	movl	(%rbx), %edi
	callq	_saaread
	cmpl	$1, %r13d
	movzbl	%al, %ecx
	cmovnel	%eax, %ecx
	cmpl	$2, %r13d
	movzwl	%cx, %eax
	cmovnel	%ecx, %eax
	movl	%eax, %ebx
	andl	$16777215, %ebx                 ## imm = 0xFFFFFF
	cmpl	$3, %r13d
	cmovnel	%eax, %ebx
LBB0_5:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SAA7146_DEBI_AD,4,2            ## @SAA7146_DEBI_AD
	.comm	_SAA7146_DEBI_COMMAND,4,2       ## @SAA7146_DEBI_COMMAND
	.comm	_SAA7146_DEBI_CONFIG,4,2        ## @SAA7146_DEBI_CONFIG
	.comm	_SAA7146_MC2_UPLD_DEBI,4,2      ## @SAA7146_MC2_UPLD_DEBI
	.comm	_SAA7146_MC2,4,2                ## @SAA7146_MC2
	.no_dead_strip	_debiread
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function debiread
_debiread:                              ; @debiread
	.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	w8, #-32765
	mov	w9, #-32764
	add	w8, w3, w8
	cmp	w8, w9
	b.lo	LBB0_4
; %bb.1:
	mov	x19, x3
	mov	x22, x2
	mov	x21, x1
	mov	x20, x0
	bl	_wait_for_debi_done
	tbnz	x0, #63, LBB0_4
; %bb.2:
	ldr	w0, [x20]
	bl	_virt_to_bus
Lloh0:
	adrp	x23, _SAA7146_DEBI_AD@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SAA7146_DEBI_AD@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_saawrite
	and	w8, w22, #0xffff
	bfi	w8, w19, #17, #15
	orr	w0, w8, #0x10000
Lloh2:
	adrp	x8, _SAA7146_DEBI_COMMAND@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SAA7146_DEBI_COMMAND@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_saawrite
Lloh5:
	adrp	x8, _SAA7146_DEBI_CONFIG@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SAA7146_DEBI_CONFIG@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_saawrite
Lloh8:
	adrp	x8, _SAA7146_MC2_UPLD_DEBI@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SAA7146_MC2_UPLD_DEBI@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w0, w8, w8, lsl #16
Lloh11:
	adrp	x8, _SAA7146_MC2@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SAA7146_MC2@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	bl	_saawrite
	cmp	w19, #4
	b.hi	LBB0_5
; %bb.3:
	mov	x0, x20
	bl	_wait_for_debi_done
	ldr	w0, [x23]
	bl	_saaread
	and	w8, w0, #0xff
	cmp	w19, #1
	csel	w8, w8, w0, eq
	and	w9, w8, #0xffff
	cmp	w19, #2
	csel	w8, w9, w8, eq
	and	w9, w8, #0xffffff
	cmp	w19, #3
	csel	w19, w9, w8, eq
	b	LBB0_5
LBB0_4:
	mov	w19, #0
LBB0_5:
	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
	ret
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_SAA7146_DEBI_AD,4,2            ; @SAA7146_DEBI_AD
	.comm	_SAA7146_DEBI_COMMAND,4,2       ; @SAA7146_DEBI_COMMAND
	.comm	_SAA7146_DEBI_CONFIG,4,2        ; @SAA7146_DEBI_CONFIG
	.comm	_SAA7146_MC2_UPLD_DEBI,4,2      ; @SAA7146_MC2_UPLD_DEBI
	.comm	_SAA7146_MC2,4,2                ; @SAA7146_MC2
	.no_dead_strip	_debiread
.subsections_via_symbols
