	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ym2612_sync_timers             ## -- Begin function ym2612_sync_timers
	.p2align	4, 0x90
_ym2612_sync_timers:                    ## @ym2612_sync_timers
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movl	%esi, %r13d
	movl	%edi, %r14d
	movl	%edi, %ebx
	shll	$8, %ebx
	movq	_timer_a_next_oflow@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	testb	$4, %r13b
	je	LBB0_3
## %bb.1:
	cmpl	%edx, %ebx
	jle	LBB0_3
## %bb.2:
	movq	_ym2612@GOTPCREL(%rip), %rsi
	orb	$1, (%rsi)
LBB0_3:
	movq	_timer_b_next_oflow@GOTPCREL(%rip), %rsi
	testb	$8, %r13b
	je	LBB0_6
## %bb.4:
	cmpl	(%rsi), %ebx
	jle	LBB0_6
## %bb.5:
	movq	_ym2612@GOTPCREL(%rip), %rdi
	orb	$2, (%rdi)
LBB0_6:
	testb	$1, %r13b
	jne	LBB0_7
## %bb.13:
	movl	%r12d, %r15d
	xorl	%r13d, %r15d
	testb	$1, %r15b
	je	LBB0_16
## %bb.14:
	movq	_timer_a_step@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	addl	%ebx, %edx
	jmp	LBB0_15
LBB0_7:
	cmpl	%edx, %ebx
	jle	LBB0_11
## %bb.8:
	movq	_timer_a_step@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	addl	%edi, %edx
	cmpl	%edx, %ebx
	jg	LBB0_9
## %bb.10:
	movl	%edx, (%rax)
LBB0_11:
	movl	%r12d, %r15d
	xorl	%r13d, %r15d
	testb	$1, %r15b
	je	LBB0_16
## %bb.12:
	movq	_TIMER_NO_OFLOW@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
LBB0_15:
	movl	%edx, (%rax)
LBB0_16:
	testb	$1, %r12b
	je	LBB0_18
## %bb.17:
	movq	_EL_YMTIMER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	sarl	$8, %edx
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %ecx
	callq	_elprintf
	movq	_timer_b_next_oflow@GOTPCREL(%rip), %rsi
LBB0_18:
	testb	$2, %r13b
	jne	LBB0_19
## %bb.25:
	testb	$2, %r15b
	je	LBB0_28
## %bb.26:
	movq	_timer_b_step@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	jmp	LBB0_27
LBB0_19:
	movl	(%rsi), %eax
	cmpl	%eax, %ebx
	jle	LBB0_23
## %bb.20:
	movq	_timer_b_step@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	addl	%edx, %eax
	cmpl	%eax, %ebx
	jg	LBB0_21
## %bb.22:
	movl	%eax, (%rsi)
LBB0_23:
	testb	$2, %r15b
	je	LBB0_28
## %bb.24:
	movq	_TIMER_NO_OFLOW@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_27:
	movl	%ebx, (%rsi)
LBB0_28:
	testb	$2, %r12b
	jne	LBB0_30
## %bb.29:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	movq	_EL_YMTIMER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%rsi), %edx
	sarl	$8, %edx
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %ecx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_elprintf                       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_timer_a_next_oflow,4,2         ## @timer_a_next_oflow
	.comm	_ym2612,4,2                     ## @ym2612
	.comm	_timer_b_next_oflow,4,2         ## @timer_b_next_oflow
	.comm	_timer_a_step,4,2               ## @timer_a_step
	.comm	_TIMER_NO_OFLOW,4,2             ## @TIMER_NO_OFLOW
	.comm	_EL_YMTIMER,4,2                 ## @EL_YMTIMER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"timer a upd to %i @ %i"

	.comm	_timer_b_step,4,2               ## @timer_b_step
L_.str.1:                               ## @.str.1
	.asciz	"timer b upd to %i @ %i"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ym2612_sync_timers             ; -- Begin function ym2612_sync_timers
	.p2align	2
_ym2612_sync_timers:                    ; @ym2612_sync_timers
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	lsl	w23, w0, #8
Lloh0:
	adrp	x9, _timer_a_next_oflow@GOTPAGE
Lloh1:
	ldr	x9, [x9, _timer_a_next_oflow@GOTPAGEOFF]
	ldr	w8, [x9]
	tbz	w1, #2, LBB0_3
; %bb.1:
	cmp	w23, w8
	b.le	LBB0_3
; %bb.2:
Lloh2:
	adrp	x10, _ym2612@GOTPAGE
Lloh3:
	ldr	x10, [x10, _ym2612@GOTPAGEOFF]
	ldr	w11, [x10]
	orr	w11, w11, #0x1
	str	w11, [x10]
LBB0_3:
Lloh4:
	adrp	x22, _timer_b_next_oflow@GOTPAGE
Lloh5:
	ldr	x22, [x22, _timer_b_next_oflow@GOTPAGEOFF]
	tbz	w21, #3, LBB0_6
; %bb.4:
	ldr	w10, [x22]
	cmp	w23, w10
	b.le	LBB0_6
