	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atp867x_set_piomode
_atp867x_set_piomode:                   ## @atp867x_set_piomode
	.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	%rsi, %r15
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_ata_dev_pair
	movq	%rax, %rbx
	movq	(%r14), %r13
	movl	(%r15), %esi
	leaq	-56(%rbp), %rdx
	movq	%r15, %rdi
	movl	$30000, %ecx                    ## imm = 0x7530
	movl	$7500, %r8d                     ## imm = 0x1D4C
	callq	_ata_timing_compute
	testq	%rbx, %rbx
	je	LBB0_3
## %bb.1:
	movl	(%rbx), %esi
	testl	%esi, %esi
	je	LBB0_3
## %bb.2:
	leaq	-72(%rbp), %r12
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movl	$30000, %ecx                    ## imm = 0x7530
	movl	$7500, %r8d                     ## imm = 0x1D4C
	callq	_ata_timing_compute
	movq	_ATA_TIMING_8BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-56(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rdx, %rsi
	callq	_ata_timing_merge
LBB0_3:
	movl	12(%r13), %edi
	callq	_ioread8
	testb	$1, 4(%r15)
	jne	LBB0_4
## %bb.5:
	movq	_ATP867X_IO_DMAMODE_MSTR_MASK@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
LBB0_4:
	movq	_ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPCREL(%rip), %rcx
LBB0_6:
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, %eax
	movl	12(%r13), %esi
	movl	%eax, %edi
	callq	_iowrite8
	movl	-44(%rbp), %esi
	movq	%r14, %rdi
	callq	_atp867x_get_active_clocks_shifted
	movl	%eax, %ebx
	movl	-48(%rbp), %edi
	callq	_atp867x_get_recover_clocks_shifted
	orl	%eax, %ebx
	movl	4(%r15), %eax
	andl	$1, %eax
	movl	4(%r13,%rax,4), %esi
	movl	%ebx, %edi
	callq	_iowrite8
	movl	-52(%rbp), %esi
	movq	%r14, %rdi
	callq	_atp867x_get_active_clocks_shifted
	movl	%eax, %ebx
	movl	-56(%rbp), %edi
	callq	_atp867x_get_recover_clocks_shifted
	orl	%eax, %ebx
	movl	(%r13), %esi
	movl	%ebx, %edi
	callq	_iowrite8
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_TIMING_8BIT,4,2            ## @ATA_TIMING_8BIT
	.comm	_ATP867X_IO_DMAMODE_SLAVE_MASK,4,2 ## @ATP867X_IO_DMAMODE_SLAVE_MASK
	.comm	_ATP867X_IO_DMAMODE_MSTR_MASK,4,2 ## @ATP867X_IO_DMAMODE_MSTR_MASK
	.no_dead_strip	_atp867x_set_piomode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atp867x_set_piomode
_atp867x_set_piomode:                   ; @atp867x_set_piomode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x1
	mov	x19, x0
	mov	x0, x1
	bl	_ata_dev_pair
	mov	x21, x0
	ldr	x22, [x19]
	ldr	w1, [x20]
	add	x2, sp, #16
	mov	x0, x20
	mov	w3, #30000
	mov	w4, #7500
	bl	_ata_timing_compute
	cbz	x21, LBB0_3
; %bb.1:
	ldr	w1, [x21]
	cbz	w1, LBB0_3
; %bb.2:
	mov	x2, sp
	mov	x0, x21
	mov	w3, #30000
	mov	w4, #7500
	bl	_ata_timing_compute
Lloh0:
	adrp	x8, _ATA_TIMING_8BIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_TIMING_8BIT@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x0, sp
	add	x1, sp, #16
	add	x2, sp, #16
	bl	_ata_timing_merge
LBB0_3:
	ldr	w0, [x22, #12]
	bl	_ioread8
Lloh3:
	adrp	x8, _ATP867X_IO_DMAMODE_MSTR_MASK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATP867X_IO_DMAMODE_MSTR_MASK@GOTPAGEOFF]
Lloh5:
	adrp	x9, _ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPAGEOFF]
	ldr	w10, [x20, #4]
	tst	w10, #0x1
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	bic	w0, w0, w8
	ldr	w1, [x22, #12]
	bl	_iowrite8
	ldr	w1, [sp, #28]
	mov	x0, x19
	bl	_atp867x_get_active_clocks_shifted
	mov	x21, x0
	ldr	w0, [sp, #24]
	bl	_atp867x_get_recover_clocks_shifted
	orr	w0, w0, w21
	ldr	w8, [x20, #4]
	tst	w8, #0x1
	mov	w8, #8
	mov	w9, #4
	csel	x8, x9, x8, eq
	ldr	w1, [x22, x8]
	bl	_iowrite8
	ldr	w1, [sp, #20]
	mov	x0, x19
	bl	_atp867x_get_active_clocks_shifted
	mov	x19, x0
	ldr	w0, [sp, #16]
	bl	_atp867x_get_recover_clocks_shifted
	orr	w0, w0, w19
	ldr	w1, [x22]
	bl	_iowrite8
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_TIMING_8BIT,4,2            ; @ATA_TIMING_8BIT
	.comm	_ATP867X_IO_DMAMODE_SLAVE_MASK,4,2 ; @ATP867X_IO_DMAMODE_SLAVE_MASK
	.comm	_ATP867X_IO_DMAMODE_MSTR_MASK,4,2 ; @ATP867X_IO_DMAMODE_MSTR_MASK
	.no_dead_strip	_atp867x_set_piomode
.subsections_via_symbols
