	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qm1d1b0004_set_params
_qm1d1b0004_set_params:                 ## @qm1d1b0004_set_params
	.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
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	8(%rdi), %r12
	movl	(%rdi), %r14d
	movq	_QM1D1B0004_XTL_FREQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	cmpl	$0, 4(%r12)
	setne	%cl
	leal	4(,%rcx,4), %ecx
	cltd
	idivl	%ecx
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, %ebx
	movl	%r14d, %edi
	callq	_lookup_cb
	movl	%eax, %r14d
	movq	_QM1D1B0004_PSC_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%ebx, %ecx
	andl	$-16, %ecx
	movl	%ebx, %edx
	andl	$15, %edx
	testl	%eax, %eax
	leal	(%rdx,%rcx,2), %eax
	cmovel	%ebx, %eax
	movl	%eax, %ecx
	sarl	$8, %ecx
	orl	$64, %ecx
	movl	%ecx, -64(%rbp)
	movl	%eax, -60(%rbp)
	movl	$224, %eax
	orl	4(%r12), %eax
	movl	%eax, -56(%rbp)
	movl	%r14d, -52(%rbp)
	movl	(%r12), %edi
	leaq	-64(%rbp), %rsi
	movl	$4, %edx
	callq	_i2c_master_send
	testl	%eax, %eax
	js	LBB0_8
## %bb.1:
	movl	$228, %eax
	orl	4(%r12), %eax
	movl	%eax, -64(%rbp)
	movl	(%r12), %edi
	leaq	-64(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_master_send
	testl	%eax, %eax
	js	LBB0_8
## %bb.2:
	movl	$20, %edi
	callq	_msleep
	movl	8(%r12), %edi
	movq	_QM1D1B0004_CFG_LPF_DFLT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edi
	jne	LBB0_4
## %bb.3:
	movslq	4(%r15), %rax
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$38, %rdi
	addl	%eax, %edi
LBB0_4:
	testl	%edi, %edi
	jne	LBB0_6
## %bb.5:
	movq	_QM1D1B0004_LPF_FALLBACK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
LBB0_6:
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$2000, %esi                     ## imm = 0x7D0
	callq	_DIV_ROUND_UP
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rax,%rax), %ecx
	addl	$-4, %ecx
	andl	$24, %ecx
	orl	4(%r12), %ecx
	orl	$228, %ecx
	movl	%ecx, -64(%rbp)
	leal	-8(,%rax,4), %eax
	andl	$12, %eax
	orl	%r14d, %eax
	movl	%eax, -60(%rbp)
	movl	(%r12), %edi
	leaq	-64(%rbp), %rsi
	movl	$2, %edx
	callq	_i2c_master_send
	testl	%eax, %eax
	js	LBB0_8
## %bb.7:
	movl	$0, -64(%rbp)
	movl	(%r12), %edi
	leaq	-64(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_master_recv
	movl	%eax, %ecx
	sarl	$31, %eax
	andl	%ecx, %eax
LBB0_8:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-40(%rbp), %rcx
	jne	LBB0_10
## %bb.9:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_QM1D1B0004_XTL_FREQ,4,2        ## @QM1D1B0004_XTL_FREQ
	.comm	_QM1D1B0004_PSC_MASK,4,2        ## @QM1D1B0004_PSC_MASK
	.comm	_QM1D1B0004_CFG_LPF_DFLT,4,2    ## @QM1D1B0004_CFG_LPF_DFLT
	.comm	_QM1D1B0004_LPF_FALLBACK,4,2    ## @QM1D1B0004_LPF_FALLBACK
	.no_dead_strip	_qm1d1b0004_set_params
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qm1d1b0004_set_params
_qm1d1b0004_set_params:                 ; @qm1d1b0004_set_params
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	ldr	x22, [x0, #8]
	ldr	w19, [x0]
Lloh3:
	adrp	x8, _QM1D1B0004_XTL_FREQ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _QM1D1B0004_XTL_FREQ@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x22, #4]
	mov	w10, #8
	mov	w11, #4
	cmp	w9, #0
	csel	w9, w11, w10, eq
	sdiv	w1, w8, w9
	mov	x0, x19
	bl	_DIV_ROUND_CLOSEST
	mov	x21, x0
	lsr	w23, w0, #4
	mov	x0, x19
	bl	_lookup_cb
	mov	x19, x0
Lloh6:
	adrp	x8, _QM1D1B0004_PSC_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _QM1D1B0004_PSC_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w9, w21, #0xf
	bfi	w9, w23, #5, #27
	tst	w8, w0
	csel	w8, w21, w9, eq
	asr	w9, w8, #8
	orr	w9, w9, #0x40
	stp	w9, w8, [sp, #8]
	ldr	w8, [x22, #4]
	orr	w8, w8, #0xe0
	stp	w8, w0, [sp, #16]
	ldr	w0, [x22]
	add	x1, sp, #8
	mov	w2, #4
	bl	_i2c_master_send
	tbnz	w0, #31, LBB0_6
; %bb.1:
	ldr	w8, [x22, #4]
	mov	w9, #228
	orr	w8, w8, w9
	str	w8, [sp, #8]
	ldr	w0, [x22]
	add	x1, sp, #8
	mov	w2, #1
	bl	_i2c_master_send
	tbnz	w0, #31, LBB0_6
; %bb.2:
	mov	w0, #20
	bl	_msleep
	ldr	w8, [x22, #8]
Lloh9:
	adrp	x9, _QM1D1B0004_CFG_LPF_DFLT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _QM1D1B0004_CFG_LPF_DFLT@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_4
; %bb.3:
	ldrsw	x8, [x20, #4]
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
LBB0_4:
Lloh12:
	adrp	x9, _QM1D1B0004_LPF_FALLBACK@GOTPAGE
Lloh13:
	ldr	x9, [x9, _QM1D1B0004_LPF_FALLBACK@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	cmp	w8, #0
	csel	w0, w9, w8, eq
	mov	w1, #2000
	bl	_DIV_ROUND_UP
	sub	w8, w0, #2
	lsl	w9, w8, #1
	and	w9, w9, #0x18
	ldr	w10, [x22, #4]
	orr	w9, w10, w9
	mov	w10, #228
	orr	w9, w9, w10
	ubfiz	w8, w8, #2, #2
	orr	w8, w8, w19
	stp	w9, w8, [sp, #8]
	ldr	w0, [x22]
	add	x1, sp, #8
	mov	w2, #2
	bl	_i2c_master_send
	tbnz	w0, #31, LBB0_6
; %bb.5:
	str	wzr, [sp, #8]
	ldr	w0, [x22]
	add	x1, sp, #8
	mov	w2, #1
	bl	_i2c_master_recv
	cmp	w0, #0
	csel	w0, w0, wzr, lt
LBB0_6:
	ldr	x8, [sp, #24]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_QM1D1B0004_XTL_FREQ,4,2        ; @QM1D1B0004_XTL_FREQ
	.comm	_QM1D1B0004_PSC_MASK,4,2        ; @QM1D1B0004_PSC_MASK
	.comm	_QM1D1B0004_CFG_LPF_DFLT,4,2    ; @QM1D1B0004_CFG_LPF_DFLT
	.comm	_QM1D1B0004_LPF_FALLBACK,4,2    ; @QM1D1B0004_LPF_FALLBACK
	.no_dead_strip	_qm1d1b0004_set_params
.subsections_via_symbols
