	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cs5536_set_pio_mode
_cs5536_set_pio_mode:                   ## @cs5536_set_pio_mode
	.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
	movl	%esi, %ebx
	movq	%rdi, %r13
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_ide_get_pair_dev
	movq	%rax, %r15
	movl	(%r13), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	_IDE_CAST_D1_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_IDE_CAST_D0_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	callq	_ide_get_drivedata
	movq	%rax, %r14
	movl	%ebx, %eax
	testq	%r15, %r15
	je	LBB0_2
## %bb.1:
	movq	%r15, %rdi
	movl	$255, %esi
	movl	$4, %edx
	callq	_ide_get_best_pio_mode
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_min
LBB0_2:
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	_IDE_DRV_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$8, %eax
	cltq
	andq	%rax, %r14
	movslq	%ebx, %r15
	leaq	_cs5536_set_pio_mode.drv_timings(%rip), %rax
	movslq	(%rax,%r15,4), %rbx
	orq	%rbx, %r14
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_ide_set_drivedata
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_cs5536_program_dtc
	movq	_CAST@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-44(%rbp), %rdx
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_cs5536_read
	testb	$1, -56(%rbp)                   ## 1-byte Folded Reload
	movq	_IDE_CAST_DRV_MASK@GOTPCREL(%rip), %rax
	cmovel	-52(%rbp), %r12d                ## 4-byte Folded Reload
	movl	(%rax), %eax
	movl	%r12d, %ecx
	shll	%cl, %eax
	notl	%eax
	andl	-44(%rbp), %eax
	leaq	_cs5536_set_pio_mode.addr_timings(%rip), %rcx
	movl	(%rcx,%r15,4), %esi
	movl	%r12d, %ecx
	shll	%cl, %esi
	movq	_IDE_CAST_CMD_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	_IDE_CAST_CMD_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %edi
	orl	%eax, %esi
	notl	%edi
	movslq	-48(%rbp), %rax                 ## 4-byte Folded Reload
	leaq	_cs5536_set_pio_mode.cmd_timings(%rip), %rdx
	movl	(%rdx,%rax,4), %edx
	shll	%cl, %edx
	andl	%esi, %edi
	orl	%edi, %edx
	movl	%edx, -44(%rbp)
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_cs5536_write
	addq	$24, %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_pio_mode.drv_timings
_cs5536_set_pio_mode.drv_timings:
	.long	152                             ## 0x98
	.long	85                              ## 0x55
	.long	50                              ## 0x32
	.long	33                              ## 0x21
	.long	32                              ## 0x20

	.p2align	4                               ## @cs5536_set_pio_mode.addr_timings
_cs5536_set_pio_mode.addr_timings:
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0

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

	.comm	_IDE_CAST_D1_SHIFT,4,2          ## @IDE_CAST_D1_SHIFT
	.comm	_IDE_CAST_D0_SHIFT,4,2          ## @IDE_CAST_D0_SHIFT
	.comm	_IDE_DRV_MASK,4,2               ## @IDE_DRV_MASK
	.comm	_CAST,4,2                       ## @CAST
	.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
	.no_dead_strip	_cs5536_set_pio_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cs5536_set_pio_mode
_cs5536_set_pio_mode:                   ; @cs5536_set_pio_mode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	mov	x0, x20
	bl	_ide_get_pair_dev
	mov	x24, x0
	ldr	w25, [x20]
Lloh0:
	adrp	x8, _IDE_CAST_D1_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IDE_CAST_D1_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w26, [x8]
Lloh3:
	adrp	x8, _IDE_CAST_D0_SHIFT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IDE_CAST_D0_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w27, [x8]
	mov	x0, x20
	bl	_ide_get_drivedata
	mov	x23, x0
	mov	x21, x22
	cbz	x24, LBB0_2
; %bb.1:
	mov	x0, x24
	mov	w1, #255
	mov	w2, #4
	bl	_ide_get_best_pio_mode
	mov	x1, x0
	mov	x0, x22
	bl	_min
	mov	x21, x0
LBB0_2:
	tst	w25, #0x1
	csel	w24, w27, w26, eq
Lloh6:
	adrp	x8, _IDE_DRV_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _IDE_DRV_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	lsl	w8, w8, #8
	sxtw	x8, w8
	and	x8, x23, x8
	sbfiz	x23, x22, #2, #32
Lloh9:
	adrp	x9, _cs5536_set_pio_mode.drv_timings@PAGE
Lloh10:
	add	x9, x9, _cs5536_set_pio_mode.drv_timings@PAGEOFF
	ldrsw	x22, [x9, x23]
	orr	x1, x8, x22
	mov	x0, x20
	bl	_ide_set_drivedata
	mov	x0, x20
	mov	x1, x22
	bl	_cs5536_program_dtc
Lloh11:
	adrp	x20, _CAST@GOTPAGE
Lloh12:
	ldr	x20, [x20, _CAST@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	mov	x0, x19
	bl	_cs5536_read
Lloh13:
	adrp	x8, _IDE_CAST_DRV_MASK@GOTPAGE
Lloh14:
	ldr	x8, [x8, _IDE_CAST_DRV_MASK@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	lsl	w8, w8, w24
	ldr	w9, [sp, #12]
	bic	w8, w9, w8
Lloh16:
	adrp	x9, _cs5536_set_pio_mode.addr_timings@PAGE
Lloh17:
	add	x9, x9, _cs5536_set_pio_mode.addr_timings@PAGEOFF
	ldr	w9, [x9, x23]
	lsl	w9, w9, w24
	orr	w8, w9, w8
Lloh18:
	adrp	x9, _IDE_CAST_CMD_MASK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _IDE_CAST_CMD_MASK@GOTPAGEOFF]
Lloh20:
	adrp	x10, _IDE_CAST_CMD_SHIFT@GOTPAGE
Lloh21:
	ldr	x10, [x10, _IDE_CAST_CMD_SHIFT@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
Lloh23:
	ldr	w10, [x10]
	lsl	w9, w9, w10
	bic	w8, w8, w9
Lloh24:
	adrp	x9, _cs5536_set_pio_mode.cmd_timings@PAGE
Lloh25:
	add	x9, x9, _cs5536_set_pio_mode.cmd_timings@PAGEOFF
	ldr	w9, [x9, w21, sxtw #2]
	lsl	w9, w9, w10
	orr	w2, w9, w8
	str	w2, [sp, #12]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_cs5536_write
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh22
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @cs5536_set_pio_mode.drv_timings
_cs5536_set_pio_mode.drv_timings:
	.long	152                             ; 0x98
	.long	85                              ; 0x55
	.long	50                              ; 0x32
	.long	33                              ; 0x21
	.long	32                              ; 0x20

	.p2align	2                               ; @cs5536_set_pio_mode.addr_timings
_cs5536_set_pio_mode.addr_timings:
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0

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

	.comm	_IDE_CAST_D1_SHIFT,4,2          ; @IDE_CAST_D1_SHIFT
	.comm	_IDE_CAST_D0_SHIFT,4,2          ; @IDE_CAST_D0_SHIFT
	.comm	_IDE_DRV_MASK,4,2               ; @IDE_DRV_MASK
	.comm	_CAST,4,2                       ; @CAST
	.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
	.no_dead_strip	_cs5536_set_pio_mode
.subsections_via_symbols
