	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ns87410_set_piomode
_ns87410_set_piomode:                   ## @ns87410_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, %r13
	movq	%rdi, %r14
	movq	16(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movl	(%r14), %ebx
	leal	67(,%rbx,4), %r12d
	leaq	-44(%rbp), %rdx
	movq	%rax, %rdi
	movl	%r12d, %esi
	callq	_pci_read_config_byte
	movq	%r13, %rdi
	callq	_ata_pio_need_iordy
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movl	-44(%rbp), %eax
	andl	$-5, %eax
	leal	(%rax,%rcx,4), %eax
	movl	%eax, -44(%rbp)
	movl	(%r13), %esi
	leaq	-72(%rbp), %rdx
	movq	%r13, %rdi
	movl	$30303, %ecx                    ## imm = 0x765F
	movl	$1, %r8d
	callq	_ata_timing_compute
	testq	%rax, %rax
	js	LBB0_1
## %bb.2:
	shll	$2, %ebx
	addl	$64, %ebx
	movq	-72(%rbp), %rdi
	movl	$2, %esi
	movl	$16, %edx
	callq	_clamp_val
	addq	$-2, %rax
	movq	%rax, -72(%rbp)
	movq	-64(%rbp), %rdi
	movl	$1, %esi
	movl	$4, %edx
	callq	_clamp_val
	decq	%rax
	movq	%rax, -64(%rbp)
	movq	-56(%rbp), %rdi
	movl	$1, %esi
	movl	$12, %edx
	callq	_clamp_val
	leaq	-1(%rax), %rcx
	movq	%rcx, -56(%rbp)
	movl	-64(%rbp), %edx
	leaq	_ns87410_set_piomode.recoverbits(%rip), %rcx
	movl	-4(%rcx,%rax,4), %eax
	shll	$3, %eax
	movq	-72(%rbp), %rcx
	leaq	_ns87410_set_piomode.activebits(%rip), %rsi
	shll	$6, %edx
	orl	%eax, %edx
	orl	(%rsi,%rcx,4), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_pci_write_config_byte
	movl	-44(%rbp), %edx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_write_config_byte
	movq	%r13, 8(%r14)
	jmp	LBB0_3
LBB0_1:
	movq	_KERN_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r13), %ecx
	leaq	L_.str(%rip), %rdx
	movq	%r15, %rsi
	callq	_dev_printk
LBB0_3:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @ns87410_set_piomode.activebits
_ns87410_set_piomode.activebits:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.long	4                               ## 0x4
	.long	5                               ## 0x5
	.long	5                               ## 0x5
	.long	6                               ## 0x6
	.long	6                               ## 0x6
	.long	6                               ## 0x6
	.long	6                               ## 0x6
	.long	7                               ## 0x7
	.long	7                               ## 0x7
	.long	7                               ## 0x7
	.long	7                               ## 0x7

	.p2align	4                               ## @ns87410_set_piomode.recoverbits
_ns87410_set_piomode.recoverbits:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.long	4                               ## 0x4
	.long	5                               ## 0x5
	.long	6                               ## 0x6
	.long	6                               ## 0x6
	.long	7                               ## 0x7
	.long	7                               ## 0x7
	.long	7                               ## 0x7
	.long	7                               ## 0x7

	.comm	_KERN_ERR,4,2                   ## @KERN_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unknown mode %d.\n"

	.no_dead_strip	_ns87410_set_piomode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ns87410_set_piomode
_ns87410_set_piomode:                   ; @ns87410_set_piomode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x1
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x21, x0
	ldr	w8, [x20]
	lsl	w23, w8, #2
	add	w22, w23, #67
	add	x2, sp, #28
	mov	x1, x22
	bl	_pci_read_config_byte
	mov	x0, x19
	bl	_ata_pio_need_iordy
	cmp	x0, #0
	cset	w8, ne
	ldr	w9, [sp, #28]
	bfi	w9, w8, #2, #1
	str	w9, [sp, #28]
	ldr	w1, [x19]
	mov	x2, sp
	mov	x0, x19
	mov	w3, #30303
	mov	w4, #1
	bl	_ata_timing_compute
	tbnz	x0, #63, LBB0_2
; %bb.1:
	add	w23, w23, #64
	ldr	x0, [sp]
	mov	w1, #2
	mov	w2, #16
	bl	_clamp_val
	sub	x8, x0, #2
	str	x8, [sp]
	ldr	x0, [sp, #8]
	mov	w1, #1
	mov	w2, #4
	bl	_clamp_val
	sub	x8, x0, #1
	str	x8, [sp, #8]
	ldr	x0, [sp, #16]
	mov	w1, #1
	mov	w2, #12
	bl	_clamp_val
	sub	x8, x0, #1
	str	x8, [sp, #16]
	ldr	w9, [sp, #8]
Lloh0:
	adrp	x10, _ns87410_set_piomode.recoverbits@PAGE
Lloh1:
	add	x10, x10, _ns87410_set_piomode.recoverbits@PAGEOFF
	ldr	w8, [x10, x8, lsl #2]
Lloh2:
	adrp	x10, _ns87410_set_piomode.activebits@PAGE
Lloh3:
	add	x10, x10, _ns87410_set_piomode.activebits@PAGEOFF
	ldr	x11, [sp]
	ldr	w10, [x10, x11, lsl #2]
	lsl	w9, w9, #6
	orr	w8, w9, w8, lsl #3
	orr	w2, w8, w10
	mov	x0, x21
	mov	x1, x23
	bl	_pci_write_config_byte
	ldr	w2, [sp, #28]
	mov	x0, x21
	mov	x1, x22
	bl	_pci_write_config_byte
	str	x19, [x20, #8]
	b	LBB0_3
LBB0_2:
Lloh4:
	adrp	x8, _KERN_ERR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _KERN_ERR@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	ldr	w3, [x19]
Lloh7:
	adrp	x2, l_.str@PAGE
Lloh8:
	add	x2, x2, l_.str@PAGEOFF
	mov	x1, x21
	bl	_dev_printk
LBB0_3:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @ns87410_set_piomode.activebits
_ns87410_set_piomode.activebits:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.long	4                               ; 0x4
	.long	5                               ; 0x5
	.long	5                               ; 0x5
	.long	6                               ; 0x6
	.long	6                               ; 0x6
	.long	6                               ; 0x6
	.long	6                               ; 0x6
	.long	7                               ; 0x7
	.long	7                               ; 0x7
	.long	7                               ; 0x7
	.long	7                               ; 0x7

	.p2align	2                               ; @ns87410_set_piomode.recoverbits
_ns87410_set_piomode.recoverbits:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.long	4                               ; 0x4
	.long	5                               ; 0x5
	.long	6                               ; 0x6
	.long	6                               ; 0x6
	.long	7                               ; 0x7
	.long	7                               ; 0x7
	.long	7                               ; 0x7
	.long	7                               ; 0x7

	.comm	_KERN_ERR,4,2                   ; @KERN_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unknown mode %d.\n"

	.no_dead_strip	_ns87410_set_piomode
.subsections_via_symbols
