	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_loopback
_init_loopback:                         ## @init_loopback
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rsi
	callq	_dd_dev_info
	movq	_DC_DC8051_CFG_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_read_csr
	movq	_DISABLE_SELF_GUID_CHECK@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_write_csr
	movq	(%r15), %rax
	movq	_ICODE_FUNCTIONAL_SIMULATOR@GOTPCREL(%rip), %rdi
	movq	_loopback@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	movq	_LOOPBACK_SERDES@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	cmpq	(%rdi), %rax
	jne	LBB0_5
## %bb.1:
	movq	_LOOPBACK_LCB@GOTPCREL(%rip), %rdi
	movq	(%rdi), %rdi
	cmpq	%rsi, %rdx
	je	LBB0_4
## %bb.2:
	cmpq	%rdi, %rdx
	je	LBB0_4
## %bb.3:
	movq	_LOOPBACK_CABLE@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rdx
	je	LBB0_4
LBB0_5:
	xorl	%r14d, %r14d
	cmpq	%rsi, %rdx
	je	LBB0_12
## %bb.6:
	movq	_LOOPBACK_LCB@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_9
## %bb.7:
	movq	_quick_linkup@GOTPCREL(%rip), %rcx
	movl	$1, (%rcx)
	movq	_ICODE_FPGA_EMULATION@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.8:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dd_dev_err
	jmp	LBB0_11
LBB0_4:
	movq	%rdi, (%rcx)
	movq	_quick_linkup@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%r14d, %r14d
	jmp	LBB0_12
LBB0_9:
	movq	_LOOPBACK_CABLE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	je	LBB0_12
## %bb.10:
	leaq	L_.str.2(%rip), %rsi
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dd_dev_err
LBB0_11:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_12:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Entering loopback mode\n"

	.comm	_DC_DC8051_CFG_MODE,4,2         ## @DC_DC8051_CFG_MODE
	.comm	_DISABLE_SELF_GUID_CHECK,4,2    ## @DISABLE_SELF_GUID_CHECK
	.comm	_ICODE_FUNCTIONAL_SIMULATOR,8,3 ## @ICODE_FUNCTIONAL_SIMULATOR
	.comm	_loopback,8,3                   ## @loopback
	.comm	_LOOPBACK_SERDES,8,3            ## @LOOPBACK_SERDES
	.comm	_LOOPBACK_LCB,8,3               ## @LOOPBACK_LCB
	.comm	_LOOPBACK_CABLE,8,3             ## @LOOPBACK_CABLE
	.comm	_quick_linkup,4,2               ## @quick_linkup
	.comm	_ICODE_FPGA_EMULATION,8,3       ## @ICODE_FPGA_EMULATION
L_.str.1:                               ## @.str.1
	.asciz	"LCB loopback not supported in emulation\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"Invalid loopback mode %d\n"

	.no_dead_strip	_init_loopback
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_loopback
_init_loopback:                         ; @init_loopback
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dd_dev_info
Lloh2:
	adrp	x8, _DC_DC8051_CFG_MODE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DC_DC8051_CFG_MODE@GOTPAGEOFF]
Lloh4:
	ldr	w20, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_read_csr
Lloh5:
	adrp	x8, _DISABLE_SELF_GUID_CHECK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _DISABLE_SELF_GUID_CHECK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	orr	w2, w8, w0
	mov	x0, x19
	mov	x1, x20
	bl	_write_csr
	ldr	x8, [x19]
Lloh8:
	adrp	x9, _ICODE_FUNCTIONAL_SIMULATOR@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ICODE_FUNCTIONAL_SIMULATOR@GOTPAGEOFF]
Lloh10:
	adrp	x10, _loopback@GOTPAGE
Lloh11:
	ldr	x10, [x10, _loopback@GOTPAGEOFF]
Lloh12:
	ldr	x12, [x9]
	ldr	x9, [x10]
Lloh13:
	adrp	x11, _LOOPBACK_SERDES@GOTPAGE
