	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function via_do_set_mode
_via_do_set_mode:                       ## @via_do_set_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	$136, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -52(%rbp)                 ## 4-byte Spill
	movl	%r8d, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, %r12d
	movl	%edx, %r15d
	movq	%rsi, %r13
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %rbx
	movq	%r13, %rdi
	callq	_ata_dev_pair
	movq	%rax, %r14
	movslq	%r12d, %rax
	cmpq	$30000, %rax                    ## imm = 0x7530
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	ja	LBB0_2
## %bb.1:
	movl	$30000, %eax                    ## imm = 0x7530
	xorl	%edx, %edx
	divl	%r12d
	movl	%eax, %r12d
	jmp	LBB0_3
LBB0_2:
	xorl	%r12d, %r12d
LBB0_3:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %ebx
	addl	%ebx, %ebx
	addl	(%r13), %ebx
	leaq	-120(%rbp), %rdx
	movl	$30000, %ecx                    ## imm = 0x7530
	movq	%r13, %rdi
	movl	%r15d, %esi
	movq	%r12, %r8
	callq	_ata_timing_compute
	testq	%r14, %r14
	je	LBB0_6
## %bb.4:
	movl	4(%r14), %esi
	testl	%esi, %esi
	je	LBB0_6
## %bb.5:
	leaq	-168(%rbp), %r15
	movl	$30000, %ecx                    ## imm = 0x7530
	movq	%r14, %rdi
	movq	%r15, %rdx
	movq	%r12, %r8
	callq	_ata_timing_compute
	movq	_ATA_TIMING_8BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-120(%rbp), %rdx
	movq	%r15, %rdi
	movq	%rdx, %rsi
	callq	_ata_timing_merge
LBB0_6:
	movl	$3, %r12d
	subl	%ebx, %r12d
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_8
## %bb.7:
	leal	(%r12,%r12), %ebx
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movl	$76, %esi
	callq	_pci_read_config_byte
	movl	$3, %eax
	movl	%ebx, %ecx
	shll	%cl, %eax
	notl	%eax
	andl	%eax, -44(%rbp)
	movq	-80(%rbp), %rdi
	movl	$1, %esi
	movl	$4, %edx
	callq	_clamp_val
	movl	%ebx, %ecx
	shll	%cl, %eax
	orl	-44(%rbp), %eax
	movl	%eax, -44(%rbp)
	movq	%r15, %rdi
	movl	$76, %esi
	movl	%eax, %edx
	callq	_pci_write_config_byte
LBB0_8:
	movl	$79, %ebx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	subl	(%rax), %ebx
	movq	-88(%rbp), %rdi
	movl	$1, %esi
	movl	$16, %edx
	callq	_clamp_val
                                        ## kill: def $eax killed $eax def $rax
	shll	$4, %eax
	leal	-16(%rax), %r14d
	movq	-96(%rbp), %rdi
	movl	$1, %esi
	movl	$16, %edx
	callq	_clamp_val
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %edx
	orl	%r14d, %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_pci_write_config_byte
	leal	72(%r12), %r14d
	movq	-104(%rbp), %rdi
	movl	$1, %esi
	movl	$16, %edx
	callq	_clamp_val
                                        ## kill: def $eax killed $eax def $rax
	shll	$4, %eax
	leal	-16(%rax), %ebx
	movq	-112(%rbp), %rdi
	movl	$1, %esi
	movl	$16, %edx
	callq	_clamp_val
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %edx
	orl	%ebx, %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_pci_write_config_byte
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	cmpl	$66, %r14d
	je	LBB0_13
## %bb.9:
	cmpl	$100, %r14d
	je	LBB0_11
## %bb.10:
	cmpl	$133, %r14d
	jne	LBB0_17
