	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mgslpc_set_rate
_mgslpc_set_rate:                       ## @mgslpc_set_rate
	.cfi_startproc
## %bb.0:
	testl	%edx, %edx
	je	LBB0_6
## %bb.1:
	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
	movl	%edx, %ecx
	movl	%esi, %r15d
	movq	%rdi, %r14
	xorl	%esi, %esi
	movl	$3686400, %eax                  ## imm = 0x384000
	xorl	%edx, %edx
	divl	%ecx
	shrl	%eax
	cmpl	$3686401, %ecx                  ## imm = 0x384001
	cmovbl	%eax, %esi
	movl	$1, %ebx
	cmpl	$65, %esi
	jb	LBB0_5
## %bb.2:
	movl	$1, %ecx
	movl	%eax, %esi
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%esi, %eax
	shrl	%esi
	leal	1(%rcx), %ebx
	cmpl	$130, %eax
	jb	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$15, %ecx
	movl	%ebx, %ecx
	jb	LBB0_3
LBB0_5:
	movq	_BGR@GOTPCREL(%rip), %rax
	movb	(%rax), %al
	addb	%r15b, %al
	movl	%ebx, %ecx
	shll	$6, %ecx
	addl	%esi, %ecx
	decl	%ecx
	movzbl	%cl, %edx
	movzbl	%al, %esi
	movq	%r14, %rdi
	callq	_write_reg
	movq	_CCR2@GOTPCREL(%rip), %r12
	movb	(%r12), %al
	addb	%r15b, %al
	movzbl	%al, %esi
	movq	%r14, %rdi
	callq	_read_reg
	andl	$63, %eax
	andl	$12, %ebx
	shll	$4, %ebx
	orl	%eax, %ebx
	addb	(%r12), %r15b
	movzbl	%r15b, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_write_reg                      ## TAILCALL
LBB0_6:
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BGR,8,3                        ## @BGR
	.comm	_CCR2,8,3                       ## @CCR2
	.no_dead_strip	_mgslpc_set_rate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mgslpc_set_rate
_mgslpc_set_rate:                       ; @mgslpc_set_rate
	.cfi_startproc
; %bb.0:
	cbz	w2, LBB0_5
; %bb.1:
	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
	.cfi_remember_state
	mov	x20, x1
	mov	x19, x0
	mov	w8, #16384
	movk	w8, #56, lsl #16
	udiv	w8, w8, w2
	lsr	w10, w8, #1
	cmp	w2, #900, lsl #12               ; =3686400
	csel	w8, wzr, w10, hi
	cmp	w8, #65
	b.lo	LBB0_6
; %bb.2:
	mov	w9, #1
	mov	x8, x10
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x10, x8
	lsr	w8, w8, #1
	add	w21, w9, #1
	cmp	w10, #130
	b.lo	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w9, #15
	mov	x9, x21
	b.lo	LBB0_3
	b	LBB0_7
LBB0_5:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	.cfi_same_value w21
	.cfi_same_value w22
	ret
LBB0_6:
	.cfi_restore_state
	mov	w21, #1
LBB0_7:
Lloh0:
	adrp	x9, _BGR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BGR@GOTPAGEOFF]
	add	w8, w8, w21, lsl #6
	ldrb	w9, [x9]
	add	w9, w9, w20
	sub	w8, w8, #1
	and	w1, w9, #0xff
	and	w2, w8, #0xff
	mov	x0, x19
	bl	_write_reg
Lloh2:
	adrp	x22, _CCR2@GOTPAGE
Lloh3:
	ldr	x22, [x22, _CCR2@GOTPAGEOFF]
	ldrb	w8, [x22]
	add	w8, w8, w20
	and	w1, w8, #0xff
	mov	x0, x19
	bl	_read_reg
	lsl	w8, w21, #4
	and	w2, w8, #0xc0
	bfxil	w2, w0, #0, #6
	ldrb	w8, [x22]
	add	w8, w8, w20
	and	w1, w8, #0xff
	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
	b	_write_reg
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_BGR,8,3                        ; @BGR
	.comm	_CCR2,8,3                       ; @CCR2
	.no_dead_strip	_mgslpc_set_rate
.subsections_via_symbols
