	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ene_rx_setup
_ene_rx_setup:                          ## @ene_rx_setup
	.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, %r14
	movb	$1, %r13b
	cmpq	$0, 56(%rdi)
	jne	LBB0_2
## %bb.1:
	cmpq	$0, 48(%r14)
	setne	%r13b
LBB0_2:
	movzbl	%r13b, %esi
	leaq	L_.str(%rip), %rdi
	callq	_dbg
	movq	_ENE_CIRCFG2@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_ene_write_reg
	movq	_sample_period@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	movq	_ENE_DEFAULT_SAMPLE_PERIOD@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_4
## %bb.3:
	movq	(%r14), %rcx
	movq	_ENE_DEFAULT_PLL_FREQ@GOTPCREL(%rip), %rdx
	xorl	%esi, %esi
	cmpq	(%rdx), %rcx
	sete	%sil
	movl	$2, %ebx
	subl	%esi, %ebx
LBB0_4:
	movq	_ENE_CIRRLC_CFG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	addl	%eax, %ebx
	movq	_ENE_CIRRLC_CFG_OVERFLOW@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_ene_write_reg
	movq	8(%r14), %rax
	movq	_ENE_HW_C@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_11
## %bb.5:
	testb	%r13b, %r13b
	je	LBB0_7
## %bb.6:
	xorl	%edi, %edi
	cmpq	$0, 32(%r14)
	sete	%dil
	callq	_WARN_ON
	xorl	%esi, %esi
	cmpl	$0, 16(%r14)
	sete	%sil
	movq	%r14, %rdi
	callq	_ene_rx_select_input
	movl	$0, 20(%r14)
	movq	_ENE_CIRCFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ENE_CIRCFG_CARR_DEMOD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_ene_set_reg_mask
	movq	_ENE_CIRCAR_PULS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$99, %edx
	callq	_ene_write_reg
	movl	(%r12), %esi
	movq	_ENE_CIRCFG2_CARR_DETECT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	48(%r14), %rax
	movq	_debug@GOTPCREL(%rip), %rdi
	xorl	%ecx, %ecx
	orq	(%rdi), %rax
	setne	%cl
	movq	%r14, %rdi
	callq	_ene_set_clear_reg_mask
LBB0_11:
	cmpl	$0, 20(%r14)
	je	LBB0_13
LBB0_12:
	movq	_ENE_FW_SAMPLE_PERIOD_FAN@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, 32(%rcx)
	movq	_ENE_FW_SMPL_BUF_FAN_MSK@GOTPCREL(%rip), %rax
	movl	(%rbx), %edi
	imull	(%rax), %edi
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, 8(%rcx)
	movq	%rax, (%rcx)
	cmpq	$0, 32(%r14)
	je	LBB0_16
LBB0_15:
	movl	(%r15), %edi
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, 24(%rcx)
LBB0_16:
	movq	8(%rcx), %rdx
	movq	16(%rcx), %rax
	cmpq	%rdx, %rax
	jle	LBB0_18
## %bb.17:
	movq	%rdx, 16(%rcx)
	movq	%rdx, %rax
LBB0_18:
	movq	(%rcx), %rdx
	cmpq	%rdx, %rax
	jge	LBB0_20
## %bb.19:
	movq	%rdx, 16(%rcx)
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	cmpq	$0, 40(%r14)
	je	LBB0_9
## %bb.8:
	movl	$1, 20(%r14)
	jmp	LBB0_10
LBB0_9:
	movl	16(%r14), %esi
	movq	%r14, %rdi
	callq	_ene_rx_select_input
LBB0_10:
	movq	_ENE_CIRCFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ENE_CIRCFG_CARR_DEMOD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_ene_clear_reg_mask
	movl	(%r12), %esi
	movq	_ENE_CIRCFG2_CARR_DETECT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_ene_clear_reg_mask
	cmpl	$0, 20(%r14)
	jne	LBB0_12
