	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atp867x_set_dmamode
_atp867x_set_dmamode:                   ## @atp867x_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movl	(%r14), %ecx
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rdx
	subl	(%rdx), %ecx
	movq	(%rbx), %r15
	leal	1(%rcx), %ebx
	cmpq	$0, 8(%r15)
	je	LBB0_3
## %bb.1:
	movq	_ATP867X_IO_DMAMODE_UDMA_0@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	jl	LBB0_3
## %bb.2:
	movq	(%rax), %rax
	movq	_PCI_DEVICE_ID_ARTOP_ATP867B@GOTPCREL(%rip), %rdx
	movq	_ATP867X_IO_DMAMODE_UDMA_5@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ebx
	cmovll	%ecx, %ebx
	cmpq	(%rdx), %rax
	cmovel	%ecx, %ebx
LBB0_3:
	movl	(%r15), %edi
	callq	_ioread8
	testb	$1, 4(%r14)
	movq	_ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPCREL(%rip), %rcx
	cmoveq	_ATP867X_IO_DMAMODE_MSTR_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_ATP867X_IO_DMAMODE_SLAVE_SHIFT@GOTPCREL(%rip), %rcx
	cmoveq	_ATP867X_IO_DMAMODE_MSTR_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %ebx
	notl	%edx
	andl	%eax, %edx
	orl	%edx, %ebx
	movl	(%r15), %esi
	movl	%ebx, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_iowrite8                       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_XFER_UDMA_0,4,2                ## @XFER_UDMA_0
	.comm	_ATP867X_IO_DMAMODE_UDMA_0,4,2  ## @ATP867X_IO_DMAMODE_UDMA_0
	.comm	_PCI_DEVICE_ID_ARTOP_ATP867B,8,3 ## @PCI_DEVICE_ID_ARTOP_ATP867B
	.comm	_ATP867X_IO_DMAMODE_UDMA_5,4,2  ## @ATP867X_IO_DMAMODE_UDMA_5
	.comm	_ATP867X_IO_DMAMODE_SLAVE_MASK,4,2 ## @ATP867X_IO_DMAMODE_SLAVE_MASK
	.comm	_ATP867X_IO_DMAMODE_SLAVE_SHIFT,4,2 ## @ATP867X_IO_DMAMODE_SLAVE_SHIFT
	.comm	_ATP867X_IO_DMAMODE_MSTR_MASK,4,2 ## @ATP867X_IO_DMAMODE_MSTR_MASK
	.comm	_ATP867X_IO_DMAMODE_MSTR_SHIFT,4,2 ## @ATP867X_IO_DMAMODE_MSTR_SHIFT
	.no_dead_strip	_atp867x_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atp867x_set_dmamode
_atp867x_set_dmamode:                   ; @atp867x_set_dmamode
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	ldr	x20, [x20]
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _XFER_UDMA_0@GOTPAGE
Lloh1:
	ldr	x9, [x9, _XFER_UDMA_0@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	sub	w8, w8, w9
	add	w21, w8, #1
	ldr	x9, [x20, #8]
Lloh3:
	adrp	x10, _ATP867X_IO_DMAMODE_UDMA_0@GOTPAGE
Lloh4:
	ldr	x10, [x10, _ATP867X_IO_DMAMODE_UDMA_0@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	cmp	x9, #0
	ccmp	w8, w10, #8, ne
	b.lt	LBB0_2
; %bb.1:
	ldr	x9, [x0]
Lloh6:
	adrp	x10, _PCI_DEVICE_ID_ARTOP_ATP867B@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PCI_DEVICE_ID_ARTOP_ATP867B@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
Lloh9:
	adrp	x11, _ATP867X_IO_DMAMODE_UDMA_5@GOTPAGE
Lloh10:
	ldr	x11, [x11, _ATP867X_IO_DMAMODE_UDMA_5@GOTPAGEOFF]
Lloh11:
	ldr	w11, [x11]
	cmp	w21, w11
	ccmp	x9, x10, #4, ge
	csel	w21, w8, w21, eq
LBB0_2:
	ldr	w0, [x20]
	bl	_ioread8
Lloh12:
	adrp	x8, _ATP867X_IO_DMAMODE_MSTR_MASK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ATP867X_IO_DMAMODE_MSTR_MASK@GOTPAGEOFF]
	ldr	w9, [x19, #4]
Lloh14:
	adrp	x10, _ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPAGE
Lloh15:
	ldr	x10, [x10, _ATP867X_IO_DMAMODE_SLAVE_MASK@GOTPAGEOFF]
	tst	w9, #0x1
	csel	x8, x8, x10, eq
	ldr	w8, [x8]
	bic	w8, w0, w8
Lloh16:
	adrp	x9, _ATP867X_IO_DMAMODE_MSTR_SHIFT@GOTPAGE
Lloh17:
	ldr	x9, [x9, _ATP867X_IO_DMAMODE_MSTR_SHIFT@GOTPAGEOFF]
Lloh18:
	adrp	x10, _ATP867X_IO_DMAMODE_SLAVE_SHIFT@GOTPAGE
Lloh19:
	ldr	x10, [x10, _ATP867X_IO_DMAMODE_SLAVE_SHIFT@GOTPAGEOFF]
	csel	x9, x9, x10, eq
	ldr	w9, [x9]
	lsl	w9, w21, w9
	orr	w0, w9, w8
	ldr	w1, [x20]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_iowrite8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_XFER_UDMA_0,4,2                ; @XFER_UDMA_0
	.comm	_ATP867X_IO_DMAMODE_UDMA_0,4,2  ; @ATP867X_IO_DMAMODE_UDMA_0
	.comm	_PCI_DEVICE_ID_ARTOP_ATP867B,8,3 ; @PCI_DEVICE_ID_ARTOP_ATP867B
	.comm	_ATP867X_IO_DMAMODE_UDMA_5,4,2  ; @ATP867X_IO_DMAMODE_UDMA_5
	.comm	_ATP867X_IO_DMAMODE_SLAVE_MASK,4,2 ; @ATP867X_IO_DMAMODE_SLAVE_MASK
	.comm	_ATP867X_IO_DMAMODE_SLAVE_SHIFT,4,2 ; @ATP867X_IO_DMAMODE_SLAVE_SHIFT
	.comm	_ATP867X_IO_DMAMODE_MSTR_MASK,4,2 ; @ATP867X_IO_DMAMODE_MSTR_MASK
	.comm	_ATP867X_IO_DMAMODE_MSTR_SHIFT,4,2 ; @ATP867X_IO_DMAMODE_MSTR_SHIFT
	.no_dead_strip	_atp867x_set_dmamode
.subsections_via_symbols
