	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_smc_timing
_set_smc_timing:                        ## @set_smc_timing
	.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, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	movq	(%rdx), %rbx
	movq	8(%rdx), %r14
	movq	16(%rdx), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	24(%rdx), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	4(%rsi), %edi
	callq	_clk_get_rate
	movq	%rax, %r12
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_calc_mck_cycles
	movq	%rax, %r15
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_calc_mck_cycles
	movq	%rax, %r14
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_calc_mck_cycles
	movq	%rax, %rbx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_calc_mck_cycles
	movq	%r15, %rcx
	subq	%rbx, %rcx
	subq	%r14, %rcx
	cmpq	$2, %rcx
	leaq	2(%rbx,%r14), %r12
	cmovaeq	%r15, %r12
	leaq	-2(%r12), %r15
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movq	%r14, %rdx
	movq	%rbx, %rcx
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, %r8
	xorl	%eax, %eax
	callq	_dev_dbg
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	movq	%r14, %rdx
	movq	%rbx, %rcx
	movq	%r12, %r8
	xorl	%eax, %eax
	callq	_dev_dbg
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edx
	movq	%r13, %rdi
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edx
	movq	%r13, %rdi
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	(%r15), %edi
	callq	_AT91_SMC_SETUP
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%r14, %rdi
	callq	_AT91_SMC_NWESETUP_
	movl	%eax, %r13d
	movq	%r14, %rdi
	callq	_AT91_SMC_NRDSETUP_
	orl	%eax, %r13d
	movl	$1, %edi
	callq	_AT91_SMC_NCS_WRSETUP_
	movl	%eax, %ebx
	movl	$1, %edi
	callq	_AT91_SMC_NCS_RDSETUP_
	orl	%eax, %ebx
	orl	%r13d, %ebx
	movl	-60(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_at91_sys_write
	movq	%r15, %r13
	movl	(%r15), %edi
	callq	_AT91_SMC_PULSE
	movl	%eax, %r14d
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_AT91_SMC_NWEPULSE_
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_AT91_SMC_NRDPULSE_
	orl	%eax, %ebx
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_AT91_SMC_NCS_WRPULSE_
	orl	%eax, %ebx
	movq	%r15, %rdi
	callq	_AT91_SMC_NCS_RDPULSE_
	orl	%eax, %ebx
	movl	%r14d, %edi
	movl	%ebx, %esi
	callq	_at91_sys_write
	movl	(%r13), %edi
	callq	_AT91_SMC_CYCLE
	movl	%eax, %r14d
	movq	%r12, %rdi
	callq	_AT91_SMC_NWECYCLE_
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_AT91_SMC_NRDCYCLE_
	orl	%eax, %ebx
	movl	%r14d, %edi
	movl	%ebx, %esi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_at91_sys_write                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ATA timings: nrd_setup = %lu nrd_pulse = %lu nrd_cycle = %lu\n"

L_.str.1:                               ## @.str.1
	.asciz	"ATA timings: nwe_setup = %lu nwe_pulse = %lu nwe_cycle = %lu\n"

L_.str.2:                               ## @.str.2
	.asciz	"ATA timings: ncs_read_setup = %lu ncs_read_pulse = %lu\n"

L_.str.3:                               ## @.str.3
	.asciz	"ATA timings: ncs_write_setup = %lu ncs_write_pulse = %lu\n"

	.no_dead_strip	_set_smc_timing
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_smc_timing
_set_smc_timing:                        ; @set_smc_timing
	.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	x19, x1
	mov	x23, x0
	ldp	x20, x21, [x2]
	ldp	x22, x25, [x2, #16]
	ldr	w0, [x1, #4]
	bl	_clk_get_rate
	mov	x26, x0
	mov	x0, x20
	mov	x1, x26
	bl	_calc_mck_cycles
	mov	x20, x0
	mov	x0, x21
	mov	x1, x26
	bl	_calc_mck_cycles
	mov	x24, x0
	mov	x0, x22
	mov	x1, x26
	bl	_calc_mck_cycles
	mov	x22, x0
	mov	x0, x25
	mov	x1, x26
	bl	_calc_mck_cycles
	add	x8, x22, x24
	sub	x9, x20, x8
	add	x8, x8, #2
	cmp	x9, #2
	csel	x20, x8, x20, lo
	sub	x21, x20, #2
	str	x20, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x23
	mov	x2, x24
	mov	x3, x22
	bl	_dev_dbg
	str	x20, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x23
	mov	x2, x24
	mov	x3, x22
	bl	_dev_dbg
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x23
	mov	w2, #1
	mov	x3, x21
	bl	_dev_dbg
Lloh6:
	adrp	x1, l_.str.3@PAGE
Lloh7:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x23
	mov	w2, #1
	mov	x3, x21
	bl	_dev_dbg
	ldr	w0, [x19]
	bl	_AT91_SMC_SETUP
	mov	x23, x0
	mov	x0, x24
	bl	_AT91_SMC_NWESETUP_
	mov	x25, x0
	mov	x0, x24
	bl	_AT91_SMC_NRDSETUP_
	orr	w24, w0, w25
	mov	w0, #1
	bl	_AT91_SMC_NCS_WRSETUP_
	orr	w24, w24, w0
	mov	w0, #1
	bl	_AT91_SMC_NCS_RDSETUP_
	orr	w1, w24, w0
	mov	x0, x23
	bl	_at91_sys_write
	ldr	w0, [x19]
	bl	_AT91_SMC_PULSE
	mov	x23, x0
	mov	x0, x22
	bl	_AT91_SMC_NWEPULSE_
	mov	x24, x0
	mov	x0, x22
	bl	_AT91_SMC_NRDPULSE_
	orr	w22, w0, w24
	mov	x0, x21
	bl	_AT91_SMC_NCS_WRPULSE_
	orr	w22, w22, w0
	mov	x0, x21
	bl	_AT91_SMC_NCS_RDPULSE_
	orr	w1, w22, w0
	mov	x0, x23
	bl	_at91_sys_write
	ldr	w0, [x19]
	bl	_AT91_SMC_CYCLE
	mov	x19, x0
	mov	x0, x20
	bl	_AT91_SMC_NWECYCLE_
	mov	x21, x0
	mov	x0, x20
	bl	_AT91_SMC_NRDCYCLE_
	orr	w1, w0, w21
	mov	x0, x19
	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
	b	_at91_sys_write
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ATA timings: nrd_setup = %lu nrd_pulse = %lu nrd_cycle = %lu\n"

l_.str.1:                               ; @.str.1
	.asciz	"ATA timings: nwe_setup = %lu nwe_pulse = %lu nwe_cycle = %lu\n"

l_.str.2:                               ; @.str.2
	.asciz	"ATA timings: ncs_read_setup = %lu ncs_read_pulse = %lu\n"

l_.str.3:                               ; @.str.3
	.asciz	"ATA timings: ncs_write_setup = %lu ncs_write_pulse = %lu\n"

	.no_dead_strip	_set_smc_timing
.subsections_via_symbols
