	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sh_cmt_enable
_sh_cmt_enable:                         ## @sh_cmt_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	8(%rdi), %rax
	movq	(%rax), %r12
	movl	4(%rdi), %edi
	callq	_clk_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	(%r12), %esi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_3
LBB0_2:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_sh_cmt_start_stop_ch
	movl	(%rbx), %r12d
	movl	4(%rbx), %edi
	callq	_clk_get_rate
	cmpl	$16, %r12d
	movl	$512, %ecx                      ## imm = 0x200
	movl	$8, %esi
	cmovel	%ecx, %esi
	movl	$67, %edx
	movl	$420, %ecx                      ## imm = 0x1A4
	cmovel	%edx, %ecx
	cltd
	idivl	%esi
	cltq
	movq	%rax, (%r15)
	movq	_CMCSR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	%ecx, %edx
	callq	_sh_cmt_write
	movq	_CMCOR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$-1, %edx
	callq	_sh_cmt_write
	movq	_CMCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_sh_cmt_write
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_sh_cmt_start_stop_ch
LBB0_3:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sh_cmt: cannot enable clock \"%s\"\n"

	.comm	_CMCSR,4,2                      ## @CMCSR
	.comm	_CMCOR,4,2                      ## @CMCOR
	.comm	_CMCNT,4,2                      ## @CMCNT
	.no_dead_strip	_sh_cmt_enable
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sh_cmt_enable
_sh_cmt_enable:                         ; @sh_cmt_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	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	x22, [x8]
	ldr	w0, [x0, #4]
	bl	_clk_enable
	mov	x19, x0
	cbz	w0, LBB0_2
; %bb.1:
	ldr	w1, [x22]
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_cmt_start_stop_ch
	ldp	w22, w0, [x20]
	bl	_clk_get_rate
	mov	w8, #8
	mov	w9, #512
	cmp	w22, #16
	csel	w8, w9, w8, eq
	mov	w9, #420
	mov	w10, #67
	csel	w2, w10, w9, eq
	sdiv	w8, w0, w8
	sxtw	x8, w8
	str	x8, [x21]
Lloh2:
	adrp	x8, _CMCSR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CMCSR@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_sh_cmt_write
Lloh5:
	adrp	x8, _CMCOR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CMCOR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #-1
	bl	_sh_cmt_write
Lloh8:
	adrp	x8, _CMCNT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CMCNT@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_sh_cmt_write
	mov	x0, x20
	mov	w1, #1
	bl	_sh_cmt_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	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_cmt: cannot enable clock \"%s\"\n"

	.comm	_CMCSR,4,2                      ; @CMCSR
	.comm	_CMCOR,4,2                      ; @CMCOR
	.comm	_CMCNT,4,2                      ; @CMCNT
	.no_dead_strip	_sh_cmt_enable
.subsections_via_symbols
