	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rdc_set_dmamode
_rdc_set_dmamode:                       ## @rdc_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	$56, %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, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r12
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %ebx
	xorl	%eax, %eax
	testl	%ebx, %ebx
	setne	%al
	leal	(%rax,%rax), %esi
	addl	$64, %esi
	movq	(%r13), %r14
	addl	%ebx, %ebx
	addl	8(%r13), %ebx
	movq	$0, -80(%rbp)
	leaq	-64(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_pci_read_config_word
	leaq	-80(%rbp), %rdx
	movq	%r12, %rdi
	movl	$72, %esi
	callq	_pci_read_config_byte
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %r15
	cmpq	%rax, %r14
	jge	LBB0_1
## %bb.2:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	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,%r15,4), %ecx
	movl	%ecx, %r15d
	subl	%eax, %r15d
	xorl	%eax, %eax
	cmpl	%ecx, 12(%r13)
	setb	%al
	leal	3(,%rax,8), %ecx
	cmpl	$0, 8(%r13)
	movl	-64(%rbp), %eax
	je	LBB0_4
## %bb.3:
	andl	$65359, %eax                    ## imm = 0xFF4F
	shll	$4, %ecx
	orl	%eax, %ecx
	movl	%ecx, -64(%rbp)
	leaq	-72(%rbp), %rdx
	movq	%r12, %rdi
	movl	$68, %esi
	callq	_pci_read_config_byte
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	cmpl	$0, (%rax)
	movl	$240, %eax
	movl	$15, %esi
	cmovel	%eax, %esi
	setne	%cl
	movslq	%r15d, %rax
	shlq	$4, %rax
	leaq	_rdc_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	%r12, %rdi
	movl	$68, %esi
	callq	_pci_write_config_byte
	movl	-64(%rbp), %edx
	jmp	LBB0_5
LBB0_1:
	subl	%eax, %r15d
	movl	%r15d, %eax
	andl	$1, %eax
	movl	$2, %edi
	subl	%eax, %edi
	movl	%r15d, %esi
	callq	_min
	movl	%ebx, %r14d
	movl	%eax, %ebx
	xorl	%eax, %eax
	cmpl	$3, %r15d
	setae	%al
	cmpl	$5, %r15d
	movl	$4096, %r15d                    ## imm = 0x1000
	cmovnel	%eax, %r15d
	movl	$1, %eax
	movl	%r14d, %ecx
	shll	%cl, %eax
	cltq
	orq	%rax, -80(%rbp)
	leaq	-60(%rbp), %rdx
	movq	%r12, %rdi
	movl	$74, %esi
	callq	_pci_read_config_word
	movl	%r14d, %ecx
	shll	$2, %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	%r12, %rdi
	movl	%ebx, %edx
	callq	_pci_write_config_word
	leaq	-72(%rbp), %rdx
	movq	%r12, %rdi
	movl	$84, %esi
	callq	_pci_read_config_word
	movl	$4097, %eax                     ## imm = 0x1001
	movl	%r14d, %ecx
	shll	%cl, %eax
	notl	%eax
	shll	%cl, %r15d
	andl	-72(%rbp), %eax
	orl	%eax, %r15d
	movl	%r15d, -72(%rbp)
	movl	$84, %esi
	movq	%r12, %rdi
	movl	%r15d, %edx
	jmp	LBB0_6
LBB0_4:
	andl	$52468, %eax                    ## imm = 0xCCF4
	orl	%ecx, %eax
	movslq	%r15d, %rcx
	shlq	$4, %rcx
	leaq	_rdc_set_dmamode.timings(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	8(%rcx,%rdx), %edx
	shll	$12, %esi
	shll	$8, %edx
	orl	%esi, %edx
	orl	%eax, %edx
	movl	%edx, -64(%rbp)
LBB0_5:
	movl	$-2, %eax
	movl	%ebx, %ecx
	roll	%cl, %eax
	cltq
	andq	%rax, -80(%rbp)
	movq	%r12, %rdi
	movq	-96(%rbp), %rsi                 ## 8-byte Reload
LBB0_6:
	callq	_pci_write_config_word
	movq	-80(%rbp), %rdx
	movq	%r12, %rdi
	movl	$72, %esi
	callq	_pci_write_config_byte
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_8
## %bb.7:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @rdc_set_dmamode.timings
_rdc_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	_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	_rdc_set_dmamode
.subsections_via_symbols

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