	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdla_cpuspeed
_sdla_cpuspeed:                         ## @sdla_cpuspeed
	.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
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_sdla_start
	movq	_HZ@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	leal	(%rax,%rax,2), %edx
	movq	_Z80_READY@GOTPCREL(%rip), %rax
	movsbl	(%rax), %ecx
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%r8d, %r8d
	callq	_sdla_z80_poll
	testl	%eax, %eax
	js	LBB0_4
## %bb.1:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	_LOADER_READY@GOTPCREL(%rip), %rax
	movb	(%rax), %al
	movb	%al, -41(%rbp)
	xorl	%r15d, %r15d
	leaq	-41(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$1, %ecx
	callq	_sdla_write
	movl	(%r12), %edx
	shll	$3, %edx
	movq	_Z80_SCC_OK@GOTPCREL(%rip), %r13
	movsbl	(%r13), %ecx
	movq	_Z80_SCC_BAD@GOTPCREL(%rip), %r14
	movsbl	(%r14), %r8d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_sdla_z80_poll
	testl	%eax, %eax
	js	LBB0_4
## %bb.2:
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_sdla_stop
	xorl	%r15d, %r15d
	leaq	-41(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$1, %ecx
	callq	_sdla_read
	movb	-41(%rbp), %al
	cmpb	(%r14), %al
	jne	LBB0_7
## %bb.3:
	movl	(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	callq	_printk
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_5:
	subl	(%rax), %r15d
LBB0_6:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	cmpb	(%r13), %al
	jne	LBB0_10
## %bb.8:
	cmpl	$164, %r12d
	ja	LBB0_11
## %bb.9:
	movq	_SDLA_CPU_16M@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_10:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_5
LBB0_11:
	cmpl	$219, %r12d
	ja	LBB0_13
## %bb.12:
	movq	_SDLA_CPU_10M@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_13:
	cmpl	$257, %r12d                     ## imm = 0x101
	ja	LBB0_15
## %bb.14:
	movq	_SDLA_CPU_8M@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_15:
	cmpl	$356, %r12d                     ## imm = 0x164
	ja	LBB0_19
## %bb.16:
	movq	_SDLA_CPU_7M@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
LBB0_18:
	movl	%eax, (%rcx)
	xorl	%r15d, %r15d
	jmp	LBB0_6
LBB0_19:
	cmpl	$466, %r12d                     ## imm = 0x1D2
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	ja	LBB0_21
## %bb.20:
	movq	_SDLA_CPU_5M@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_21:
	movq	_SDLA_CPU_3M@GOTPCREL(%rip), %rax
LBB0_22:
	movl	(%rax), %eax
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_HZ,4,2                         ## @HZ
	.comm	_Z80_READY,1,0                  ## @Z80_READY
	.comm	_EIO,4,2                        ## @EIO
	.comm	_LOADER_READY,1,0               ## @LOADER_READY
	.comm	_Z80_SCC_OK,1,0                 ## @Z80_SCC_OK
	.comm	_Z80_SCC_BAD,1,0                ## @Z80_SCC_BAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: SCC bad\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SDLA_CPU_16M,4,2               ## @SDLA_CPU_16M
	.comm	_SDLA_CPU_10M,4,2               ## @SDLA_CPU_10M
	.comm	_SDLA_CPU_8M,4,2                ## @SDLA_CPU_8M
	.comm	_SDLA_CPU_7M,4,2                ## @SDLA_CPU_7M
	.comm	_SDLA_CPU_5M,4,2                ## @SDLA_CPU_5M
	.comm	_SDLA_CPU_3M,4,2                ## @SDLA_CPU_3M
	.no_dead_strip	_sdla_cpuspeed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdla_cpuspeed
_sdla_cpuspeed:                         ; @sdla_cpuspeed
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
	bl	_sdla_start
Lloh0:
	adrp	x21, _HZ@GOTPAGE
Lloh1:
	ldr	x21, [x21, _HZ@GOTPAGEOFF]
	ldr	w8, [x21]
	add	w2, w8, w8, lsl #1
Lloh2:
	adrp	x8, _Z80_READY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _Z80_READY@GOTPAGEOFF]
Lloh4:
	ldrsb	w3, [x8]
	mov	x0, x20
	mov	w1, #0
	mov	w4, #0
	bl	_sdla_z80_poll
	tbnz	w0, #31, LBB0_4
; %bb.1:
Lloh5:
	adrp	x8, _LOADER_READY@GOTPAGE
Lloh6:
	ldr	x8, [x8, _LOADER_READY@GOTPAGEOFF]
	ldrb	w8, [x8]
	strb	w8, [sp, #15]
	add	x2, sp, #15
	mov	x0, x20
	mov	w1, #0
	mov	w3, #1
	bl	_sdla_write
	ldr	w8, [x21]
	lsl	w2, w8, #3
Lloh7:
	adrp	x22, _Z80_SCC_OK@GOTPAGE
Lloh8:
	ldr	x22, [x22, _Z80_SCC_OK@GOTPAGEOFF]
	ldrsb	w3, [x22]
Lloh9:
	adrp	x23, _Z80_SCC_BAD@GOTPAGE
Lloh10:
	ldr	x23, [x23, _Z80_SCC_BAD@GOTPAGEOFF]
	ldrsb	w4, [x23]
	mov	x0, x20
	mov	w1, #0
	bl	_sdla_z80_poll
	tbnz	w0, #31, LBB0_4
; %bb.2:
	mov	x21, x0
	mov	x0, x20
	bl	_sdla_stop
	add	x2, sp, #15
	mov	x0, x20
	mov	w1, #0
	mov	w3, #1
	bl	_sdla_read
	ldrb	w8, [sp, #15]
	ldrb	w9, [x23]
	cmp	w8, w9
	b.ne	LBB0_7
; %bb.3:
	ldr	w1, [x20]
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printk
LBB0_4:
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_7:
	ldrb	w9, [x22]
	cmp	w8, w9
	b.ne	LBB0_10
; %bb.8:
	cmp	w21, #164
	b.hi	LBB0_11
; %bb.9:
	mov	w0, #0
Lloh15:
	adrp	x8, _SDLA_CPU_16M@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SDLA_CPU_16M@GOTPAGEOFF]
	b	LBB0_20
LBB0_10:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_5
LBB0_11:
	cmp	w21, #219
	b.hi	LBB0_13
; %bb.12:
	mov	w0, #0
Lloh19:
	adrp	x8, _SDLA_CPU_10M@GOTPAGE
Lloh20:
	ldr	x8, [x8, _SDLA_CPU_10M@GOTPAGEOFF]
	b	LBB0_20
LBB0_13:
	cmp	w21, #257
	b.hi	LBB0_15
; %bb.14:
	mov	w0, #0
Lloh21:
	adrp	x8, _SDLA_CPU_8M@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SDLA_CPU_8M@GOTPAGEOFF]
	b	LBB0_20
LBB0_15:
	cmp	w21, #356
	b.hi	LBB0_17
; %bb.16:
	mov	w0, #0
Lloh23:
	adrp	x8, _SDLA_CPU_7M@GOTPAGE
Lloh24:
	ldr	x8, [x8, _SDLA_CPU_7M@GOTPAGEOFF]
	b	LBB0_20
LBB0_17:
	cmp	w21, #466
	b.hi	LBB0_19
; %bb.18:
	mov	w0, #0
Lloh25:
	adrp	x8, _SDLA_CPU_5M@GOTPAGE
Lloh26:
	ldr	x8, [x8, _SDLA_CPU_5M@GOTPAGEOFF]
	b	LBB0_20
LBB0_19:
	mov	w0, #0
Lloh27:
	adrp	x8, _SDLA_CPU_3M@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SDLA_CPU_3M@GOTPAGEOFF]
LBB0_20:
	ldr	w8, [x8]
	str	w8, [x19]
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_HZ,4,2                         ; @HZ
	.comm	_Z80_READY,1,0                  ; @Z80_READY
	.comm	_EIO,4,2                        ; @EIO
	.comm	_LOADER_READY,1,0               ; @LOADER_READY
	.comm	_Z80_SCC_OK,1,0                 ; @Z80_SCC_OK
	.comm	_Z80_SCC_BAD,1,0                ; @Z80_SCC_BAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: SCC bad\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SDLA_CPU_16M,4,2               ; @SDLA_CPU_16M
	.comm	_SDLA_CPU_10M,4,2               ; @SDLA_CPU_10M
	.comm	_SDLA_CPU_8M,4,2                ; @SDLA_CPU_8M
	.comm	_SDLA_CPU_7M,4,2                ; @SDLA_CPU_7M
	.comm	_SDLA_CPU_5M,4,2                ; @SDLA_CPU_5M
	.comm	_SDLA_CPU_3M,4,2                ; @SDLA_CPU_3M
	.no_dead_strip	_sdla_cpuspeed
.subsections_via_symbols
