	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sh_mtu2_enable
_sh_mtu2_enable:                        ## @sh_mtu2_enable
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movq	(%rax), %r15
	movl	8(%rdi), %edi
	callq	_clk_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	(%r15), %esi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_3
LBB0_2:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_sh_mtu2_start_stop_ch
	movl	8(%rbx), %edi
	callq	_clk_get_rate
                                        ## kill: def $eax killed $eax def $rax
	leal	63(%rax), %ecx
	testl	%eax, %eax
	cmovsl	%ecx, %eax
	sarl	$6, %eax
	movl	%eax, (%rbx)
	movq	_HZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %edx
	shrl	$31, %edx
	addl	%ecx, %edx
	sarl	%edx
	addl	%edx, %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%ecx
	movl	%eax, 4(%rbx)
	movq	_TCR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$35, %edx
	callq	_sh_mtu2_write
	movq	_TIOR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_sh_mtu2_write
	movq	_TGR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	4(%rbx), %edx
	movq	%rbx, %rdi
	callq	_sh_mtu2_write
	movq	_TCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_sh_mtu2_write
	movq	_TMDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_sh_mtu2_write
	movq	_TIER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_sh_mtu2_write
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_sh_mtu2_start_stop_ch
LBB0_3:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sh_mtu2: cannot enable clock \"%s\"\n"

	.comm	_HZ,4,2                         ## @HZ
	.comm	_TCR,4,2                        ## @TCR
	.comm	_TIOR,4,2                       ## @TIOR
	.comm	_TGR,4,2                        ## @TGR
	.comm	_TCNT,4,2                       ## @TCNT
	.comm	_TMDR,4,2                       ## @TMDR
	.comm	_TIER,4,2                       ## @TIER
	.no_dead_strip	_sh_mtu2_enable
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sh_mtu2_enable
_sh_mtu2_enable:                        ; @sh_mtu2_enable
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	x21, [x8]
	ldr	w0, [x0, #8]
	bl	_clk_enable
	mov	x19, x0
	cbz	w0, LBB0_2
; %bb.1:
	ldr	w1, [x21]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_3
LBB0_2:
	mov	x0, x20
	mov	w1, #0
	bl	_sh_mtu2_start_stop_ch
	ldr	w0, [x20, #8]
	bl	_clk_get_rate
	add	w8, w0, #63
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w8, w8, #6
	str	w8, [x20]
Lloh2:
	adrp	x9, _HZ@GOTPAGE
Lloh3:
	ldr	x9, [x9, _HZ@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	cmp	w9, #0
	cinc	w10, w9, lt
	add	w8, w8, w10, asr #1
	sdiv	w8, w8, w9
	str	w8, [x20, #4]
Lloh5:
	adrp	x8, _TCR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TCR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #35
	bl	_sh_mtu2_write
Lloh8:
	adrp	x8, _TIOR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _TIOR@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_sh_mtu2_write
Lloh11:
	adrp	x8, _TGR@GOTPAGE
Lloh12:
	ldr	x8, [x8, _TGR@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	ldr	w2, [x20, #4]
	mov	x0, x20
	bl	_sh_mtu2_write
Lloh14:
	adrp	x8, _TCNT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _TCNT@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_sh_mtu2_write
Lloh17:
	adrp	x8, _TMDR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _TMDR@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_sh_mtu2_write
Lloh20:
	adrp	x8, _TIER@GOTPAGE
Lloh21:
	ldr	x8, [x8, _TIER@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #1
	bl	_sh_mtu2_write
	mov	x0, x20
	mov	w1, #1
	bl	_sh_mtu2_start_stop_ch
LBB0_3:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sh_mtu2: cannot enable clock \"%s\"\n"

	.comm	_HZ,4,2                         ; @HZ
	.comm	_TCR,4,2                        ; @TCR
	.comm	_TIOR,4,2                       ; @TIOR
	.comm	_TGR,4,2                        ; @TGR
	.comm	_TCNT,4,2                       ; @TCNT
	.comm	_TMDR,4,2                       ; @TMDR
	.comm	_TIER,4,2                       ; @TIER
	.no_dead_strip	_sh_mtu2_enable
.subsections_via_symbols