LBB0_13:
	movl	(%r15), %edi
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, 32(%rcx)
	movl	(%r15), %eax
	movl	%eax, %edi
	shll	$7, %edi
	subl	%eax, %edi
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, (%rcx)
	movl	$200000, %edi                   ## imm = 0x30D40
	callq	_US_TO_NS
	movq	24(%r14), %rcx
	movq	%rax, 8(%rcx)
	cmpq	$0, 32(%r14)
	jne	LBB0_15
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"RX: setup receiver, learning mode = %d"

	.comm	_ENE_CIRCFG2,4,2                ## @ENE_CIRCFG2
	.comm	_sample_period,4,2              ## @sample_period
	.comm	_ENE_DEFAULT_SAMPLE_PERIOD,4,2  ## @ENE_DEFAULT_SAMPLE_PERIOD
	.comm	_ENE_DEFAULT_PLL_FREQ,8,3       ## @ENE_DEFAULT_PLL_FREQ
	.comm	_ENE_CIRRLC_CFG,4,2             ## @ENE_CIRRLC_CFG
	.comm	_ENE_CIRRLC_CFG_OVERFLOW,4,2    ## @ENE_CIRRLC_CFG_OVERFLOW
	.comm	_ENE_HW_C,8,3                   ## @ENE_HW_C
	.comm	_ENE_CIRCFG,4,2                 ## @ENE_CIRCFG
	.comm	_ENE_CIRCFG_CARR_DEMOD,4,2      ## @ENE_CIRCFG_CARR_DEMOD
	.comm	_ENE_CIRCAR_PULS,4,2            ## @ENE_CIRCAR_PULS
	.comm	_ENE_CIRCFG2_CARR_DETECT,4,2    ## @ENE_CIRCFG2_CARR_DETECT
	.comm	_debug,8,3                      ## @debug
	.comm	_ENE_FW_SAMPLE_PERIOD_FAN,4,2   ## @ENE_FW_SAMPLE_PERIOD_FAN
	.comm	_ENE_FW_SMPL_BUF_FAN_MSK,4,2    ## @ENE_FW_SMPL_BUF_FAN_MSK
	.no_dead_strip	_ene_rx_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ene_rx_setup
