	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function it821x_passthru_set_dmamode
_it821x_passthru_set_dmamode:           ## @it821x_passthru_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	16(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movq	8(%r12), %rbx
	movl	(%r12), %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movslq	(%r14), %r13
	movq	8(%r14), %rax
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rdx
	movq	%rax, %rcx
	subq	(%rdx), %rcx
	jge	LBB0_1
## %bb.5:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rcx
	subl	(%rcx), %eax
	cltq
	leaq	_it821x_passthru_set_dmamode.mwdma_want(%rip), %rcx
	movl	(%rcx,%rax,4), %ecx
	movq	(%rbx), %rdx
	movq	(%rdx,%r13,8), %rdx
	movl	%ecx, 4(%rdx)
	movl	$2, (%rdx)
	leaq	_it821x_passthru_set_dmamode.dma(%rip), %rcx
	movl	(%rcx,%rax,4), %eax
	movq	8(%rbx), %rcx
	movl	%eax, (%rcx,%r13,4)
	movq	_UDMA_OFF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	16(%rbx), %rcx
	movl	%eax, (%rcx,%r13,4)
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movl	$80, %esi
	callq	_pci_read_config_byte
	cmpq	$0, 24(%rbx)
	je	LBB0_7
## %bb.6:
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	movl	$24, %eax
	movl	$96, %edx
	cmovel	%eax, %edx
	orl	-44(%rbp), %edx
	jmp	LBB0_8
LBB0_1:
	movslq	%ecx, %rax
	leaq	_it821x_passthru_set_dmamode.udma_want(%rip), %rcx
	movl	(%rcx,%rax,4), %ecx
	movq	(%rbx), %rdx
	movq	(%rdx,%r13,8), %rdx
	movl	%ecx, 4(%rdx)
	movl	$3, (%rdx)
	movq	_MWDMA_OFF@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	8(%rbx), %rdx
	movl	%ecx, (%rdx,%r13,4)
	leaq	_it821x_passthru_set_dmamode.udma(%rip), %rcx
	movl	(%rcx,%rax,4), %ecx
	movq	16(%rbx), %rdx
	movl	%ecx, %esi
	orl	$32896, %esi                    ## imm = 0x8080
	cmpl	$5, %eax
	cmovll	%ecx, %esi
	movl	%esi, (%rdx,%r13,4)
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movl	$80, %esi
	callq	_pci_read_config_byte
	cmpq	$0, 24(%rbx)
	je	LBB0_3
## %bb.2:
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	movl	$231, %eax
	movl	$159, %edx
	cmovel	%eax, %edx
	andl	-44(%rbp), %edx
	jmp	LBB0_4
LBB0_7:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leal	(%r13,%rax,2), %eax
	addb	$3, %al
	movl	-44(%rbp), %edx
	btsl	%eax, %edx
LBB0_8:
	movl	%edx, -44(%rbp)
	movq	%r15, %rdi
	movl	$80, %esi
	callq	_pci_write_config_byte
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_it821x_clock_strategy
	jmp	LBB0_9
LBB0_3:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leal	(%r13,%rax,2), %eax
	addb	$3, %al
	movl	-44(%rbp), %edx
	btrl	%eax, %edx
LBB0_4:
	movl	%edx, -44(%rbp)
	movq	%r15, %rdi
	movl	$80, %esi
	callq	_pci_write_config_byte
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_it821x_clock_strategy
	movq	16(%rbx), %rax
	movl	(%rax,%r13,4), %edx
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_it821x_program_udma
LBB0_9:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	2                               ## @it821x_passthru_set_dmamode.dma
_it821x_passthru_set_dmamode.dma:
	.long	34918                           ## 0x8866
	.long	12834                           ## 0x3222
	.long	12577                           ## 0x3121

	.p2align	2                               ## @it821x_passthru_set_dmamode.mwdma_want
