	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function board_replaced
_board_replaced:                        ## @board_replaced
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movq	16(%rsi), %r15
	movl	(%rdi), %r14d
	subl	(%rsi), %r14d
	movq	_INT_INPUT_CLEAR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%rsi), %rdi
	callq	_readl
	cltq
	btq	%r14, %rax
	jae	LBB0_2
## %bb.1:
	movq	_INTERLOCK_OPEN@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_14
LBB0_2:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_is_slot_enabled
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_CARD_FUNCTIONING@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_14
LBB0_4:
	leaq	4(%rbx), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_enable_slot_power
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	_SLOT_POWER@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	addq	8(%rbx), %rdi
	callq	_readb
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	(%r13), %rsi
	addq	8(%rbx), %rsi
	xorl	%r13d, %r13d
	xorl	%edi, %edi
	callq	_writeb
	movq	_SLOT_POWER@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_writeb
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_get_adapter_speed
	cmpl	%eax, (%r15)
	je	LBB0_7
## %bb.5:
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	%r14d, %edx
	callq	_set_controller_speed
	xorl	%r13d, %r13d
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_WRONG_BUS_FREQUENCY@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
LBB0_7:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_disable_slot_power
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%r13d, %r13d
	jne	LBB0_14
## %bb.8:
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_slot_enable
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_green_LED_blink
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_amber_LED_off
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_long_delay
	cmpl	$255, 4(%r12)
	jne	LBB0_10
## %bb.9:
	movq	_POWER_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	$0, 4(%r12)
	jmp	LBB0_11
LBB0_10:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_cpqhp_valid_replace
	movl	%eax, %r13d
LBB0_11:
	testl	%r13d, %r13d
	je	LBB0_12
## %bb.13:
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_amber_LED_on
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_green_LED_off
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_slot_disable
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_14
LBB0_12:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_cpqhp_configure_board
	movl	%eax, %r12d
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_amber_LED_on
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_green_LED_off
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_slot_disable
	movq	%rbx, %rdi
	callq	_set_SOGO
	movq	%rbx, %rdi
	callq	_wait_for_ctrl_irq
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%r12d, %r12d
	movl	$1, %r13d
	cmovnel	%r12d, %r13d
LBB0_14:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_INPUT_CLEAR,8,3            ## @INT_INPUT_CLEAR
	.comm	_INTERLOCK_OPEN,4,2             ## @INTERLOCK_OPEN
	.comm	_CARD_FUNCTIONING,4,2           ## @CARD_FUNCTIONING
	.comm	_SLOT_POWER,8,3                 ## @SLOT_POWER
	.comm	_WRONG_BUS_FREQUENCY,4,2        ## @WRONG_BUS_FREQUENCY
	.comm	_HZ,4,2                         ## @HZ
	.comm	_POWER_FAILURE,4,2              ## @POWER_FAILURE
	.no_dead_strip	_board_replaced
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function board_replaced
_board_replaced:                        ; @board_replaced
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	mov	x22, x0
	ldr	w8, [x0]
	ldr	w9, [x1]
	sub	w20, w8, w9
	ldp	x8, x24, [x1, #8]
Lloh0:
	adrp	x9, _INT_INPUT_CLEAR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _INT_INPUT_CLEAR@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	lsr	x8, x8, x20
	tbz	w8, #0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _INTERLOCK_OPEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _INTERLOCK_OPEN@GOTPAGEOFF]
Lloh5:
	ldr	w23, [x8]
	b	LBB0_13
LBB0_2:
	mov	x0, x19
	mov	x1, x20
	bl	_is_slot_enabled
	cbz	x0, LBB0_4
; %bb.3:
Lloh6:
	adrp	x8, _CARD_FUNCTIONING@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CARD_FUNCTIONING@GOTPAGEOFF]
Lloh8:
	ldr	w23, [x8]
	b	LBB0_13
