	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___mlxsw_sp_port_headroom_set   ## -- Begin function __mlxsw_sp_port_headroom_set
	.p2align	4, 0x90
___mlxsw_sp_port_headroom_set:          ## @__mlxsw_sp_port_headroom_set
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	movq	%rdx, %rbx
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %r12
	testq	%r8, %r8
	je	LBB0_1
## %bb.2:
	movl	(%r8), %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	8(%r8), %rax
	jmp	LBB0_3
LBB0_1:
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
LBB0_3:
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_MLXSW_REG_PBMC_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	movq	%r12, %rdi
	callq	_mlxsw_sp_sb_max_headroom_cells
	movq	%rax, %r15
	movl	(%r14), %esi
	movq	%r13, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_mlxsw_reg_pbmc_pack
	movl	(%r12), %r14d
	movq	_pbmc@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_MLXSW_REG
	movl	%r14d, %edi
	movl	%eax, %esi
	movq	%r13, %rdx
	callq	_mlxsw_reg_query
	testl	%eax, %eax
	jne	LBB0_16
## %bb.4:
	movq	%r15, -104(%rbp)                ## 8-byte Spill
	movq	_IEEE_8021QAZ_MAX_TCS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	movq	_pbmc@GOTPCREL(%rip), %rdx
	jle	LBB0_12