; %bb.5:
Lloh6:
	adrp	x10, _ym2612@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ym2612@GOTPAGEOFF]
	ldr	w11, [x10]
	orr	w11, w11, #0x2
	str	w11, [x10]
LBB0_6:
	tbnz	w21, #0, LBB0_9
; %bb.7:
	eor	w24, w20, w21
	tbz	w24, #0, LBB0_19
; %bb.8:
Lloh8:
	adrp	x8, _timer_a_step@GOTPAGE
Lloh9:
	ldr	x8, [x8, _timer_a_step@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	add	w8, w8, w23
	b	LBB0_18
LBB0_9:
	cmp	w23, w8
	b.le	LBB0_16
; %bb.10:
Lloh11:
	adrp	x10, _timer_a_step@GOTPAGE
Lloh12:
	ldr	x10, [x10, _timer_a_step@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	add	w11, w10, w8
	cmp	w23, w11
	csel	w12, w23, w11, gt
	cmp	w11, w23
	cinc	w13, w11, lt
	sub	w12, w12, w13
	cmp	w11, w23
	udiv	w11, w12, w10
	cinc	w11, w11, lt
	add	w11, w11, #1
	cmp	w11, #4
	b.lo	LBB0_14
; %bb.11:
	mov	w13, #0
	and	w12, w11, #0xfffffffc
	madd	w8, w12, w10, w8
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	add	w13, w13, #4
	cmp	w13, w12
	b.ne	LBB0_12
; %bb.13:
	cmp	w11, w12
	b.eq	LBB0_15
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w8, w10
	cmp	w23, w8
	b.gt	LBB0_14
LBB0_15:
	str	w8, [x9]
LBB0_16:
	eor	w24, w20, w21
	tbz	w24, #0, LBB0_19
; %bb.17:
Lloh14:
	adrp	x8, _TIMER_NO_OFLOW@GOTPAGE
Lloh15:
	ldr	x8, [x8, _TIMER_NO_OFLOW@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
LBB0_18:
	str	w8, [x9]
LBB0_19:
Lloh17:
	adrp	x25, _EL_YMTIMER@GOTPAGE
Lloh18:
	ldr	x25, [x25, _EL_YMTIMER@GOTPAGEOFF]
	tbz	w20, #0, LBB0_21
; %bb.20:
	ldr	w0, [x25]
	asr	w2, w8, #8
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x19
	bl	_elprintf
LBB0_21:
	tbnz	w21, #1, LBB0_24
; %bb.22:
	tbz	w24, #1, LBB0_34
; %bb.23:
Lloh21:
	adrp	x8, _timer_b_step@GOTPAGE
Lloh22:
	ldr	x8, [x8, _timer_b_step@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	add	w8, w8, w23
	b	LBB0_33
LBB0_24:
	ldr	w8, [x22]
	cmp	w23, w8
	b.le	LBB0_31
; %bb.25:
Lloh24:
	adrp	x9, _timer_b_step@GOTPAGE
Lloh25:
	ldr	x9, [x9, _timer_b_step@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	add	w10, w9, w8
	cmp	w23, w10
	csel	w11, w23, w10, gt
	cmp	w10, w23
	cinc	w12, w10, lt
	sub	w11, w11, w12
	cmp	w10, w23
	udiv	w10, w11, w9
	cinc	w10, w10, lt
	add	w10, w10, #1
	cmp	w10, #4
	b.lo	LBB0_29
; %bb.26:
	mov	w12, #0
	and	w11, w10, #0xfffffffc
	madd	w8, w11, w9, w8
LBB0_27:                                ; =>This Inner Loop Header: Depth=1
	add	w12, w12, #4
	cmp	w12, w11
	b.ne	LBB0_27
; %bb.28:
	cmp	w10, w11
	b.eq	LBB0_30
LBB0_29:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w8, w9
	cmp	w23, w8
	b.gt	LBB0_29
LBB0_30:
	str	w8, [x22]
LBB0_31:
	tbz	w24, #1, LBB0_34
; %bb.32:
Lloh27:
	adrp	x8, _TIMER_NO_OFLOW@GOTPAGE
Lloh28:
	ldr	x8, [x8, _TIMER_NO_OFLOW@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
LBB0_33:
	str	w8, [x22]
LBB0_34:
	tbnz	w20, #1, LBB0_36
; %bb.35:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_36:
	ldr	w0, [x25]
	ldr	w8, [x22]
	asr	w2, w8, #8
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x3, x19
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_elprintf
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_timer_a_next_oflow,4,2         ; @timer_a_next_oflow
	.comm	_ym2612,4,2                     ; @ym2612
	.comm	_timer_b_next_oflow,4,2         ; @timer_b_next_oflow
	.comm	_timer_a_step,4,2               ; @timer_a_step
	.comm	_TIMER_NO_OFLOW,4,2             ; @TIMER_NO_OFLOW
	.comm	_EL_YMTIMER,4,2                 ; @EL_YMTIMER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"timer a upd to %i @ %i"

	.comm	_timer_b_step,4,2               ; @timer_b_step
l_.str.1:                               ; @.str.1
	.asciz	"timer b upd to %i @ %i"

.subsections_via_symbols
