	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cs5536_set_piomode
_cs5536_set_piomode:                    ## @cs5536_set_piomode
	.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, %rbx
	movq	(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_ata_dev_pair
	movslq	(%rbx), %r13
	movq	_XFER_PIO_0@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	subq	%rcx, %r13
	movq	8(%rbx), %rdx
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	_IDE_D1_SHIFT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r15d
	movq	_IDE_D0_SHIFT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	movq	_IDE_CAST_D1_SHIFT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r12d
	movq	_IDE_CAST_D0_SHIFT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ebx
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movl	(%rax), %esi
	subl	%ecx, %esi
	movl	%r13d, %edi
	callq	_min
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_3
LBB0_1:
	movl	%r13d, %eax
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
LBB0_3:
	movq	_DTC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	callq	_cs5536_read
	movq	_CAST@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_cs5536_read
	movq	_ETC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r14, %rdi
	callq	_cs5536_read
	cmpq	$0, -72(%rbp)                   ## 8-byte Folded Reload
	movq	_IDE_DRV_MASK@GOTPCREL(%rip), %rax
	cmovel	-60(%rbp), %r15d                ## 4-byte Folded Reload
	cmovel	%ebx, %r12d
	movl	(%rax), %eax
	movl	%r15d, %ecx
	shll	%cl, %eax
	notl	%eax
	leaq	_cs5536_set_piomode.drv_timings(%rip), %rcx
	movl	(%rcx,%r13,4), %edx
	movl	-56(%rbp), %esi
	movl	%r15d, %ecx
	shll	%cl, %edx
	andl	%eax, %esi
	orl	%esi, %edx
	movl	%edx, -56(%rbp)
	movq	_IDE_CAST_DRV_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%r12d, %ecx
	shll	%cl, %esi
	notl	%esi
	andl	-48(%rbp), %esi
	leaq	_cs5536_set_piomode.addr_timings(%rip), %rcx
	movl	(%rcx,%r13,4), %edi
	movl	%r12d, %ecx
	shll	%cl, %edi
	orl	%esi, %edi
	movq	_IDE_CAST_CMD_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_IDE_CAST_CMD_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %esi
	notl	%esi
	andl	%edi, %esi
	movslq	-52(%rbp), %rdi                 ## 4-byte Folded Reload
	leaq	_cs5536_set_piomode.cmd_timings(%rip), %rbx
	movl	(%rbx,%rdi,4), %edi
	shll	%cl, %edi
	orl	%esi, %edi
	andl	-44(%rbp), %eax
	movq	_IDE_ETC_NODMA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%r15d, %ecx
	shll	%cl, %esi
	movl	%edi, -48(%rbp)
	orl	%eax, %esi
	movl	%esi, -44(%rbp)
	movq	_DTC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_cs5536_write
	movq	_CAST@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-48(%rbp), %edx
	movq	%r14, %rdi
	callq	_cs5536_write
	movq	_ETC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-44(%rbp), %edx
	movq	%r14, %rdi
	callq	_cs5536_write
	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                               ## @cs5536_set_piomode.drv_timings
_cs5536_set_piomode.drv_timings:
	.long	152                             ## 0x98
	.long	85                              ## 0x55
	.long	50                              ## 0x32
	.long	33                              ## 0x21
	.long	32                              ## 0x20

	.p2align	4                               ## @cs5536_set_piomode.addr_timings
_cs5536_set_piomode.addr_timings:
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0

	.p2align	4                               ## @cs5536_set_piomode.cmd_timings
_cs5536_set_piomode.cmd_timings:
	.long	153                             ## 0x99
	.long	146                             ## 0x92
	.long	144                             ## 0x90
	.long	34                              ## 0x22
	.long	32                              ## 0x20

	.comm	_XFER_PIO_0,4,2                 ## @XFER_PIO_0
	.comm	_IDE_D1_SHIFT,4,2               ## @IDE_D1_SHIFT
	.comm	_IDE_D0_SHIFT,4,2               ## @IDE_D0_SHIFT
	.comm	_IDE_CAST_D1_SHIFT,4,2          ## @IDE_CAST_D1_SHIFT
	.comm	_IDE_CAST_D0_SHIFT,4,2          ## @IDE_CAST_D0_SHIFT
	.comm	_DTC,4,2                        ## @DTC
	.comm	_CAST,4,2                       ## @CAST
	.comm	_ETC,4,2                        ## @ETC
	.comm	_IDE_DRV_MASK,4,2               ## @IDE_DRV_MASK
	.comm	_IDE_CAST_DRV_MASK,4,2          ## @IDE_CAST_DRV_MASK
	.comm	_IDE_CAST_CMD_MASK,4,2          ## @IDE_CAST_CMD_MASK
	.comm	_IDE_CAST_CMD_SHIFT,4,2         ## @IDE_CAST_CMD_SHIFT
	.comm	_IDE_ETC_NODMA,4,2              ## @IDE_ETC_NODMA
	.no_dead_strip	_cs5536_set_piomode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cs5536_set_piomode
_cs5536_set_piomode:                    ; @cs5536_set_piomode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	ldr	x8, [x0]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	mov	x0, x20
	bl	_ata_dev_pair
	ldr	w9, [x20]
Lloh0:
	adrp	x8, _XFER_PIO_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _XFER_PIO_0@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w21, w9, w8
	ldr	x22, [x20, #8]
Lloh3:
	adrp	x9, _IDE_D1_SHIFT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _IDE_D1_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w23, [x9]
Lloh6:
	adrp	x9, _IDE_D0_SHIFT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _IDE_D0_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w24, [x9]
Lloh9:
	adrp	x9, _IDE_CAST_D1_SHIFT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _IDE_CAST_D1_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w25, [x9]
Lloh12:
	adrp	x9, _IDE_CAST_D0_SHIFT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _IDE_CAST_D0_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w26, [x9]
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w9, [x0]
	sub	w1, w9, w8
	mov	x0, x21
	bl	_min
	mov	x20, x0
	b	LBB0_3
LBB0_2:
	mov	x20, x21
LBB0_3:
	cmp	x22, #0
	csel	w26, w26, w25, eq
	csel	w23, w24, w23, eq
Lloh15:
	adrp	x22, _DTC@GOTPAGE
Lloh16:
	ldr	x22, [x22, _DTC@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, sp, #12
	mov	x0, x19
	bl	_cs5536_read
Lloh17:
	adrp	x24, _CAST@GOTPAGE
Lloh18:
	ldr	x24, [x24, _CAST@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #8
	mov	x0, x19
	bl	_cs5536_read
Lloh19:
	adrp	x25, _ETC@GOTPAGE
Lloh20:
	ldr	x25, [x25, _ETC@GOTPAGEOFF]
	ldr	w1, [x25]
	add	x2, sp, #4
	mov	x0, x19
	bl	_cs5536_read
Lloh21:
	adrp	x8, _IDE_DRV_MASK@GOTPAGE
Lloh22:
	ldr	x8, [x8, _IDE_DRV_MASK@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	lsl	w8, w8, w23
	ldr	w9, [sp, #12]
	bic	w9, w9, w8
Lloh24:
	adrp	x10, _cs5536_set_piomode.drv_timings@PAGE
Lloh25:
	add	x10, x10, _cs5536_set_piomode.drv_timings@PAGEOFF
	sbfiz	x11, x21, #2, #32
	ldr	w10, [x10, x11]
	lsl	w10, w10, w23
	orr	w2, w10, w9
	str	w2, [sp, #12]
Lloh26:
	adrp	x9, _IDE_CAST_DRV_MASK@GOTPAGE
Lloh27:
	ldr	x9, [x9, _IDE_CAST_DRV_MASK@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	lsl	w9, w9, w26
	ldr	w10, [sp, #8]
	bic	w9, w10, w9
Lloh29:
	adrp	x10, _cs5536_set_piomode.addr_timings@PAGE
Lloh30:
	add	x10, x10, _cs5536_set_piomode.addr_timings@PAGEOFF
	ldr	w10, [x10, x11]
	lsl	w10, w10, w26
	orr	w9, w10, w9
Lloh31:
	adrp	x10, _IDE_CAST_CMD_MASK@GOTPAGE
Lloh32:
	ldr	x10, [x10, _IDE_CAST_CMD_MASK@GOTPAGEOFF]
Lloh33:
	ldr	w10, [x10]
Lloh34:
	adrp	x11, _IDE_CAST_CMD_SHIFT@GOTPAGE
Lloh35:
	ldr	x11, [x11, _IDE_CAST_CMD_SHIFT@GOTPAGEOFF]
Lloh36:
	ldr	w11, [x11]
	lsl	w10, w10, w11
	bic	w9, w9, w10
Lloh37:
	adrp	x10, _cs5536_set_piomode.cmd_timings@PAGE
Lloh38:
	add	x10, x10, _cs5536_set_piomode.cmd_timings@PAGEOFF
	ldr	w10, [x10, w20, sxtw #2]
	lsl	w10, w10, w11
	orr	w9, w10, w9
	str	w9, [sp, #8]
	ldr	w9, [sp, #4]
Lloh39:
	adrp	x10, _IDE_ETC_NODMA@GOTPAGE
Lloh40:
	ldr	x10, [x10, _IDE_ETC_NODMA@GOTPAGEOFF]
	bic	w8, w9, w8
Lloh41:
	ldr	w9, [x10]
	lsl	w9, w9, w23
	orr	w8, w9, w8
	str	w8, [sp, #4]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_cs5536_write
	ldr	w1, [x24]
	ldr	w2, [sp, #8]
	mov	x0, x19
	bl	_cs5536_write
	ldr	w1, [x25]
	ldr	w2, [sp, #4]
	mov	x0, x19
	bl	_cs5536_write
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @cs5536_set_piomode.drv_timings
_cs5536_set_piomode.drv_timings:
	.long	152                             ; 0x98
	.long	85                              ; 0x55
	.long	50                              ; 0x32
	.long	33                              ; 0x21
	.long	32                              ; 0x20

	.p2align	2                               ; @cs5536_set_piomode.addr_timings
_cs5536_set_piomode.addr_timings:
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0

	.p2align	2                               ; @cs5536_set_piomode.cmd_timings
_cs5536_set_piomode.cmd_timings:
	.long	153                             ; 0x99
	.long	146                             ; 0x92
	.long	144                             ; 0x90
	.long	34                              ; 0x22
	.long	32                              ; 0x20

	.comm	_XFER_PIO_0,4,2                 ; @XFER_PIO_0
	.comm	_IDE_D1_SHIFT,4,2               ; @IDE_D1_SHIFT
	.comm	_IDE_D0_SHIFT,4,2               ; @IDE_D0_SHIFT
	.comm	_IDE_CAST_D1_SHIFT,4,2          ; @IDE_CAST_D1_SHIFT
	.comm	_IDE_CAST_D0_SHIFT,4,2          ; @IDE_CAST_D0_SHIFT
	.comm	_DTC,4,2                        ; @DTC
	.comm	_CAST,4,2                       ; @CAST
	.comm	_ETC,4,2                        ; @ETC
	.comm	_IDE_DRV_MASK,4,2               ; @IDE_DRV_MASK
	.comm	_IDE_CAST_DRV_MASK,4,2          ; @IDE_CAST_DRV_MASK
	.comm	_IDE_CAST_CMD_MASK,4,2          ; @IDE_CAST_CMD_MASK
	.comm	_IDE_CAST_CMD_SHIFT,4,2         ; @IDE_CAST_CMD_SHIFT
	.comm	_IDE_ETC_NODMA,4,2              ; @IDE_ETC_NODMA
	.no_dead_strip	_cs5536_set_piomode
.subsections_via_symbols