LBB0_11:
	movq	-120(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_12
## %bb.16:
	movl	$2, %esi
	movl	$9, %edx
	jmp	LBB0_19
LBB0_13:
	movq	-120(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_24
## %bb.14:
	movl	$2, %esi
	movl	$9, %edx
	callq	_clamp_val
	movl	%eax, %ebx
	addl	$-2, %ebx
	orl	$232, %ebx
	testl	%r14d, %r14d
	jne	LBB0_21
	jmp	LBB0_23
LBB0_17:
	movq	-120(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_25
## %bb.18:
	movl	$2, %esi
	movl	$5, %edx
LBB0_19:
	callq	_clamp_val
	movl	%eax, %ebx
	addl	$-2, %ebx
	orl	$224, %ebx
	testl	%r14d, %r14d
	jne	LBB0_21
	jmp	LBB0_23
LBB0_12:
	movl	$7, %ebx
	testl	%r14d, %r14d
	jne	LBB0_21
	jmp	LBB0_23
LBB0_24:
	movl	$15, %ebx
	testl	%r14d, %r14d
	jne	LBB0_21
	jmp	LBB0_23
LBB0_25:
	movl	$3, %ebx
	testl	%r14d, %r14d
	je	LBB0_23
LBB0_21:
	cmpq	$0, -120(%rbp)
	je	LBB0_23
## %bb.22:
	addl	$80, %r12d
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_read_config_byte
	movl	-44(%rbp), %edx
	andl	$16, %edx
	movl	%edx, -44(%rbp)
	orl	%ebx, %edx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_write_config_byte
LBB0_23:
	addq	$136, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_TIMING_8BIT,4,2            ## @ATA_TIMING_8BIT
	.no_dead_strip	_via_do_set_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function via_do_set_mode
_via_do_set_mode:                       ; @via_do_set_mode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #208
	.cfi_def_cfa_offset 208
	stp	x28, x27, [sp, #112]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #128]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #144]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #160]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #176]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #192]            ; 16-byte Folded Spill
	add	x29, sp, #192
	.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	x20, x5
	mov	x22, x4
	mov	x24, x3
	mov	x25, x2
	mov	x26, x1
	mov	x21, x0
	ldr	x8, [x0, #8]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	mov	x0, x26
	bl	_ata_dev_pair
	mov	x23, x0
	sxtw	x8, w24
	mov	w9, #30000
	ldr	w10, [x21]
	ldr	w11, [x26]
	add	w27, w11, w10, lsl #1
	mov	w28, #3
	udiv	x24, x9, x8
	add	x2, sp, #64
	mov	x0, x26
	mov	x1, x25
	mov	w3, #30000
	mov	x4, x24
	bl	_ata_timing_compute
	cbz	x23, LBB0_3
; %bb.1:
	ldr	w1, [x23, #4]
	cbz	w1, LBB0_3
; %bb.2:
	add	x2, sp, #16
	mov	x0, x23
	mov	w3, #30000
	mov	x4, x24
	bl	_ata_timing_compute
Lloh0:
	adrp	x8, _ATA_TIMING_8BIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_TIMING_8BIT@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	add	x0, sp, #16
	add	x1, sp, #64
	add	x2, sp, #64
	bl	_ata_timing_merge
LBB0_3:
	sub	w23, w28, w27
	cbz	w22, LBB0_5
; %bb.4:
	lsl	w22, w23, #1
	add	x2, sp, #12
	mov	x0, x19
	mov	w1, #76
	bl	_pci_read_config_byte
	mov	w8, #3
	lsl	w8, w8, w22
	ldr	w9, [sp, #12]
	bic	w8, w9, w8
	str	w8, [sp, #12]
	ldr	x0, [sp, #104]
	mov	w1, #1
	mov	w2, #4
	bl	_clamp_val
	lsl	w8, w0, w22
	ldr	w9, [sp, #12]
	orr	w2, w9, w8
	str	w2, [sp, #12]
	mov	x0, x19
	mov	w1, #76
	bl	_pci_write_config_byte
LBB0_5:
	ldr	w8, [x21]
	mov	w9, #79
	sub	w21, w9, w8
	ldr	x0, [sp, #96]
	mov	w1, #1
	mov	w2, #16
	bl	_clamp_val
	lsl	w8, w0, #4
	sub	w22, w8, #16
	ldr	x0, [sp, #88]
	mov	w1, #1
	mov	w2, #16
	bl	_clamp_val
	sub	w8, w0, #1
	orr	w2, w8, w22
	mov	x0, x19
	mov	x1, x21
	bl	_pci_write_config_byte
	add	w21, w23, #72
	ldr	x0, [sp, #80]
	mov	w1, #1
	mov	w2, #16
	bl	_clamp_val
	lsl	w8, w0, #4
	sub	w22, w8, #16
	ldr	x0, [sp, #72]
	mov	w1, #1
	mov	w2, #16
	bl	_clamp_val
	sub	w8, w0, #1
	orr	w2, w8, w22
	mov	x0, x19
	mov	x1, x21
	bl	_pci_write_config_byte
	cmp	w20, #66
	b.eq	LBB0_10
; %bb.6:
	cmp	w20, #100
	b.eq	LBB0_8
; %bb.7:
	cmp	w20, #133
	b.ne	LBB0_12
LBB0_8:
	ldr	x0, [sp, #64]
	cbz	x0, LBB0_15
; %bb.9:
	mov	w1, #2
	mov	w2, #9
	b	LBB0_14
LBB0_10:
	ldr	x0, [sp, #64]
	cbz	x0, LBB0_16
; %bb.11:
	mov	w1, #2
	mov	w2, #9
	bl	_clamp_val
	sub	w8, w0, #2
	mov	w9, #232
	orr	w21, w8, w9
	cbnz	w20, LBB0_18
	b	LBB0_20
LBB0_12:
	ldr	x0, [sp, #64]
	cbz	x0, LBB0_17
; %bb.13:
	mov	w1, #2
	mov	w2, #5
LBB0_14:
	bl	_clamp_val
	sub	w8, w0, #2
	orr	w21, w8, #0xe0
	cbnz	w20, LBB0_18
	b	LBB0_20
LBB0_15:
	mov	w21, #7
	cbnz	w20, LBB0_18
	b	LBB0_20
LBB0_16:
	mov	w21, #15
	cbnz	w20, LBB0_18
	b	LBB0_20
LBB0_17:
	mov	w21, #3
	cbz	w20, LBB0_20
LBB0_18:
	ldr	x8, [sp, #64]
	cbz	x8, LBB0_20
; %bb.19:
	add	w20, w23, #80
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x20
	bl	_pci_read_config_byte
	ldr	w8, [sp, #12]
	and	w8, w8, #0x10
	str	w8, [sp, #12]
	orr	w2, w8, w21
	mov	x0, x19
	mov	x1, x20
	bl	_pci_write_config_byte
LBB0_20:
	ldp	x29, x30, [sp, #192]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #176]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #160]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #144]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #128]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #208
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_TIMING_8BIT,4,2            ; @ATA_TIMING_8BIT
	.no_dead_strip	_via_do_set_mode
.subsections_via_symbols
