	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cx24120_init
_cx24120_init:                          ## @cx24120_init
	.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	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rbx
	xorl	%r15d, %r15d
	cmpl	$0, (%rbx)
	jne	LBB0_7
## %bb.1:
	movq	%rdi, %r14
	movq	%rbx, %rdi
	movl	$234, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	callq	_cx24120_test_rom
	movq	%rbx, %rdi
	movl	$251, %esi
	callq	_cx24120_readreg
	andl	$254, %eax
	movq	%rbx, %rdi
	movl	$251, %esi
	movl	%eax, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$252, %esi
	callq	_cx24120_readreg
	andl	$254, %eax
	movq	%rbx, %rdi
	movl	$252, %esi
	movl	%eax, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$195, %esi
	movl	$4, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$196, %esi
	movl	$4, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$206, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$207, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$234, %esi
	callq	_cx24120_readreg
	movl	%eax, %r15d
	andl	$254, %r15d
	movq	%rbx, %rdi
	movl	$234, %esi
	movl	%r15d, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$235, %esi
	movl	$12, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$236, %esi
	movl	$6, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$237, %esi
	movl	$5, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$238, %esi
	movl	$3, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$239, %esi
	movl	$5, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$243, %esi
	movl	$3, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$244, %esi
	movl	$68, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$240, %esi
	movl	$4, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$230, %esi
	movl	$2, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$241, %esi
	movl	$4, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$231, %esi
	movl	$2, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$242, %esi
	movl	$4, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$232, %esi
	movl	$2, %edx
	callq	_cx24120_writereg
	orl	$1, %r15d
	movq	%rbx, %rdi
	movl	$234, %esi
	movl	%r15d, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$197, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$198, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$199, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$200, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$201, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$202, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$228, %esi
	movl	$3, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$235, %esi
	movl	$10, %edx
	callq	_cx24120_writereg
	movq	8(%rbx), %rdi
	movq	_CX24120_FIRMWARE@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	16(%rbx), %rax
	movl	(%r12), %edx
	leaq	-40(%rbp), %rsi
	movq	%r14, %rdi
	callq	*(%rax)
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r15d
	movl	(%r12), %esi
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_err
	jmp	LBB0_7
LBB0_3:
	movq	8(%rbx), %rdi
	movq	-40(%rbp), %rax
	movslq	(%rax), %rdx
	movq	8(%rax), %rax
	movl	(%rax), %ecx
	movl	4(%rax), %r8d
	movl	-8(%rax,%rdx,4), %r9d
	movl	-4(%rax,%rdx,4), %eax
	movl	%eax, (%rsp)
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%rbx, %rdi
	callq	_cx24120_test_rom
	movq	%rbx, %rdi
	movl	$251, %esi
	callq	_cx24120_readreg
	andl	$254, %eax
	movq	%rbx, %rdi
	movl	$251, %esi
	movl	%eax, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$224, %esi
	movl	$118, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$247, %esi
	movl	$129, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$248, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$249, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movl	(%rax), %ecx
	decl	%ecx
	movq	%rbx, %rdi
	movl	$250, %esi
	xorl	%r8d, %r8d
	callq	_cx24120_writeregs
	movq	%rbx, %rdi
	movl	$247, %esi
	movl	$192, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$224, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	-40(%rbp), %rax
	movl	$254, %ecx
	addl	(%rax), %ecx
	movzbl	%cl, %edx
	movq	%rbx, %rdi
	movl	$248, %esi
	callq	_cx24120_writereg
	movq	-40(%rbp), %rax
	movl	$65534, %ecx                    ## imm = 0xFFFE
	addl	(%rax), %ecx
	movzbl	%ch, %edx
	movq	%rbx, %rdi
	movl	$249, %esi
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$247, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$220, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	%rbx, %rdi
	movl	$220, %esi
	movl	$7, %edx
	callq	_cx24120_writereg
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msleep
	movq	%rbx, %rdi
	movl	$225, %esi
	callq	_cx24120_readreg
	movq	-40(%rbp), %rcx
	movq	8(%rcx), %rdx
	movslq	(%rcx), %rcx
	cmpl	-4(%rdx,%rcx,4), %eax
	jne	LBB0_5