_ene_rx_setup:                          ; @ene_rx_setup
	.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	x19, x0
	ldr	x8, [x0, #56]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w20, #1
	b	LBB0_3
LBB0_2:
	ldr	x8, [x19, #48]
	cmp	x8, #0
	cset	w20, ne
LBB0_3:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_dbg
Lloh2:
	adrp	x22, _ENE_CIRCFG2@GOTPAGE
Lloh3:
	ldr	x22, [x22, _ENE_CIRCFG2@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #0
	bl	_ene_write_reg
	mov	w9, #0
Lloh4:
	adrp	x21, _sample_period@GOTPAGE
Lloh5:
	ldr	x21, [x21, _sample_period@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh6:
	adrp	x10, _ENE_DEFAULT_SAMPLE_PERIOD@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ENE_DEFAULT_SAMPLE_PERIOD@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	cmp	w8, w10
	b.ne	LBB0_5
; %bb.4:
	ldr	x9, [x19]
Lloh9:
	adrp	x10, _ENE_DEFAULT_PLL_FREQ@GOTPAGE
Lloh10:
	ldr	x10, [x10, _ENE_DEFAULT_PLL_FREQ@GOTPAGEOFF]
Lloh11:
	ldr	x10, [x10]
	cmp	x9, x10
	mov	w9, #1
	cinc	w9, w9, ne
LBB0_5:
Lloh12:
	adrp	x10, _ENE_CIRRLC_CFG@GOTPAGE
Lloh13:
	ldr	x10, [x10, _ENE_CIRRLC_CFG@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x10]
Lloh15:
	adrp	x10, _ENE_CIRRLC_CFG_OVERFLOW@GOTPAGE
Lloh16:
	ldr	x10, [x10, _ENE_CIRRLC_CFG_OVERFLOW@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	add	w8, w9, w8
	orr	w2, w10, w8
	mov	x0, x19
	bl	_ene_write_reg
	ldr	x8, [x19, #8]
Lloh18:
	adrp	x9, _ENE_HW_C@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ENE_HW_C@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_8
; %bb.6:
	cbz	w20, LBB0_16
; %bb.7:
	ldr	x8, [x19, #32]
	cmp	x8, #0
	cset	w0, eq
	bl	_WARN_ON
	ldr	w8, [x19, #16]
	cmp	w8, #0
	cset	w1, eq
	mov	x0, x19
	bl	_ene_rx_select_input
	str	wzr, [x19, #20]
Lloh21:
	adrp	x8, _ENE_CIRCFG@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENE_CIRCFG@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _ENE_CIRCFG_CARR_DEMOD@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENE_CIRCFG_CARR_DEMOD@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ene_set_reg_mask
Lloh27:
	adrp	x8, _ENE_CIRCAR_PULS@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ENE_CIRCAR_PULS@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #99
	bl	_ene_write_reg
	ldr	w1, [x22]
Lloh30:
	adrp	x8, _ENE_CIRCFG2_CARR_DETECT@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENE_CIRCFG2_CARR_DETECT@GOTPAGEOFF]
Lloh32:
	ldr	w2, [x8]
	ldr	x8, [x19, #48]
Lloh33:
	adrp	x9, _debug@GOTPAGE
Lloh34:
	ldr	x9, [x9, _debug@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	orr	x8, x8, x9
	cmp	x8, #0
	cset	w3, ne
	mov	x0, x19
	bl	_ene_set_clear_reg_mask
LBB0_8:
	ldr	w8, [x19, #20]
	cbz	w8, LBB0_20
LBB0_9:
Lloh36:
	adrp	x20, _ENE_FW_SAMPLE_PERIOD_FAN@GOTPAGE
Lloh37:
	ldr	x20, [x20, _ENE_FW_SAMPLE_PERIOD_FAN@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	str	x0, [x8, #32]
Lloh38:
	adrp	x8, _ENE_FW_SMPL_BUF_FAN_MSK@GOTPAGE
Lloh39:
	ldr	x8, [x8, _ENE_FW_SMPL_BUF_FAN_MSK@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	ldr	w9, [x20]
	mul	w0, w9, w8
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	stp	x0, x0, [x8]
	ldr	x9, [x19, #32]
	cbz	x9, LBB0_11
LBB0_10:
	ldr	w0, [x21]
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	str	x0, [x8, #24]
LBB0_11:
	ldp	x10, x9, [x8, #8]
	cmp	x9, x10
	b.le	LBB0_13
; %bb.12:
	str	x10, [x8, #16]
	mov	x9, x10
LBB0_13:
	ldr	x10, [x8]
	cmp	x9, x10
	b.ge	LBB0_15
; %bb.14:
	str	x10, [x8, #16]
LBB0_15:
	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
LBB0_16:
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_18
; %bb.17:
	mov	w8, #1
	str	w8, [x19, #20]
	b	LBB0_19
LBB0_18:
	ldr	w1, [x19, #16]
	mov	x0, x19
	bl	_ene_rx_select_input
LBB0_19:
Lloh41:
	adrp	x8, _ENE_CIRCFG@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ENE_CIRCFG@GOTPAGEOFF]
Lloh43:
	ldr	w1, [x8]
Lloh44:
	adrp	x8, _ENE_CIRCFG_CARR_DEMOD@GOTPAGE
Lloh45:
	ldr	x8, [x8, _ENE_CIRCFG_CARR_DEMOD@GOTPAGEOFF]
Lloh46:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ene_clear_reg_mask
	ldr	w1, [x22]
Lloh47:
	adrp	x8, _ENE_CIRCFG2_CARR_DETECT@GOTPAGE
Lloh48:
	ldr	x8, [x8, _ENE_CIRCFG2_CARR_DETECT@GOTPAGEOFF]
Lloh49:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ene_clear_reg_mask
	ldr	w8, [x19, #20]
	cbnz	w8, LBB0_9
LBB0_20:
	ldr	w0, [x21]
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	str	x0, [x8, #32]
	ldr	w8, [x21]
	lsl	w9, w8, #7
	sub	w0, w9, w8
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	str	x0, [x8]
	mov	w0, #3392
	movk	w0, #3, lsl #16
	bl	_US_TO_NS
	ldr	x8, [x19, #24]
	str	x0, [x8, #8]
	ldr	x9, [x19, #32]
	cbnz	x9, LBB0_10
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"RX: setup receiver, learning mode = %d"

	.comm	_ENE_CIRCFG2,4,2                ; @ENE_CIRCFG2
	.comm	_sample_period,4,2              ; @sample_period
	.comm	_ENE_DEFAULT_SAMPLE_PERIOD,4,2  ; @ENE_DEFAULT_SAMPLE_PERIOD
	.comm	_ENE_DEFAULT_PLL_FREQ,8,3       ; @ENE_DEFAULT_PLL_FREQ
	.comm	_ENE_CIRRLC_CFG,4,2             ; @ENE_CIRRLC_CFG
	.comm	_ENE_CIRRLC_CFG_OVERFLOW,4,2    ; @ENE_CIRRLC_CFG_OVERFLOW
	.comm	_ENE_HW_C,8,3                   ; @ENE_HW_C
	.comm	_ENE_CIRCFG,4,2                 ; @ENE_CIRCFG
	.comm	_ENE_CIRCFG_CARR_DEMOD,4,2      ; @ENE_CIRCFG_CARR_DEMOD
	.comm	_ENE_CIRCAR_PULS,4,2            ; @ENE_CIRCAR_PULS
	.comm	_ENE_CIRCFG2_CARR_DETECT,4,2    ; @ENE_CIRCFG2_CARR_DETECT
	.comm	_debug,8,3                      ; @debug
	.comm	_ENE_FW_SAMPLE_PERIOD_FAN,4,2   ; @ENE_FW_SAMPLE_PERIOD_FAN
	.comm	_ENE_FW_SMPL_BUF_FAN_MSK,4,2    ; @ENE_FW_SMPL_BUF_FAN_MSK
	.no_dead_strip	_ene_rx_setup
.subsections_via_symbols