Lloh14:
	ldr	x11, [x11, _LOOPBACK_SERDES@GOTPAGEOFF]
Lloh15:
	ldr	x11, [x11]
	cmp	x8, x12
	b.ne	LBB0_3
; %bb.1:
Lloh16:
	adrp	x12, _LOOPBACK_LCB@GOTPAGE
Lloh17:
	ldr	x12, [x12, _LOOPBACK_LCB@GOTPAGEOFF]
Lloh18:
	ldr	x12, [x12]
Lloh19:
	adrp	x13, _LOOPBACK_CABLE@GOTPAGE
Lloh20:
	ldr	x13, [x13, _LOOPBACK_CABLE@GOTPAGEOFF]
Lloh21:
	ldr	x13, [x13]
	cmp	x9, x11
	ccmp	x9, x12, #4, ne
	ccmp	x9, x13, #4, ne
	b.ne	LBB0_3
; %bb.2:
	mov	w0, #0
	str	x12, [x10]
Lloh22:
	adrp	x8, _quick_linkup@GOTPAGE
Lloh23:
	ldr	x8, [x8, _quick_linkup@GOTPAGEOFF]
	mov	w9, #1
Lloh24:
	str	w9, [x8]
	b	LBB0_11
LBB0_3:
	cmp	x9, x11
	b.eq	LBB0_8
; %bb.4:
Lloh25:
	adrp	x10, _LOOPBACK_LCB@GOTPAGE
Lloh26:
	ldr	x10, [x10, _LOOPBACK_LCB@GOTPAGEOFF]
Lloh27:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_7
; %bb.5:
Lloh28:
	adrp	x9, _quick_linkup@GOTPAGE
Lloh29:
	ldr	x9, [x9, _quick_linkup@GOTPAGEOFF]
	mov	w10, #1
Lloh30:
	str	w10, [x9]
Lloh31:
	adrp	x9, _ICODE_FPGA_EMULATION@GOTPAGE
Lloh32:
	ldr	x9, [x9, _ICODE_FPGA_EMULATION@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.6:
Lloh34:
	adrp	x1, l_.str.1@PAGE
Lloh35:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_10
LBB0_7:
Lloh36:
	adrp	x8, _LOOPBACK_CABLE@GOTPAGE
Lloh37:
	ldr	x8, [x8, _LOOPBACK_CABLE@GOTPAGEOFF]
Lloh38:
	ldr	x8, [x8]
	cmp	x9, x8
	b.ne	LBB0_9
LBB0_8:
	mov	w0, #0
	b	LBB0_11
LBB0_9:
	str	x9, [sp]
Lloh39:
	adrp	x1, l_.str.2@PAGE
Lloh40:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_10:
	mov	x0, x19
	bl	_dd_dev_err
Lloh41:
	adrp	x8, _EINVAL@GOTPAGE
Lloh42:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh12
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotStr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Entering loopback mode\n"

	.comm	_DC_DC8051_CFG_MODE,4,2         ; @DC_DC8051_CFG_MODE
	.comm	_DISABLE_SELF_GUID_CHECK,4,2    ; @DISABLE_SELF_GUID_CHECK
	.comm	_ICODE_FUNCTIONAL_SIMULATOR,8,3 ; @ICODE_FUNCTIONAL_SIMULATOR
	.comm	_loopback,8,3                   ; @loopback
	.comm	_LOOPBACK_SERDES,8,3            ; @LOOPBACK_SERDES
	.comm	_LOOPBACK_LCB,8,3               ; @LOOPBACK_LCB
	.comm	_LOOPBACK_CABLE,8,3             ; @LOOPBACK_CABLE
	.comm	_quick_linkup,4,2               ; @quick_linkup
	.comm	_ICODE_FPGA_EMULATION,8,3       ; @ICODE_FPGA_EMULATION
l_.str.1:                               ; @.str.1
	.asciz	"LCB loopback not supported in emulation\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"Invalid loopback mode %d\n"

	.no_dead_strip	_init_loopback
.subsections_via_symbols
