	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function it8213_set_dmamode
_it8213_set_dmamode:                    ## @it8213_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	$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, %r12
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movq	(%r13), %r14
	movl	8(%r13), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movl	$64, %esi
	callq	_pci_read_config_word
	leaq	-72(%rbp), %rdx
	movq	%r15, %rdi
	movl	$72, %esi
	callq	_pci_read_config_byte
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %rbx
	cmpq	%rax, %r14
	jge	LBB0_1
## %bb.2:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	leaq	_it8213_set_dmamode.needed_pio(%rip), %rax
	movl	(%rax,%rbx,4), %eax
	leal	-130(%rax), %ebx
	xorl	%ecx, %ecx
	cmpl	%eax, 12(%r13)
	setb	%cl
	leal	3(,%rcx,8), %ecx
	movl	-44(%rbp), %eax
	movl	-60(%rbp), %r14d                ## 4-byte Reload
	testl	%r14d, %r14d
	je	LBB0_4
## %bb.3:
	andl	$65359, %eax                    ## imm = 0xFF4F
	shll	$4, %ecx
	orl	%eax, %ecx
	movl	%ecx, -44(%rbp)
	leaq	-56(%rbp), %rdx
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_read_config_byte
	movslq	(%r12), %rax
	testq	%rax, %rax
	setne	%cl
	imulq	$225, %rax, %rax
	addq	$15, %rax
	movslq	%ebx, %rsi
	shlq	$4, %rsi
	leaq	_it8213_set_dmamode.timings(%rip), %rdi
	movq	(%rsi,%rdi), %rdx
	shlq	$2, %rdx
	orq	8(%rsi,%rdi), %rdx
	shlb	$2, %cl
	shlq	%cl, %rdx
	andq	-56(%rbp), %rax
	orq	%rax, %rdx
	movq	%rdx, -56(%rbp)
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_write_config_byte
	movl	-44(%rbp), %edx
	jmp	LBB0_5