## %bb.5:
	xorl	%ecx, %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	xorl	%r14d, %r14d
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	movq	%r13, -88(%rbp)                 ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	%ecx, %eax
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	incl	%r14d
	cmpl	%eax, %r14d
	jge	LBB0_12
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movl	%eax, %ecx
	testl	%eax, %eax
	jle	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	%r14d, (%rbx,%rdi,4)
	je	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=2
	incq	%rdi
	cmpq	%rdi, %rcx
	jne	LBB0_8
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_6 Depth=1
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_BIT
	movl	%eax, %r15d
	andl	-72(%rbp), %r15d                ## 4-byte Folded Reload
	movq	%r12, %rdi
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %esi
	callq	_mlxsw_sp_pg_buf_threshold_get
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	movq	%r12, %rdi
	movl	%r13d, %esi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	%r15d, %ecx
	movl	-56(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %r8d
	callq	_mlxsw_sp_pg_buf_delay_get
	movq	-112(%rbp), %r9                 ## 8-byte Reload
	addq	%r9, %rax
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	addq	%rax, %rcx
	cmpq	-104(%rbp), %rcx                ## 8-byte Folded Reload
	jg	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	xorl	%r8d, %r8d
	orl	%r12d, %r15d
	sete	%r8b
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	movl	%r14d, %esi
	movq	%rax, %rdx
	movq	%r9, %rcx
	callq	_mlxsw_sp_pg_buf_pack
	movq	_IEEE_8021QAZ_MAX_TCS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-96(%rbp), %r12                 ## 8-byte Reload
	movq	_pbmc@GOTPCREL(%rip), %rdx
	jmp	LBB0_11
LBB0_12:
	movl	(%r12), %ebx
	movl	(%rdx), %edi
	callq	_MLXSW_REG
	movl	%ebx, %edi
	movl	%eax, %esi
	movq	%r13, %rdx
	callq	_mlxsw_reg_write
LBB0_16:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_18
## %bb.17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	_ENOBUFS@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_16
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MLXSW_REG_PBMC_LEN,4,2         ## @MLXSW_REG_PBMC_LEN
	.comm	_pbmc,4,2                       ## @pbmc
	.comm	_IEEE_8021QAZ_MAX_TCS,4,2       ## @IEEE_8021QAZ_MAX_TCS
	.comm	_ENOBUFS,4,2                    ## @ENOBUFS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___mlxsw_sp_port_headroom_set   ; -- Begin function __mlxsw_sp_port_headroom_set
	.p2align	2
___mlxsw_sp_port_headroom_set:          ; @__mlxsw_sp_port_headroom_set
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #32
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x26, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	x22, [x0, #8]
	cbz	x4, LBB0_2
; %bb.1:
	ldr	w8, [x4]
	stur	w8, [x29, #-92]                 ; 4-byte Folded Spill
	ldr	x8, [x4, #8]
	stur	x8, [x29, #-104]                ; 8-byte Folded Spill
	b	LBB0_3
LBB0_2:
	stur	wzr, [x29, #-92]                ; 4-byte Folded Spill
	stur	xzr, [x29, #-104]               ; 8-byte Folded Spill
LBB0_3:
Lloh3:
	adrp	x8, _MLXSW_REG_PBMC_LEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MLXSW_REG_PBMC_LEN@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x24, x9, x8
	mov	sp, x24
	mov	x0, x22
	bl	_mlxsw_sp_sb_max_headroom_cells
	mov	x25, x0
	ldr	w1, [x26]
	mov	x0, x24
	mov	w2, #0
	mov	w3, #0
	bl	_mlxsw_reg_pbmc_pack
	ldr	w26, [x22]
Lloh8:
	adrp	x8, _pbmc@GOTPAGE
Lloh9:
	ldr	x8, [x8, _pbmc@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_MLXSW_REG
	mov	x1, x0
	mov	x0, x26
	mov	x2, x24
	bl	_mlxsw_reg_query
	cbnz	w0, LBB0_15
; %bb.4:
Lloh11:
	adrp	x8, _IEEE_8021QAZ_MAX_TCS@GOTPAGE
Lloh12:
	ldr	x8, [x8, _IEEE_8021QAZ_MAX_TCS@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.5:
	mov	x23, #0
	mov	w26, #0
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	mov	x8, x9
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	w26, w26, #1
	cmp	w26, w8
	b.ge	LBB0_14
LBB0_8:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	mov	w9, w8
	cmp	w8, #0
	b.le	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, #0
LBB0_10:                                ;   Parent Loop BB0_8 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x20, x0, lsl #2]
	cmp	w8, w26
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	add	x0, x0, #1
	cmp	x9, x0
	b.ne	LBB0_10
	b	LBB0_6
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_BIT
	ldur	w8, [x29, #-92]                 ; 4-byte Folded Reload
	and	w28, w0, w8
	mov	x0, x22
	mov	x1, x21
	bl	_mlxsw_sp_pg_buf_threshold_get
	mov	x27, x0
	mov	x0, x22
	mov	x1, x21
	ldur	x2, [x29, #-104]                ; 8-byte Folded Reload
	mov	x3, x28
	mov	x4, x19
	bl	_mlxsw_sp_pg_buf_delay_get
	add	x2, x0, x27
	add	x23, x2, x23
	cmp	x23, x25
	b.gt	LBB0_17
; %bb.13:                               ;   in Loop: Header=BB0_8 Depth=1
	orr	w8, w28, w19
	cmp	w8, #0
	cset	w4, eq
	mov	x0, x24
	mov	x1, x26
	mov	x3, x27
	bl	_mlxsw_sp_pg_buf_pack
Lloh14:
	adrp	x8, _IEEE_8021QAZ_MAX_TCS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _IEEE_8021QAZ_MAX_TCS@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	b	LBB0_7
LBB0_14:
	ldr	w19, [x22]
Lloh17:
	adrp	x8, _pbmc@GOTPAGE
Lloh18:
	ldr	x8, [x8, _pbmc@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	bl	_MLXSW_REG
	mov	x1, x0
	mov	x0, x19
	mov	x2, x24
	bl	_mlxsw_reg_write
LBB0_15:
	ldur	x8, [x29, #-88]
Lloh20:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh21:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_18
; %bb.16:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_17:
Lloh23:
	adrp	x8, _ENOBUFS@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOBUFS@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
LBB0_18:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_MLXSW_REG_PBMC_LEN,4,2         ; @MLXSW_REG_PBMC_LEN
	.comm	_pbmc,4,2                       ; @pbmc
	.comm	_IEEE_8021QAZ_MAX_TCS,4,2       ; @IEEE_8021QAZ_MAX_TCS
	.comm	_ENOBUFS,4,2                    ; @ENOBUFS
.subsections_via_symbols
