	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bstp_set_path_cost             ## -- Begin function bstp_set_path_cost
	.p2align	4, 0x90
_bstp_set_path_cost:                    ## @bstp_set_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
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_BSTP_MAX_PATH_COST@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_6
LBB0_2:
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movq	_BSTP_PROTO_STP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$65535, %ebx                    ## imm = 0xFFFF
	cmovnel	%esi, %ebx
	movq	16(%rdi), %r14
	cmpl	$65536, %esi                    ## imm = 0x10000
	cmovll	%esi, %ebx
	movq	%r14, %rdi
	callq	_BSTP_LOCK
	movq	_BSTP_PORT_ADMCOST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%ebx, %ebx
	je	LBB0_3
## %bb.4:
	orl	%eax, 12(%r15)
	jmp	LBB0_5
LBB0_3:
	notl	%eax
	andl	%eax, 12(%r15)
	movq	%r15, %rdi
	callq	_bstp_calc_path_cost
	movl	%eax, %ebx
LBB0_5:
	movl	%ebx, 8(%r15)
	movq	%r14, %rdi
	callq	_bstp_reinit
	movq	%r14, %rdi
	callq	_BSTP_UNLOCK
	xorl	%eax, %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BSTP_MAX_PATH_COST,4,2         ## @BSTP_MAX_PATH_COST
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BSTP_PROTO_STP,8,3             ## @BSTP_PROTO_STP
	.comm	_BSTP_PORT_ADMCOST,4,2          ## @BSTP_PORT_ADMCOST
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bstp_set_path_cost             ; -- Begin function bstp_set_path_cost
	.p2align	2
_bstp_set_path_cost:                    ; @bstp_set_path_cost
	.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
Lloh0:
	adrp	x8, _BSTP_MAX_PATH_COST@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BSTP_MAX_PATH_COST@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	b	LBB0_6
LBB0_2:
	mov	x19, x0
	ldr	x20, [x0, #16]
Lloh6:
	adrp	x8, _BSTP_PROTO_STP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BSTP_PROTO_STP@GOTPAGEOFF]
	ldr	x9, [x0]
Lloh8:
	ldr	x8, [x8]
	cmp	x9, x8
	mov	w8, #65535
	ccmp	w1, w8, #4, eq
	csel	w21, w8, w1, gt
	mov	x0, x20
	bl	_BSTP_LOCK
Lloh9:
	adrp	x8, _BSTP_PORT_ADMCOST@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BSTP_PORT_ADMCOST@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cbz	w21, LBB0_4
; %bb.3:
	ldr	w9, [x19, #12]
	orr	w8, w9, w8
	str	w8, [x19, #12]
	b	LBB0_5
LBB0_4:
	ldr	w9, [x19, #12]
	bic	w8, w9, w8
	str	w8, [x19, #12]
	mov	x0, x19
	bl	_bstp_calc_path_cost
	mov	x21, x0
LBB0_5:
	str	w21, [x19, #8]
	mov	x0, x20
	bl	_bstp_reinit
	mov	x0, x20
	bl	_BSTP_UNLOCK
	mov	w0, #0
LBB0_6:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_BSTP_MAX_PATH_COST,4,2         ; @BSTP_MAX_PATH_COST
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BSTP_PROTO_STP,8,3             ; @BSTP_PROTO_STP
	.comm	_BSTP_PORT_ADMCOST,4,2          ; @BSTP_PORT_ADMCOST
.subsections_via_symbols