LBB0_1:
	subl	%eax, %ebx
	movl	%ebx, %eax
	andl	$1, %eax
	movl	$2, %edi
	subl	%eax, %edi
	movl	%ebx, %esi
	callq	_min
	xorl	%eax, %eax
	cmpl	$3, %ebx
	setae	%al
	cmpl	$5, %ebx
	movl	$4096, %r12d                    ## imm = 0x1000
	cmovnel	%eax, %r12d
	movl	$1, %eax
	movl	-60(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %ecx
	shll	%cl, %eax
	cltq
	orq	%rax, -72(%rbp)
	leaq	-56(%rbp), %rdx
	movq	%r15, %rdi
	movl	$74, %esi
	callq	_pci_read_config_word
	movl	%r14d, %ecx
	shll	$2, %ecx
	movl	$3, %eax
	shll	%cl, %eax
	notl	%eax
	andl	$3, %ebx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	andl	-56(%rbp), %eax
	orl	%eax, %ebx
	movl	%ebx, -56(%rbp)
	movq	%r15, %rdi
	movl	$74, %esi
	movl	%ebx, %edx
	callq	_pci_write_config_word
	leaq	-64(%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, %r12d
	andl	-64(%rbp), %eax
	orl	%eax, %r12d
	movl	%r12d, -64(%rbp)
	movq	%r15, %rdi
	movl	$84, %esi
	movl	%r12d, %edx
	jmp	LBB0_6
LBB0_4:
	andl	$52468, %eax                    ## imm = 0xCCF4
	orl	%ecx, %eax
	movslq	%ebx, %rcx
	shlq	$4, %rcx
	leaq	_it8213_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, -44(%rbp)
LBB0_5:
	movl	$-2, %eax
	movl	%r14d, %ecx
	roll	%cl, %eax
	cltq
	andq	%rax, -72(%rbp)
	movq	%r15, %rdi
	movl	$64, %esi
LBB0_6:
	callq	_pci_write_config_word
	movq	-72(%rbp), %rdx
	movq	%r15, %rdi
	movl	$72, %esi
	callq	_pci_write_config_byte
	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                               ## @it8213_set_dmamode.timings
_it8213_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
	.p2align	2                               ## @it8213_set_dmamode.needed_pio
_it8213_set_dmamode.needed_pio:
	.long	130                             ## 0x82
	.long	129                             ## 0x81
	.long	128                             ## 0x80

	.no_dead_strip	_it8213_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function it8213_set_dmamode
_it8213_set_dmamode:                    ; @it8213_set_dmamode
	.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	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	ldr	x23, [x21]
	ldr	w22, [x21, #8]
	add	x2, sp, #28
	mov	w1, #64
	bl	_pci_read_config_word
	add	x2, sp, #16
	mov	x0, x19
	mov	w1, #72
	bl	_pci_read_config_byte
Lloh0:
	adrp	x8, _XFER_UDMA_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _XFER_UDMA_0@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x8]
	ldr	x8, [x21]
	cmp	x23, x9
	b.ge	LBB0_3
; %bb.1:
Lloh3:
	adrp	x9, _XFER_MW_DMA_0@GOTPAGE
Lloh4:
	ldr	x9, [x9, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	sub	w8, w8, w9
Lloh6:
	adrp	x9, _it8213_set_dmamode.needed_pio@PAGE
Lloh7:
	add	x9, x9, _it8213_set_dmamode.needed_pio@PAGEOFF
	ldr	w8, [x9, w8, uxtw #2]
	sub	w23, w8, #130
	ldr	w9, [x21, #12]
	mov	w10, #3
	mov	w11, #11
	cmp	w9, w8
	csel	w8, w11, w10, lo
	ldr	w9, [sp, #28]
	cbz	w22, LBB0_4
; %bb.2:
	mov	w10, #65359
	and	w9, w9, w10
	orr	w8, w9, w8, lsl #4
	str	w8, [sp, #28]
	mov	x2, sp
	mov	x0, x19
	mov	w1, #68
	bl	_pci_read_config_byte
	ldrsw	x8, [x20]
	cmp	x8, #0
	cset	w9, ne
	mov	w10, #225
	orr	x11, xzr, #0xf
	madd	x8, x8, x10, x11
	ldr	x10, [sp]
	and	x8, x10, x8
Lloh8:
	adrp	x10, _it8213_set_dmamode.timings@PAGE
Lloh9:
	add	x10, x10, _it8213_set_dmamode.timings@PAGEOFF
	add	x10, x10, w23, sxtw #4
	ldp	x11, x10, [x10]
	orr	x10, x10, x11, lsl #2
	lsl	x9, x9, #2
	lsl	x9, x10, x9
	orr	x2, x9, x8
	str	x2, [sp]
	mov	x0, x19
	mov	w1, #68
	bl	_pci_write_config_byte
	ldr	w2, [sp, #28]
	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
	cmp	w20, #2
	cset	w8, hi
	mov	w9, #4096
	cmp	w20, #5
	csel	w21, w9, w8, eq
	mov	w8, #1
	lsl	w8, w8, w22
	sxtw	x8, w8
	ldr	x9, [sp, #16]
	orr	x8, x9, x8
	str	x8, [sp, #16]
	mov	x2, sp
	mov	x0, x19
	mov	w1, #74
	bl	_pci_read_config_word
	lsl	w8, w22, #2
	mov	w9, #3
	lsl	w9, w9, w8
	ldr	w10, [sp]
	bic	w9, w10, w9
	and	w10, w20, #0x3
	lsl	w8, w10, w8
	orr	w2, w9, w8
	str	w2, [sp]
	mov	x0, x19
	mov	w1, #74
	bl	_pci_write_config_word
	add	x2, sp, #12
	mov	x0, x19
	mov	w1, #84
	bl	_pci_read_config_word
	mov	w8, #4097
	lsl	w8, w8, w22
	ldr	w9, [sp, #12]
	bic	w8, w9, w8
	lsl	w9, w21, w22
	orr	w2, w8, w9
	str	w2, [sp, #12]
	mov	x0, x19
	mov	w1, #84
	b	LBB0_6
LBB0_4:
	mov	w10, #52468
	and	w9, w9, w10
	orr	w8, w9, w8
Lloh10:
	adrp	x9, _it8213_set_dmamode.timings@PAGE
Lloh11:
	add	x9, x9, _it8213_set_dmamode.timings@PAGEOFF
	add	x9, x9, w23, 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, #28]
LBB0_5:
	mov	w8, #1
	lsl	w8, w8, w22
	mvn	w8, w8
	sxtw	x8, w8
	ldr	x9, [sp, #16]
	and	x8, x9, x8
	str	x8, [sp, #16]
	mov	x0, x19
	mov	w1, #64
LBB0_6:
	bl	_pci_write_config_word
	ldr	x2, [sp, #16]
	mov	x0, x19
	mov	w1, #72
	bl	_pci_write_config_byte
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	3                               ; @it8213_set_dmamode.timings
_it8213_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
	.p2align	2                               ; @it8213_set_dmamode.needed_pio
_it8213_set_dmamode.needed_pio:
	.long	130                             ; 0x82
	.long	129                             ; 0x81
	.long	128                             ; 0x80

	.no_dead_strip	_it8213_set_dmamode
.subsections_via_symbols
