	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atiixp_set_dmamode
_atiixp_set_dmamode:                    ## @atiixp_set_dmamode
	.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
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movslq	(%r12), %r13
	movl	(%r14), %eax
	movl	4(%r12), %ebx
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %r13d
	jge	LBB0_1
## %bb.2:
	shll	$4, %eax
	shll	$3, %ebx
	xorl	$8, %ebx
	addl	%eax, %ebx
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	subq	%rax, %r13
	movq	_ATIIXP_IDE_MWDMA_TIMING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pci_read_config_dword
	movl	$255, %eax
	movl	%ebx, %ecx
	shll	%cl, %eax
	notl	%eax
	andl	-44(%rbp), %eax
	leaq	_atiixp_set_dmamode.mwdma_timings(%rip), %rcx
	movl	(%rcx,%r13,4), %edx
	movl	%ebx, %ecx
	shll	%cl, %edx
	orl	%eax, %edx
	movl	%edx, -44(%rbp)
	movq	_ATIIXP_IDE_MWDMA_TIMING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_write_config_dword
	jmp	LBB0_3
LBB0_1:
	leal	(%rbx,%rax,2), %ebx
	subl	%ecx, %r13d
	movq	_ATIIXP_IDE_UDMA_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pci_read_config_word
	shll	$2, %ebx
	movl	$7, %eax
	movl	%ebx, %ecx
	shll	%cl, %eax
	notl	%eax
	andl	-48(%rbp), %eax
	shll	%cl, %r13d
	orl	%eax, %r13d
	movl	%r13d, -48(%rbp)
	movq	_ATIIXP_IDE_UDMA_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_pci_write_config_word
LBB0_3:
	movl	(%r12), %eax
	movq	_XFER_MW_DMA_2@GOTPCREL(%rip), %rcx
	movl	$4, %edx
	cmpl	(%rcx), %eax
	jge	LBB0_6
## %bb.4:
	movq	_XFER_MW_DMA_1@GOTPCREL(%rip), %rcx
	movl	$3, %edx
	cmpl	(%rcx), %eax
	je	LBB0_6
## %bb.5:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpl	(%rcx), %eax
	jne	LBB0_9
LBB0_6:
	cmpl	%edx, 8(%r12)
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_atiixp_set_pio_timing
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	xorl	%eax, %eax
	callq	_BUG
	ud2
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @atiixp_set_dmamode.mwdma_timings
_atiixp_set_dmamode.mwdma_timings:
	.long	119                             ## 0x77
	.long	33                              ## 0x21
	.long	32                              ## 0x20
	.long	0                               ## 0x0
	.long	0                               ## 0x0

	.comm	_XFER_UDMA_0,4,2                ## @XFER_UDMA_0
	.comm	_ATIIXP_IDE_UDMA_MODE,4,2       ## @ATIIXP_IDE_UDMA_MODE
	.comm	_XFER_MW_DMA_0,4,2              ## @XFER_MW_DMA_0
	.comm	_ATIIXP_IDE_MWDMA_TIMING,4,2    ## @ATIIXP_IDE_MWDMA_TIMING
	.comm	_XFER_MW_DMA_2,4,2              ## @XFER_MW_DMA_2
	.comm	_XFER_MW_DMA_1,4,2              ## @XFER_MW_DMA_1
	.no_dead_strip	_atiixp_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atiixp_set_dmamode
_atiixp_set_dmamode:                    ; @atiixp_set_dmamode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x21, x0
	ldr	w8, [x20]
	ldp	w9, w10, [x19]
Lloh0:
	adrp	x11, _XFER_UDMA_0@GOTPAGE
Lloh1:
	ldr	x11, [x11, _XFER_UDMA_0@GOTPAGEOFF]
Lloh2:
	ldr	w11, [x11]
	subs	w22, w9, w11
	b.ge	LBB0_2
; %bb.1:
	lsl	w10, w10, #3
	eor	w10, w10, #0x8
Lloh3:
	adrp	x11, _XFER_MW_DMA_0@GOTPAGE
