	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dib8000_tune
_dib8000_tune:                          ## @dib8000_tune
	.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
	movq	(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_fft_to_mode
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.2:
	movl	%eax, %r15d
	movslq	16(%rbx), %rax
	imulq	$274877907, %rax, %rsi          ## imm = 0x10624DD3
	movq	%rsi, %rax
	shrq	$63, %rax
	sarq	$38, %rsi
	addl	%eax, %esi
	movq	%rbx, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_dib8000_set_bandwidth
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_dib8000_set_channel
	movq	%rbx, %rdi
	movl	$770, %esi                      ## imm = 0x302
	movl	$16384, %edx                    ## imm = 0x4000
	callq	_dib8000_write_word
	movl	%eax, %r12d
	movq	%rbx, %rdi
	movl	$770, %esi                      ## imm = 0x302
	xorl	%edx, %edx
	callq	_dib8000_write_word
	movl	%eax, %r14d
	movl	$45, %edi
	callq	_msleep
	cmpq	$0, (%rbx)
	je	LBB0_3
## %bb.6:
	cmpl	$1, 20(%rbx)
	jne	LBB0_10
LBB0_7:
	movl	%r15d, %edx
	shll	$12, %edx
	negl	%edx
	cmpq	$0, 24(%rbx)
	je	LBB0_8
## %bb.9:
	addl	$50784, %edx                    ## imm = 0xC660
	movl	$11, %r13d
	jmp	LBB0_11
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_15
LBB0_3:
	movl	$200, %edi
	cmpl	$1, 20(%rbx)
	jne	LBB0_5
## %bb.4:
	cmpq	$0, 24(%rbx)
	movl	$300, %eax                      ## imm = 0x12C
	movl	$500, %edi                      ## imm = 0x1F4
	cmovel	%eax, %edi
LBB0_5:
	callq	_msleep
	cmpl	$1, 20(%rbx)
	je	LBB0_7
LBB0_10:
	movl	%r15d, %eax
	shll	$12, %eax
	movl	$46720, %edx                    ## imm = 0xB680
	subl	%eax, %edx
	movl	$10, %r13d
	jmp	LBB0_11
LBB0_8:
	addl	$54848, %edx                    ## imm = 0xD640
	movl	$12, %r13d
LBB0_11:
	orl	%r12d, %r14d
	movq	%rbx, %rdi
	movl	$32, %esi
	callq	_dib8000_write_word
	subl	%r15d, %r13d
	shll	$5, %r15d
	addl	$160, %r15d
	orl	%r13d, %r15d
	movq	%rbx, %rdi
	movl	$37, %esi
	movl	%r15d, %edx
	callq	_dib8000_write_word
	movl	%eax, %r15d
	movq	%rbx, %rdi
	movl	$568, %esi                      ## imm = 0x238
	callq	_dib8000_read_word
	testl	$2048, %eax                     ## imm = 0x800
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	callq	_dib8000_update_timf
LBB0_13:
	orl	%r15d, %r14d
	movq	%rbx, %rdi
	movl	$6, %esi
	movl	$512, %edx                      ## imm = 0x200
	callq	_dib8000_write_word
	cmpl	$32770, 8(%rbx)                 ## imm = 0x8002
	jne	LBB0_15
## %bb.14:
	movq	%rbx, %rdi
	movl	$903, %esi                      ## imm = 0x387
	callq	_dib8000_read_word
	movl	%eax, %r15d
	movl	%eax, %edx
	andl	$-9, %edx
	movq	%rbx, %rdi
	movl	$903, %esi                      ## imm = 0x387
	callq	_dib8000_write_word
	movl	$1, %edi
	callq	_msleep
	orl	$8, %r15d
	movq	%rbx, %rdi
	movl	$903, %esi                      ## imm = 0x387
	movl	%r15d, %edx
	callq	_dib8000_write_word
LBB0_15:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_dib8000_tune
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dib8000_tune
_dib8000_tune:                          ; @dib8000_tune
	.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
	ldr	x19, [x0]
	mov	x0, x19
	bl	_fft_to_mode
	cbz	x19, LBB0_4
; %bb.1:
	mov	x20, x0
	ldrsw	x8, [x19, #16]
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w1, w8, w9
	mov	x0, x19
	bl	_dib8000_set_bandwidth
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	bl	_dib8000_set_channel
	mov	x0, x19
	mov	w1, #770
	mov	w2, #16384
	bl	_dib8000_write_word
	mov	x21, x0
	mov	x0, x19
	mov	w1, #770
	mov	w2, #0
	bl	_dib8000_write_word
	mov	x22, x0
	mov	w0, #45
	bl	_msleep
	ldr	x8, [x19]
	cbnz	x8, LBB0_7
; %bb.2:
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.ne	LBB0_5
; %bb.3:
	ldr	x8, [x19, #24]
	cmp	x8, #0
	mov	w8, #500
	mov	w9, #300
	csel	w0, w9, w8, eq
	b	LBB0_6
LBB0_4:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_14
LBB0_5:
	mov	w0, #200
LBB0_6:
	bl	_msleep
LBB0_7:
	orr	w21, w22, w21
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.ne	LBB0_9
; %bb.8:
	ldr	x8, [x19, #24]
	neg	w9, w20, lsl #12
	mov	w10, #50784
	add	w10, w9, w10
	mov	w11, #11
	mov	w12, #54848
	add	w9, w9, w12
	mov	w12, #12
	cmp	x8, #0
	csel	w2, w10, w9, ne
	csel	w22, w11, w12, ne
	b	LBB0_10
LBB0_9:
	mov	w8, #46720
	sub	w2, w8, w20, lsl #12
	mov	w22, #10
LBB0_10:
	mov	x0, x19
	mov	w1, #32
	bl	_dib8000_write_word
	lsl	w8, w20, #5
	add	w8, w8, #160
	sub	w9, w22, w20
	orr	w2, w8, w9
	mov	x0, x19
	mov	w1, #37
	bl	_dib8000_write_word
	orr	w20, w21, w0
	mov	x0, x19
	mov	w1, #568
	bl	_dib8000_read_word
	tbz	w0, #11, LBB0_12
; %bb.11:
	mov	x0, x19
	bl	_dib8000_update_timf
LBB0_12:
	mov	x0, x19
	mov	w1, #6
	mov	w2, #512
	bl	_dib8000_write_word
	ldr	w8, [x19, #8]
	mov	w9, #32770
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.13:
	mov	x0, x19
	mov	w1, #903
	bl	_dib8000_read_word
	mov	x21, x0
	and	w2, w0, #0xfffffff7
	mov	x0, x19
	mov	w1, #903
	bl	_dib8000_write_word
	mov	w0, #1
	bl	_msleep
	orr	w2, w21, #0x8
	mov	x0, x19
	mov	w1, #903
	bl	_dib8000_write_word
LBB0_14:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_dib8000_tune
.subsections_via_symbols