## %bb.4:
	movq	8(%rbx), %rdi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_6
LBB0_5:
	leaq	L_.str.4(%rip), %rdi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_err
	movq	_EREMOTEIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_6:
	movq	%rbx, %rdi
	movl	$220, %esi
	xorl	%edx, %edx
	callq	_cx24120_writereg
	movq	-40(%rbp), %rdi
	callq	_release_firmware
LBB0_7:
	movl	%r15d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"requesting firmware (%s) to download...\n"

	.comm	_CX24120_FIRMWARE,4,2           ## @CX24120_FIRMWARE
L_.str.1:                               ## @.str.1
	.asciz	"Could not load firmware (%s): %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Firmware found, size %d bytes (%02x %02x .. %02x %02x)\n"

L_.str.3:                               ## @.str.3
	.asciz	"Firmware uploaded successfully\n"

L_.str.4:                               ## @.str.4
	.asciz	"Firmware upload failed. Last byte returned=0x%x\n"

	.comm	_EREMOTEIO,4,2                  ## @EREMOTEIO
	.comm	_CMD_START_TUNER,4,2            ## @CMD_START_TUNER
	.comm	_CMD_BANDWIDTH,4,2              ## @CMD_BANDWIDTH
	.comm	_CMD_BER_CTRL,4,2               ## @CMD_BER_CTRL
	.comm	_CX24120_BER_WINDOW,8,3         ## @CX24120_BER_WINDOW
	.comm	_CMD_FWVERSION,4,2              ## @CMD_FWVERSION
	.comm	_CX24120_REG_MAILBOX,4,2        ## @CX24120_REG_MAILBOX
	.comm	_FE_SCALE_NOT_AVAILABLE,8,3     ## @FE_SCALE_NOT_AVAILABLE
	.no_dead_strip	_cx24120_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cx24120_init
_cx24120_init:                          ; @cx24120_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	ldr	x19, [x0]
	ldr	w8, [x19]
	cbz	w8, LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_8
LBB0_2:
	mov	x20, x0
	mov	x0, x19
	mov	w1, #234
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	bl	_cx24120_test_rom
	mov	x0, x19
	mov	w1, #251
	bl	_cx24120_readreg
	and	w2, w0, #0xfe
	mov	x0, x19
	mov	w1, #251
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #252
	bl	_cx24120_readreg
	and	w2, w0, #0xfe
	mov	x0, x19
	mov	w1, #252
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #195
	mov	w2, #4
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #196
	mov	w2, #4
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #206
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #207
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #234
	bl	_cx24120_readreg
	and	w21, w0, #0xfe
	mov	x0, x19
	mov	w1, #234
	mov	x2, x21
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #235
	mov	w2, #12
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #236
	mov	w2, #6
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #237
	mov	w2, #5
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #238
	mov	w2, #3
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #239
	mov	w2, #5
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #243
	mov	w2, #3
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #244
	mov	w2, #68
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #240
	mov	w2, #4
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #230
	mov	w2, #2
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #241
	mov	w2, #4
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #231
	mov	w2, #2
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #242
	mov	w2, #4
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #232
	mov	w2, #2
	bl	_cx24120_writereg
	orr	w2, w21, #0x1
	mov	x0, x19
	mov	w1, #234
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #197
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #198
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #199
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #200
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #201
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #202
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #228
	mov	w2, #3
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #235
	mov	w2, #10
	bl	_cx24120_writereg
	ldr	x0, [x19, #8]
Lloh0:
	adrp	x21, _CX24120_FIRMWARE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _CX24120_FIRMWARE@GOTPAGEOFF]
	ldr	w8, [x21]
	str	x8, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	ldr	w2, [x21]
	add	x1, sp, #40
	mov	x0, x20
	blr	x8
	cbz	w0, LBB0_4
; %bb.3:
	mov	x20, x0
	ldr	w8, [x21]
	stp	x8, x20, [sp]
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_err
	b	LBB0_8