LBB0_4:
	add	x21, x19, #4
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x20
	bl	_enable_slot_power
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	ldr	x8, [x19, #8]
Lloh9:
	adrp	x25, _SLOT_POWER@GOTPAGE
Lloh10:
	ldr	x25, [x25, _SLOT_POWER@GOTPAGEOFF]
	ldr	x9, [x25]
	add	x0, x9, x8
	bl	_readb
	mov	x23, x0
	ldr	x8, [x19, #8]
	ldr	x9, [x25]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writeb
	ldr	x8, [x19, #8]
	ldr	x9, [x25]
	add	x1, x9, x8
	mov	x0, x23
	bl	_writeb
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	mov	x0, x19
	mov	x1, x20
	bl	_get_adapter_speed
	mov	w23, #0
	ldr	w8, [x24]
	cmp	w8, w0
	b.eq	LBB0_6
; %bb.5:
	mov	x1, x0
	mov	x0, x19
	mov	x2, x20
	bl	_set_controller_speed
Lloh11:
	adrp	x8, _WRONG_BUS_FREQUENCY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _WRONG_BUS_FREQUENCY@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	x0, #0
	csel	w23, wzr, w8, eq
LBB0_6:
	mov	x0, x19
	mov	x1, x20
	bl	_disable_slot_power
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	mov	x0, x21
	bl	_mutex_unlock
	cbnz	w23, LBB0_13
; %bb.7:
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x20
	bl	_slot_enable
	mov	x0, x19
	mov	x1, x20
	bl	_green_LED_blink
	mov	x0, x19
	mov	x1, x20
	bl	_amber_LED_off
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	mov	x0, x21
	bl	_mutex_unlock
Lloh14:
	adrp	x8, _HZ@GOTPAGE
Lloh15:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	bl	_long_delay
	ldr	w8, [x22, #4]
	cmp	w8, #255
	b.ne	LBB0_9
; %bb.8:
Lloh17:
	adrp	x8, _POWER_FAILURE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _POWER_FAILURE@GOTPAGEOFF]
Lloh19:
	ldr	w23, [x8]
	str	wzr, [x22, #4]
	b	LBB0_10
LBB0_9:
	mov	x0, x19
	mov	x1, x22
	bl	_cpqhp_valid_replace
	mov	x23, x0
LBB0_10:
	cbz	w23, LBB0_12
; %bb.11:
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x20
	bl	_amber_LED_on
	mov	x0, x19
	mov	x1, x20
	bl	_green_LED_off
	mov	x0, x19
	mov	x1, x20
	bl	_slot_disable
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	mov	x0, x21
	bl	_mutex_unlock
	b	LBB0_13
LBB0_12:
	mov	x0, x19
	mov	x1, x22
	bl	_cpqhp_configure_board
	mov	x22, x0
	mov	x0, x21
	bl	_mutex_lock
	mov	x0, x19
	mov	x1, x20
	bl	_amber_LED_on
	mov	x0, x19
	mov	x1, x20
	bl	_green_LED_off
	mov	x0, x19
	mov	x1, x20
	bl	_slot_disable
	mov	x0, x19
	bl	_set_SOGO
	mov	x0, x19
	bl	_wait_for_ctrl_irq
	mov	x0, x21
	bl	_mutex_unlock
	cmp	w22, #0
	csinc	w23, w22, wzr, ne
LBB0_13:
	mov	x0, x23
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_INPUT_CLEAR,8,3            ; @INT_INPUT_CLEAR
	.comm	_INTERLOCK_OPEN,4,2             ; @INTERLOCK_OPEN
	.comm	_CARD_FUNCTIONING,4,2           ; @CARD_FUNCTIONING
	.comm	_SLOT_POWER,8,3                 ; @SLOT_POWER
	.comm	_WRONG_BUS_FREQUENCY,4,2        ; @WRONG_BUS_FREQUENCY
	.comm	_HZ,4,2                         ; @HZ
	.comm	_POWER_FAILURE,4,2              ; @POWER_FAILURE
	.no_dead_strip	_board_replaced
.subsections_via_symbols