Lloh4:
	ldr	x11, [x11, _XFER_MW_DMA_0@GOTPAGEOFF]
	add	w22, w10, w8, lsl #4
Lloh5:
	ldr	w8, [x11]
	sub	w23, w9, w8
Lloh6:
	adrp	x24, _ATIIXP_IDE_MWDMA_TIMING@GOTPAGE
Lloh7:
	ldr	x24, [x24, _ATIIXP_IDE_MWDMA_TIMING@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #8
	mov	x0, x21
	bl	_pci_read_config_dword
	mov	w8, #255
	lsl	w8, w8, w22
	ldr	w9, [sp, #8]
	bic	w8, w9, w8
Lloh8:
	adrp	x9, _atiixp_set_dmamode.mwdma_timings@PAGE
Lloh9:
	add	x9, x9, _atiixp_set_dmamode.mwdma_timings@PAGEOFF
	ldr	w9, [x9, w23, sxtw #2]
	lsl	w9, w9, w22
	orr	w2, w9, w8
	str	w2, [sp, #8]
	ldr	w1, [x24]
	mov	x0, x21
	bl	_pci_write_config_dword
	b	LBB0_3
LBB0_2:
	add	w23, w10, w8, lsl #1
Lloh10:
	adrp	x24, _ATIIXP_IDE_UDMA_MODE@GOTPAGE
Lloh11:
	ldr	x24, [x24, _ATIIXP_IDE_UDMA_MODE@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x21
	bl	_pci_read_config_word
	lsl	w8, w23, #2
	mov	w9, #7
	lsl	w9, w9, w8
	ldr	w10, [sp, #12]
	bic	w9, w10, w9
	lsl	w8, w22, w8
	orr	w2, w9, w8
	str	w2, [sp, #12]
	ldr	w1, [x24]
	mov	x0, x21
	bl	_pci_write_config_word
LBB0_3:
	ldr	w8, [x19]
Lloh12:
	adrp	x9, _XFER_MW_DMA_2@GOTPAGE
Lloh13:
	ldr	x9, [x9, _XFER_MW_DMA_2@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ge	LBB0_6
; %bb.4:
Lloh15:
	adrp	x9, _XFER_MW_DMA_1@GOTPAGE
Lloh16:
	ldr	x9, [x9, _XFER_MW_DMA_1@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_7
; %bb.5:
	mov	w2, #3
	b	LBB0_9
LBB0_6:
	mov	w2, #4
	b	LBB0_9
LBB0_7:
Lloh18:
	adrp	x9, _XFER_MW_DMA_0@GOTPAGE
Lloh19:
	ldr	x9, [x9, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_12
; %bb.8:
	mov	w2, #0
LBB0_9:
	ldr	w8, [x19, #8]
	cmp	w8, w2
	b.eq	LBB0_11
; %bb.10:
	mov	x0, x20
	mov	x1, x19
	bl	_atiixp_set_pio_timing
LBB0_11:
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_12:
	bl	_BUG
	brk	#0x1
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @atiixp_set_dmamode.mwdma_timings
_atiixp_set_dmamode.mwdma_timings:
	.long	119                             ; 0x77
	.long	33                              ; 0x21
	.long	32                              ; 0x20
	.long	0                               ; 0x0
	.long	0                               ; 0x0

	.comm	_XFER_UDMA_0,4,2                ; @XFER_UDMA_0
	.comm	_ATIIXP_IDE_UDMA_MODE,4,2       ; @ATIIXP_IDE_UDMA_MODE
	.comm	_XFER_MW_DMA_0,4,2              ; @XFER_MW_DMA_0
	.comm	_ATIIXP_IDE_MWDMA_TIMING,4,2    ; @ATIIXP_IDE_MWDMA_TIMING
	.comm	_XFER_MW_DMA_2,4,2              ; @XFER_MW_DMA_2
	.comm	_XFER_MW_DMA_1,4,2              ; @XFER_MW_DMA_1
	.no_dead_strip	_atiixp_set_dmamode
.subsections_via_symbols