LBB0_4:
	ldr	x0, [x19, #8]
	ldr	x8, [sp, #40]
	ldr	w9, [x8]
	ldr	x8, [x8, #8]
	sub	w10, w9, #2
	sub	w11, w9, #1
	ldr	w10, [x8, w10, sxtw #2]
	ldr	w11, [x8, w11, sxtw #2]
	ldp	w12, w8, [x8]
	stp	x10, x11, [sp, #24]
	stp	x12, x8, [sp, #8]
	str	x9, [sp]
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	mov	x0, x19
	bl	_cx24120_test_rom
	mov	x0, x19
	mov	w1, #251
	bl	_cx24120_readreg
	and	w2, w0, #0xfe
	mov	x0, x19
	mov	w1, #251
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #224
	mov	w2, #118
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #247
	mov	w2, #129
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #248
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #249
	mov	w2, #0
	bl	_cx24120_writereg
	ldr	x8, [sp, #40]
	ldr	x2, [x8, #8]
	ldr	w8, [x8]
	sub	w3, w8, #1
	mov	x0, x19
	mov	w1, #250
	mov	w4, #0
	bl	_cx24120_writeregs
	mov	x0, x19
	mov	w1, #247
	mov	w2, #192
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #224
	mov	w2, #0
	bl	_cx24120_writereg
	ldr	x8, [sp, #40]
	ldr	w8, [x8]
	add	w8, w8, #254
	and	w2, w8, #0xff
	mov	x0, x19
	mov	w1, #248
	bl	_cx24120_writereg
	ldr	x8, [sp, #40]
	ldr	w8, [x8]
	mov	w9, #65534
	add	w8, w8, w9
	ubfx	w2, w8, #8, #8
	mov	x0, x19
	mov	w1, #249
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #247
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #220
	mov	w2, #0
	bl	_cx24120_writereg
	mov	x0, x19
	mov	w1, #220
	mov	w2, #7
	bl	_cx24120_writereg
	mov	w0, #500
	bl	_msleep
	mov	x0, x19
	mov	w1, #225
	bl	_cx24120_readreg
	ldr	x8, [sp, #40]
	ldr	x9, [x8, #8]
	ldrsw	x8, [x8]
	add	x8, x9, x8, lsl #2
	ldur	w8, [x8, #-4]
	cmp	w0, w8
	b.ne	LBB0_6
; %bb.5:
	ldr	x0, [x19, #8]
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	mov	w20, #0
	b	LBB0_7
LBB0_6:
	str	xzr, [sp]
Lloh10:
	adrp	x0, l_.str.4@PAGE
Lloh11:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_err
Lloh12:
	adrp	x8, _EREMOTEIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EREMOTEIO@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_7:
	mov	x0, x19
	mov	w1, #220
	mov	w2, #0
	bl	_cx24120_writereg
	ldr	x0, [sp, #40]
	bl	_release_firmware
LBB0_8:
	mov	x0, x20
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"requesting firmware (%s) to download...\n"

	.comm	_CX24120_FIRMWARE,4,2           ; @CX24120_FIRMWARE
l_.str.1:                               ; @.str.1
	.asciz	"Could not load firmware (%s): %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Firmware found, size %d bytes (%02x %02x .. %02x %02x)\n"

l_.str.3:                               ; @.str.3
	.asciz	"Firmware uploaded successfully\n"

l_.str.4:                               ; @.str.4
	.asciz	"Firmware upload failed. Last byte returned=0x%x\n"

	.comm	_EREMOTEIO,4,2                  ; @EREMOTEIO
	.comm	_CMD_START_TUNER,4,2            ; @CMD_START_TUNER
	.comm	_CMD_BANDWIDTH,4,2              ; @CMD_BANDWIDTH
	.comm	_CMD_BER_CTRL,4,2               ; @CMD_BER_CTRL
	.comm	_CX24120_BER_WINDOW,8,3         ; @CX24120_BER_WINDOW
	.comm	_CMD_FWVERSION,4,2              ; @CMD_FWVERSION
	.comm	_CX24120_REG_MAILBOX,4,2        ; @CX24120_REG_MAILBOX
	.comm	_FE_SCALE_NOT_AVAILABLE,8,3     ; @FE_SCALE_NOT_AVAILABLE
	.no_dead_strip	_cx24120_init
.subsections_via_symbols
