	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function do_pata_set_dmamode
_do_pata_set_dmamode:                   ## @do_pata_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
	subq	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -92(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	16(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r12
	movl	(%rbx), %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	setne	%al
	leal	(%rax,%rax), %r14d
	addl	$64, %r14d
	movq	(%r13), %r15
	addl	%ecx, %ecx
	addl	8(%r13), %ecx
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	movq	$0, -80(%rbp)
	movq	_piix_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	leaq	-64(%rbp), %rdx
	movq	%r12, %rdi
	movq	%r14, -120(%rbp)                ## 8-byte Spill
	movl	%r14d, %esi
	callq	_pci_read_config_word
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	cmpq	$0, 8(%rbx)
	je	LBB0_2
## %bb.1:
	leaq	-80(%rbp), %rdx
	movq	%r12, %rdi
	movl	$72, %esi
	callq	_pci_read_config_byte
LBB0_2:
	movq	%r12, -112(%rbp)                ## 8-byte Spill
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %r12
	cmpq	%rax, %r15
	jge	LBB0_3
## %bb.6:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	movq	_XFER_PIO_0@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)
	movq	_XFER_PIO_3@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -56(%rbp)
	movq	_XFER_PIO_4@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -52(%rbp)
	movl	-60(%rbp,%r12,4), %ecx
	movl	%ecx, %r12d
	subl	%eax, %r12d
	xorl	%eax, %eax
	cmpl	%ecx, 12(%r13)
	setb	%al
	leal	3(,%rax,8), %ecx
	cmpl	$0, 8(%r13)
	movl	-64(%rbp), %eax
	movq	-112(%rbp), %r15                ## 8-byte Reload
	movq	-104(%rbp), %r14                ## 8-byte Reload
	je	LBB0_8
## %bb.7:
	andl	$65359, %eax                    ## imm = 0xFF4F
	shll	$4, %ecx
	orl	%eax, %ecx
	movl	%ecx, -64(%rbp)
	leaq	-72(%rbp), %rdx
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_read_config_byte
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	cmpl	$0, (%rbx)
	movl	$240, %eax
	movl	$15, %esi
	cmovel	%eax, %esi
	setne	%cl
	movslq	%r12d, %rax
	shlq	$4, %rax
	leaq	_do_pata_set_dmamode.timings(%rip), %rdi
	movq	(%rax,%rdi), %rdx
	shlq	$2, %rdx
	orq	8(%rax,%rdi), %rdx
	shlb	$2, %cl
	shlq	%cl, %rdx
	andl	-72(%rbp), %esi
	orq	%rsi, %rdx
	movq	%rdx, -72(%rbp)
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_write_config_byte
	cmpq	$0, 8(%rbx)
	je	LBB0_11
LBB0_10:
	movl	$-2, %eax
	movl	%r14d, %ecx
	roll	%cl, %eax
	cltq
	andq	%rax, -80(%rbp)
LBB0_11:
	movl	-64(%rbp), %edx
	movq	%r15, %rdi
	movq	-120(%rbp), %rsi                ## 8-byte Reload
	callq	_pci_write_config_word
	cmpq	$0, 8(%rbx)
	jne	LBB0_13
	jmp	LBB0_14
LBB0_3:
	subl	%eax, %r12d
	movl	%r12d, %eax
	andl	$1, %eax
	movl	$2, %edi
	subl	%eax, %edi
	movl	%r12d, %esi
	callq	_min
	movl	%eax, %ebx
	movl	$1, %eax
	movq	-104(%rbp), %r14                ## 8-byte Reload
	movl	%r14d, %ecx
	shll	%cl, %eax
	cltq
	orq	%rax, -80(%rbp)
	leaq	-60(%rbp), %rdx
	movq	-112(%rbp), %r15                ## 8-byte Reload
	movq	%r15, %rdi
	movl	$74, %esi
	callq	_pci_read_config_word
	leal	(,%r14,4), %ecx
	movl	$3, %eax
	shll	%cl, %eax
	notl	%eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	andl	-60(%rbp), %eax
	orl	%eax, %ebx
	movl	%ebx, -60(%rbp)
	movl	$74, %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_pci_write_config_word
	cmpl	$0, -92(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_5
## %bb.4:
	xorl	%eax, %eax
	cmpl	$3, %r12d
	setae	%al
	cmpl	$5, %r12d
	movl	$4096, %ebx                     ## imm = 0x1000
	cmovnel	%eax, %ebx
	leaq	-72(%rbp), %rdx
	movq	%r15, %rdi
	movl	$84, %esi
	callq	_pci_read_config_word
	movl	$4097, %eax                     ## imm = 0x1001
	movl	%r14d, %ecx
	shll	%cl, %eax
	notl	%eax
	shll	%cl, %ebx
	andl	-72(%rbp), %eax
	orl	%eax, %ebx
	movl	%ebx, -72(%rbp)
	movl	$84, %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_pci_write_config_word
LBB0_5:
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	cmpq	$0, 8(%rbx)
	je	LBB0_14
LBB0_13:
	movq	-80(%rbp), %rdx
	movq	%r15, %rdi
	movl	$72, %esi
	callq	_pci_write_config_byte
LBB0_14:
	movq	_piix_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_16
## %bb.15:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	andl	$52468, %eax                    ## imm = 0xCCF4
	orl	%ecx, %eax
	movslq	%r12d, %rcx
	shlq	$4, %rcx
	leaq	_do_pata_set_dmamode.timings(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	8(%rcx,%rdx), %ecx
	shll	$12, %esi
	shll	$8, %ecx
	orl	%esi, %ecx
	orl	%eax, %ecx
	movl	%ecx, -64(%rbp)
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	cmpq	$0, 8(%rbx)
	jne	LBB0_10
	jmp	LBB0_11
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @do_pata_set_dmamode.timings
_do_pata_set_dmamode.timings:
	.space	16
	.space	16
	.quad	1                               ## 0x1
	.quad	0                               ## 0x0
	.quad	2                               ## 0x2
	.quad	1                               ## 0x1
	.quad	2                               ## 0x2
	.quad	3                               ## 0x3

	.comm	_piix_lock,4,2                  ## @piix_lock
	.comm	_XFER_UDMA_0,8,3                ## @XFER_UDMA_0
	.comm	_XFER_MW_DMA_0,4,2              ## @XFER_MW_DMA_0
	.comm	_XFER_PIO_0,4,2                 ## @XFER_PIO_0
	.comm	_XFER_PIO_3,4,2                 ## @XFER_PIO_3
	.comm	_XFER_PIO_4,4,2                 ## @XFER_PIO_4
	.no_dead_strip	_do_pata_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function do_pata_set_dmamode
_do_pata_set_dmamode:                   ; @do_pata_set_dmamode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	ldr	x8, [x0, #16]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x20, x0
	ldr	w24, [x19]
	mov	w8, #66
	mov	w9, #64
	cmp	w24, #0
	csel	w21, w9, w8, eq
	ldr	x25, [x23]
	ldr	w26, [x23, #8]
	str	xzr, [sp, #16]
Lloh3:
	adrp	x0, _piix_lock@GOTPAGE
Lloh4:
	ldr	x0, [x0, _piix_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
	add	x2, sp, #24
	mov	x0, x20
	mov	x1, x21
	bl	_pci_read_config_word
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_2
; %bb.1:
	add	x2, sp, #16
	mov	x0, x20
	mov	w1, #72
	bl	_pci_read_config_byte
LBB0_2:
	add	w24, w26, w24, lsl #1
Lloh5:
	adrp	x8, _XFER_UDMA_0@GOTPAGE
Lloh6:
	ldr	x8, [x8, _XFER_UDMA_0@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x8]
	ldr	x8, [x23]
	cmp	x25, x9
	b.ge	LBB0_7
; %bb.3:
Lloh8:
	adrp	x9, _XFER_MW_DMA_0@GOTPAGE
Lloh9:
	ldr	x9, [x9, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	sub	w8, w8, w9
Lloh11:
	adrp	x9, _XFER_PIO_0@GOTPAGE
Lloh12:
	ldr	x9, [x9, _XFER_PIO_0@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
Lloh14:
	adrp	x10, _XFER_PIO_3@GOTPAGE
Lloh15:
	ldr	x10, [x10, _XFER_PIO_3@GOTPAGEOFF]
Lloh16:
	ldr	w10, [x10]
	stp	w9, w10, [sp, #28]
Lloh17:
	adrp	x10, _XFER_PIO_4@GOTPAGE
Lloh18:
	ldr	x10, [x10, _XFER_PIO_4@GOTPAGEOFF]
Lloh19:
	ldr	w10, [x10]
	str	w10, [sp, #36]
	add	x10, sp, #28
	ldr	w8, [x10, w8, uxtw #2]
	sub	w22, w8, w9
	mov	w9, #3
	mov	w10, #11
	ldp	w12, w11, [x23, #8]
	cmp	w11, w8
	csel	w8, w10, w9, lo
	ldr	w9, [sp, #24]
	cbz	w12, LBB0_14
; %bb.4:
	mov	w10, #65359
	and	w9, w9, w10
	orr	w8, w9, w8, lsl #4
	str	w8, [sp, #24]
	add	x2, sp, #8
	mov	x0, x20
	mov	w1, #68
	bl	_pci_read_config_byte
	ldr	w8, [x19]
	cmp	w8, #0
	cset	w8, ne
	mov	w9, #15
	mov	w10, #240
	csel	x9, x10, x9, eq
	ldr	x10, [sp, #8]
	and	x9, x9, x10
Lloh20:
	adrp	x10, _do_pata_set_dmamode.timings@PAGE
Lloh21:
	add	x10, x10, _do_pata_set_dmamode.timings@PAGEOFF
	add	x10, x10, w22, sxtw #4
	ldp	x11, x10, [x10]
	orr	x10, x10, x11, lsl #2
	lsl	x8, x8, #2
	lsl	x8, x10, x8
	orr	x2, x8, x9
	str	x2, [sp, #8]
	mov	x0, x20
	mov	w1, #68
	bl	_pci_write_config_byte
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_6
LBB0_5:
	mov	w8, #1
	lsl	w8, w8, w24
	mvn	w8, w8
	sxtw	x8, w8
	ldr	x9, [sp, #16]
	and	x8, x9, x8
	str	x8, [sp, #16]
LBB0_6:
	ldr	w2, [sp, #24]
	mov	x0, x20
	mov	x1, x21
	b	LBB0_9
LBB0_7:
	sub	w21, w8, w9
	and	w8, w21, #0x1
	mov	w9, #2
	sub	w0, w9, w8
	mov	x1, x21
	bl	_min
	mov	x23, x0
	mov	w8, #1
	lsl	w8, w8, w24
	sxtw	x8, w8
	ldr	x9, [sp, #16]
	orr	x8, x9, x8
	str	x8, [sp, #16]
	add	x2, sp, #28
	mov	x0, x20
	mov	w1, #74
	bl	_pci_read_config_word
	lsl	w8, w24, #2
	mov	w9, #3
	lsl	w9, w9, w8
	ldr	w10, [sp, #28]
	bic	w9, w10, w9
	lsl	w8, w23, w8
	orr	w2, w9, w8
	str	w2, [sp, #28]
	mov	x0, x20
	mov	w1, #74
	bl	_pci_write_config_word
	cbz	w22, LBB0_10
; %bb.8:
	cmp	w21, #2
	cset	w8, hi
	mov	w9, #4096
	cmp	w21, #5
	csel	w21, w9, w8, eq
	add	x2, sp, #8
	mov	x0, x20
	mov	w1, #84
	bl	_pci_read_config_word
	mov	w8, #4097
	lsl	w8, w8, w24
	ldr	w9, [sp, #8]
	bic	w8, w9, w8
	lsl	w9, w21, w24
	orr	w2, w8, w9
	str	w2, [sp, #8]
	mov	x0, x20
	mov	w1, #84
LBB0_9:
	bl	_pci_write_config_word
LBB0_10:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_12
; %bb.11:
	ldr	x2, [sp, #16]
	mov	x0, x20
	mov	w1, #72
	bl	_pci_write_config_byte
LBB0_12:
Lloh22:
	adrp	x0, _piix_lock@GOTPAGE
Lloh23:
	ldr	x0, [x0, _piix_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	ldr	x8, [sp, #40]
Lloh24:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh25:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.13:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_14:
	mov	w10, #52468
	and	w9, w9, w10
	orr	w8, w9, w8
Lloh27:
	adrp	x9, _do_pata_set_dmamode.timings@PAGE
Lloh28:
	add	x9, x9, _do_pata_set_dmamode.timings@PAGEOFF
	add	x9, x9, w22, sxtw #4
	ldr	w10, [x9]
	ldr	w9, [x9, #8]
	lsl	w9, w9, #8
	orr	w9, w9, w10, lsl #12
	orr	w8, w8, w9
	str	w8, [sp, #24]
	ldr	x8, [x19, #8]
	cbnz	x8, LBB0_5
	b	LBB0_6
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	3                               ; @do_pata_set_dmamode.timings
_do_pata_set_dmamode.timings:
	.space	16
	.space	16
	.quad	1                               ; 0x1
	.quad	0                               ; 0x0
	.quad	2                               ; 0x2
	.quad	1                               ; 0x1
	.quad	2                               ; 0x2
	.quad	3                               ; 0x3

	.comm	_piix_lock,4,2                  ; @piix_lock
	.comm	_XFER_UDMA_0,8,3                ; @XFER_UDMA_0
	.comm	_XFER_MW_DMA_0,4,2              ; @XFER_MW_DMA_0
	.comm	_XFER_PIO_0,4,2                 ; @XFER_PIO_0
	.comm	_XFER_PIO_3,4,2                 ; @XFER_PIO_3
	.comm	_XFER_PIO_4,4,2                 ; @XFER_PIO_4
	.no_dead_strip	_do_pata_set_dmamode
.subsections_via_symbols