_it821x_passthru_set_dmamode.mwdma_want:
	.long	128                             ## 0x80
	.long	129                             ## 0x81
	.long	128                             ## 0x80

	.p2align	4                               ## @it821x_passthru_set_dmamode.udma
_it821x_passthru_set_dmamode.udma:
	.long	17459                           ## 0x4433
	.long	16945                           ## 0x4231
	.long	12577                           ## 0x3121
	.long	8481                            ## 0x2121
	.long	4369                            ## 0x1111
	.long	8721                            ## 0x2211
	.long	4369                            ## 0x1111

	.p2align	4                               ## @it821x_passthru_set_dmamode.udma_want
_it821x_passthru_set_dmamode.udma_want:
	.long	128                             ## 0x80
	.long	130                             ## 0x82
	.long	128                             ## 0x80
	.long	129                             ## 0x81
	.long	129                             ## 0x81
	.long	130                             ## 0x82
	.long	129                             ## 0x81

	.comm	_XFER_UDMA_0,8,3                ## @XFER_UDMA_0
	.comm	_MWDMA_OFF,4,2                  ## @MWDMA_OFF
	.comm	_XFER_MW_DMA_0,4,2              ## @XFER_MW_DMA_0
	.comm	_UDMA_OFF,4,2                   ## @UDMA_OFF
	.no_dead_strip	_it821x_passthru_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function it821x_passthru_set_dmamode
