	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bstp_calc_path_cost
_bstp_calc_path_cost:                   ## @bstp_calc_path_cost
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movl	(%rdi), %eax
	movq	_BSTP_PORT_ADMCOST@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	movl	4(%rdi), %eax
	popq	%rbp
	retq
LBB0_2:
	movq	16(%rdi), %rcx
	movq	(%rcx), %rdx
	movq	_LINK_STATE_DOWN@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_4
## %bb.3:
	movq	_BSTP_PORT_PNDCOST@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%rdi)
	jmp	LBB0_5
LBB0_4:
	movl	8(%rcx), %eax
	cmpl	$999, %eax                      ## imm = 0x3E7
	jg	LBB0_6
LBB0_5:
	movq	_BSTP_DEFAULT_PATH_COST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	popq	%rbp
	retq
LBB0_6:
	movl	%eax, %eax
	imulq	$274877907, %rax, %rcx          ## imm = 0x10624DD3
	shrq	$38, %rcx
	movabsq	$20000000000, %rax              ## imm = 0x4A817C800
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %rcx
	movq	_BSTP_MAX_PATH_COST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%ecx, %eax
	cmovll	%eax, %ecx
	movq	8(%rdi), %rdx
	movq	_BSTP_PROTO_STP@GOTPCREL(%rip), %rsi
	cmpl	$65536, %ecx                    ## imm = 0x10000
	movl	$65535, %eax                    ## imm = 0xFFFF
	cmovll	%ecx, %eax
	cmpq	(%rsi), %rdx
	cmovnel	%ecx, %eax
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BSTP_PORT_ADMCOST,4,2          ## @BSTP_PORT_ADMCOST
	.comm	_LINK_STATE_DOWN,8,3            ## @LINK_STATE_DOWN
	.comm	_BSTP_PORT_PNDCOST,4,2          ## @BSTP_PORT_PNDCOST
	.comm	_BSTP_DEFAULT_PATH_COST,4,2     ## @BSTP_DEFAULT_PATH_COST
	.comm	_BSTP_MAX_PATH_COST,4,2         ## @BSTP_MAX_PATH_COST
	.comm	_BSTP_PROTO_STP,8,3             ## @BSTP_PROTO_STP
	.no_dead_strip	_bstp_calc_path_cost
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bstp_calc_path_cost
_bstp_calc_path_cost:                   ; @bstp_calc_path_cost
	.cfi_startproc
; %bb.0:
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _BSTP_PORT_ADMCOST@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BSTP_PORT_ADMCOST@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	ldr	w0, [x0, #4]
	ret
LBB0_2:
	ldr	x9, [x0, #16]
	ldr	x10, [x9]
Lloh3:
	adrp	x11, _LINK_STATE_DOWN@GOTPAGE
Lloh4:
	ldr	x11, [x11, _LINK_STATE_DOWN@GOTPAGEOFF]
Lloh5:
	ldr	x11, [x11]
	cmp	x10, x11
	b.ne	LBB0_4
; %bb.3:
Lloh6:
	adrp	x9, _BSTP_PORT_PNDCOST@GOTPAGE
Lloh7:
	ldr	x9, [x9, _BSTP_PORT_PNDCOST@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x0]
	b	LBB0_5
LBB0_4:
	ldr	w8, [x9, #8]
	cmp	w8, #999
	b.gt	LBB0_6
LBB0_5:
Lloh9:
	adrp	x8, _BSTP_DEFAULT_PATH_COST@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BSTP_DEFAULT_PATH_COST@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	ret
LBB0_6:
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #38
	mov	x9, #51200
	movk	x9, #43031, lsl #16
	movk	x9, #4, lsl #32
Lloh12:
	adrp	x10, _BSTP_MAX_PATH_COST@GOTPAGE
Lloh13:
	ldr	x10, [x10, _BSTP_MAX_PATH_COST@GOTPAGEOFF]
	udiv	x8, x9, x8
Lloh14:
	ldr	w9, [x10]
	cmp	w9, w8
	csel	w8, w9, w8, lt
Lloh15:
	adrp	x9, _BSTP_PROTO_STP@GOTPAGE
Lloh16:
	ldr	x9, [x9, _BSTP_PROTO_STP@GOTPAGEOFF]
	ldr	x10, [x0, #8]
Lloh17:
	ldr	x9, [x9]
	mov	w11, #65535
	cmp	w8, w11
	ccmp	x10, x9, #0, gt
	csel	w0, w11, w8, eq
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_BSTP_PORT_ADMCOST,4,2          ; @BSTP_PORT_ADMCOST
	.comm	_LINK_STATE_DOWN,8,3            ; @LINK_STATE_DOWN
	.comm	_BSTP_PORT_PNDCOST,4,2          ; @BSTP_PORT_PNDCOST
	.comm	_BSTP_DEFAULT_PATH_COST,4,2     ; @BSTP_DEFAULT_PATH_COST
	.comm	_BSTP_MAX_PATH_COST,4,2         ; @BSTP_MAX_PATH_COST
	.comm	_BSTP_PROTO_STP,8,3             ; @BSTP_PROTO_STP
	.no_dead_strip	_bstp_calc_path_cost
.subsections_via_symbols
