	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radisys_set_dmamode
_radisys_set_dmamode:                   ## @radisys_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
	subq	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %rbx
	leaq	-52(%rbp), %rdx
	movq	%rax, %rdi
	movl	$64, %esi
	callq	_pci_read_config_word
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$72, %esi
	callq	_pci_read_config_byte
	movq	(%r15), %rax
	movq	_XFER_UDMA_0@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_2
## %bb.1:
	movq	_XFER_MW_DMA_0@GOTPCREL(%rip), %rcx
	subl	(%rcx), %eax
	movq	_XFER_PIO_0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -44(%rbp)
	movq	_XFER_PIO_3@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, -40(%rbp)
	movq	_XFER_PIO_4@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, -36(%rbp)
	movl	-44(%rbp,%rax,4), %edx
	movl	%edx, %esi
	subl	%ecx, %esi
	movl	12(%r15), %eax
	xorl	%ecx, %ecx
	cmpl	%edx, 8(%r15)
	setae	%cl
	leal	(%rcx,%rcx), %edi
	incl	%edi
	movl	$52428, %edx                    ## imm = 0xCCCC
	andl	-52(%rbp), %edx
	leal	(,%rax,4), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edi
	orl	%edx, %edi
	movslq	%esi, %rcx
	leaq	_radisys_set_dmamode.timings(%rip), %rdx
	movl	(%rdx,%rcx,8), %esi
	movl	4(%rdx,%rcx,8), %edx
	shll	$12, %esi
	orl	%edi, %esi
	shll	$8, %edx
	orl	%esi, %edx
	movl	$-2, %esi
	movl	%eax, %ecx
	roll	%cl, %esi
	movl	%edx, -52(%rbp)
	andl	%esi, -48(%rbp)
	jmp	LBB0_6
LBB0_2:
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$74, %esi
	callq	_pci_read_config_byte
	movb	12(%r15), %cl
	movl	$1, %edx
	shll	%cl, %edx
	movq	16(%r15), %rax
	movq	_XFER_UDMA_2@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	notl	%edx
	andl	-44(%rbp), %edx
	jmp	LBB0_5
LBB0_4:
	orl	-44(%rbp), %edx
LBB0_5:
	movl	%edx, -44(%rbp)
	movq	%rbx, %rdi
	movl	$74, %esi
	callq	_pci_write_config_byte
	movb	12(%r15), %cl
	movl	$1, %eax
	shll	%cl, %eax
	orl	%eax, -48(%rbp)
	movl	-52(%rbp), %edx
LBB0_6:
	movq	%rbx, %rdi
	movl	$64, %esi
	callq	_pci_write_config_word
	movl	-48(%rbp), %edx
	movq	%rbx, %rdi
	movl	$72, %esi
	callq	_pci_write_config_byte
	movq	%r15, (%r14)
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_8
## %bb.7:
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @radisys_set_dmamode.timings
_radisys_set_dmamode.timings:
	.space	8
	.space	8
	.long	1                               ## 0x1
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.long	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
	.comm	_XFER_UDMA_2,8,3                ## @XFER_UDMA_2
	.no_dead_strip	_radisys_set_dmamode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radisys_set_dmamode
_radisys_set_dmamode:                   ; @radisys_set_dmamode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x21, x0
	add	x2, sp, #8
	mov	w1, #64
	bl	_pci_read_config_word
	add	x2, sp, #4
	mov	x0, x21
	mov	w1, #72
	bl	_pci_read_config_byte
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _XFER_UDMA_0@GOTPAGE
Lloh4:
	ldr	x9, [x9, _XFER_UDMA_0@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_2
; %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:
	adrp	x10, _XFER_PIO_3@GOTPAGE
Lloh12:
	ldr	x10, [x10, _XFER_PIO_3@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
Lloh14:
	ldr	w10, [x10]
	stp	w9, w10, [sp, #12]
Lloh15:
	adrp	x10, _XFER_PIO_4@GOTPAGE
Lloh16:
	ldr	x10, [x10, _XFER_PIO_4@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	str	w10, [sp, #20]
	add	x10, sp, #12
	ldr	w8, [x10, w8, uxtw #2]
	sub	w9, w8, w9
	ldp	w10, w11, [x19, #8]
	cmp	w10, w8
	mov	w8, #3
	csinc	w8, w8, wzr, hs
	ldr	w10, [sp, #8]
	mov	w12, #52428
	and	w10, w10, w12
	lsl	w12, w11, #2
	lsl	w8, w8, w12
Lloh18:
	adrp	x12, _radisys_set_dmamode.timings@PAGE
Lloh19:
	add	x12, x12, _radisys_set_dmamode.timings@PAGEOFF
	orr	w8, w8, w10
	add	x9, x12, w9, sxtw #3
	ldp	w10, w9, [x9]
	orr	w8, w8, w10, lsl #12
	orr	w2, w8, w9, lsl #8
	mov	w8, #1
	lsl	w8, w8, w11
	ldr	w9, [sp, #4]
	bic	w8, w9, w8
	stp	w8, w2, [sp, #4]
	b	LBB0_6
LBB0_2:
	add	x2, sp, #12
	mov	x0, x21
	mov	w1, #74
	bl	_pci_read_config_byte
Lloh20:
	adrp	x8, _XFER_UDMA_2@GOTPAGE
Lloh21:
	ldr	x8, [x8, _XFER_UDMA_2@GOTPAGEOFF]
	ldr	x9, [x19, #16]
Lloh22:
	ldr	x10, [x8]
	ldr	w8, [x19, #12]
	mov	w11, #1
	lsl	w8, w11, w8
	cmp	x9, x10
	b.ne	LBB0_4
; %bb.3:
	ldr	w9, [sp, #12]
	bic	w2, w9, w8
	b	LBB0_5
LBB0_4:
	ldr	w9, [sp, #12]
	orr	w2, w9, w8
LBB0_5:
	str	w2, [sp, #12]
	mov	x0, x21
	mov	w1, #74
	bl	_pci_write_config_byte
	ldr	w8, [x19, #12]
	mov	w9, #1
	lsl	w8, w9, w8
	ldp	w9, w2, [sp, #4]
	orr	w8, w9, w8
	str	w8, [sp, #4]
LBB0_6:
	mov	x0, x21
	mov	w1, #64
	bl	_pci_write_config_word
	ldr	w2, [sp, #4]
	mov	x0, x21
	mov	w1, #72
	bl	_pci_write_config_byte
	str	x19, [x20]
	ldr	x8, [sp, #24]
Lloh23:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh24:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	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
	add	sp, sp, #80
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh13
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @radisys_set_dmamode.timings
_radisys_set_dmamode.timings:
	.space	8
	.space	8
	.long	1                               ; 0x1
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.long	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
	.comm	_XFER_UDMA_2,8,3                ; @XFER_UDMA_2
	.no_dead_strip	_radisys_set_dmamode
.subsections_via_symbols