_it821x_passthru_set_dmamode:           ; @it821x_passthru_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, #16]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x21, x0
	ldr	x23, [x20, #8]
	ldr	w24, [x20]
	ldrsw	x22, [x19]
	ldr	x9, [x19, #8]
Lloh0:
	adrp	x8, _XFER_UDMA_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _XFER_UDMA_0@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	subs	x8, x9, x8
	b.ge	LBB0_3
; %bb.1:
Lloh3:
	adrp	x8, _XFER_MW_DMA_0@GOTPAGE
Lloh4:
	ldr	x8, [x8, _XFER_MW_DMA_0@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	sub	w8, w9, w8
	sbfiz	x8, x8, #2, #32
Lloh6:
	adrp	x9, _it821x_passthru_set_dmamode.mwdma_want@PAGE
Lloh7:
	add	x9, x9, _it821x_passthru_set_dmamode.mwdma_want@PAGEOFF
	ldr	w9, [x9, x8]
	ldp	x10, x11, [x23]
	ldr	x10, [x10, x22, lsl #3]
	mov	w12, #2
Lloh8:
	adrp	x13, _it821x_passthru_set_dmamode.dma@PAGE
Lloh9:
	add	x13, x13, _it821x_passthru_set_dmamode.dma@PAGEOFF
	stp	w12, w9, [x10]
	ldr	w8, [x13, x8]
	lsl	x9, x22, #2
	str	w8, [x11, x9]
Lloh10:
	adrp	x8, _UDMA_OFF@GOTPAGE
Lloh11:
	ldr	x8, [x8, _UDMA_OFF@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	ldr	x10, [x23, #16]
	str	w8, [x10, x9]
	add	x2, sp, #12
	mov	x0, x21
	mov	w1, #80
	bl	_pci_read_config_byte
	ldr	x8, [x23, #24]
	cbz	x8, LBB0_5
; %bb.2:
	mov	w8, #96
	mov	w9, #24
	cmp	w24, #0
	csel	w8, w9, w8, eq
	b	LBB0_6
LBB0_3:
	sbfiz	x9, x8, #2, #32
Lloh13:
	adrp	x10, _it821x_passthru_set_dmamode.udma_want@PAGE
Lloh14:
	add	x10, x10, _it821x_passthru_set_dmamode.udma_want@PAGEOFF
	ldr	w10, [x10, x9]
	ldp	x11, x12, [x23]
	ldr	x11, [x11, x22, lsl #3]
	mov	w13, #3
	stp	w13, w10, [x11]
Lloh15:
	adrp	x10, _MWDMA_OFF@GOTPAGE
Lloh16:
	ldr	x10, [x10, _MWDMA_OFF@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	lsl	x11, x22, #2
	str	w10, [x12, x11]
Lloh18:
	adrp	x10, _it821x_passthru_set_dmamode.udma@PAGE
Lloh19:
	add	x10, x10, _it821x_passthru_set_dmamode.udma@PAGEOFF
	ldr	w9, [x10, x9]
	ldr	x10, [x23, #16]
	mov	w12, #32896
	orr	w12, w9, w12
	cmp	w8, #4
	csel	w8, w12, w9, gt
	str	w8, [x10, x11]
	add	x2, sp, #12
	mov	x0, x21
	mov	w1, #80
	bl	_pci_read_config_byte
	ldr	x8, [x23, #24]
	cbz	x8, LBB0_7
; %bb.4:
	mov	w8, #159
	mov	w9, #231
	cmp	w24, #0
	csel	w8, w9, w8, eq
	ldr	w9, [sp, #12]
	and	w2, w9, w8
	b	LBB0_8
LBB0_5:
	add	w8, w22, w24, lsl #1
	add	w8, w8, #3
	mov	w9, #1
	lsl	w8, w9, w8
LBB0_6:
	ldr	w9, [sp, #12]
	orr	w2, w9, w8
	str	w2, [sp, #12]
	mov	x0, x21
	mov	w1, #80
	bl	_pci_write_config_byte
	mov	x0, x20
	mov	x1, x19
	bl	_it821x_clock_strategy
	b	LBB0_9
LBB0_7:
	add	w8, w22, w24, lsl #1
	add	w8, w8, #3
	mov	w9, #1
	lsl	w8, w9, w8
	ldr	w9, [sp, #12]
	bic	w2, w9, w8
LBB0_8:
	str	w2, [sp, #12]
	mov	x0, x21
	mov	w1, #80
	bl	_pci_write_config_byte
	mov	x0, x20
	mov	x1, x19
	bl	_it821x_clock_strategy
	ldr	x8, [x23, #16]
	ldr	w2, [x8, x22, lsl #2]
	mov	x0, x20
	mov	x1, x19
	bl	_it821x_program_udma
LBB0_9:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @it821x_passthru_set_dmamode.dma
_it821x_passthru_set_dmamode.dma:
	.long	34918                           ; 0x8866
	.long	12834                           ; 0x3222
	.long	12577                           ; 0x3121

	.p2align	2                               ; @it821x_passthru_set_dmamode.mwdma_want
_it821x_passthru_set_dmamode.mwdma_want:
	.long	128                             ; 0x80
	.long	129                             ; 0x81
	.long	128                             ; 0x80

	.p2align	2                               ; @it821x_passthru_set_dmamode.udma
_it821x_passthru_set_dmamode.udma:
	.long	17459                           ; 0x4433
	.long	16945                           ; 0x4231
	.long	12577                           ; 0x3121
	.long	8481                            ; 0x2121
	.long	4369                            ; 0x1111
	.long	8721                            ; 0x2211
	.long	4369                            ; 0x1111

	.p2align	2                               ; @it821x_passthru_set_dmamode.udma_want
_it821x_passthru_set_dmamode.udma_want:
	.long	128                             ; 0x80
	.long	130                             ; 0x82
	.long	128                             ; 0x80
	.long	129                             ; 0x81
	.long	129                             ; 0x81
	.long	130                             ; 0x82
	.long	129                             ; 0x81

	.comm	_XFER_UDMA_0,8,3                ; @XFER_UDMA_0
	.comm	_MWDMA_OFF,4,2                  ; @MWDMA_OFF
	.comm	_XFER_MW_DMA_0,4,2              ; @XFER_MW_DMA_0
	.comm	_UDMA_OFF,4,2                   ; @UDMA_OFF
	.no_dead_strip	_it821x_passthru_set_dmamode
.subsections_via_symbols
