	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mlxsw_m_ports_create
_mlxsw_m_ports_create:                  ## @mlxsw_m_ports_create
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movl	20(%rdi), %edi
	callq	_mlxsw_core_max_ports
	movl	%eax, %r14d
	movl	%eax, -44(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movl	%eax, %edi
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_13
## %bb.1:
	movl	(%rbx), %edx
	movl	%r14d, %edi
	movl	$4, %esi
	callq	_kmalloc_array
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	je	LBB0_14
## %bb.2:
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.3:
	movl	%r14d, %edx
	shlq	$2, %rdx
	movq	%rax, %rdi
	movl	$255, %esi
	callq	_memset
	cmpl	$1, %r14d
	je	LBB0_7
## %bb.4:
	movl	$1, %ebx
	leaq	-44(%rbp), %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	movq	%r13, %rdx
	callq	_mlxsw_m_port_module_map
	testl	%eax, %eax
	jne	LBB0_23
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	incl	%ebx
	cmpl	%ebx, %r14d
	jne	LBB0_5
LBB0_7:
	movl	16(%r15), %eax
	testl	%eax, %eax
	jle	LBB0_16
## %bb.8:
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_10 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_16
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rcx
	movl	(%rcx,%rbx,4), %esi
	testl	%esi, %esi
	jle	LBB0_9
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_mlxsw_m_port_create
	testl	%eax, %eax
	jne	LBB0_17
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	16(%r15), %eax
	jmp	LBB0_9
LBB0_13:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_28
LBB0_16:
	xorl	%r12d, %r12d
	jmp	LBB0_28
LBB0_14:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_27
LBB0_17:
	movl	%eax, %r12d
	testl	%ebx, %ebx
	je	LBB0_22
## %bb.18:
	incq	%rbx
	jmp	LBB0_20
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_20 Depth=1
	decq	%rbx
	cmpq	$1, %rbx
	jle	LBB0_22
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	movl	-8(%rax,%rbx,4), %esi
	testl	%esi, %esi
	jle	LBB0_19
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	%r15, %rdi
	callq	_mlxsw_m_port_remove
	jmp	LBB0_19
LBB0_22:
	movl	%r14d, %ebx
	cmpl	$2, %ebx
	jge	LBB0_24
	jmp	LBB0_26
LBB0_23:
	movl	%eax, %r12d
	cmpl	$2, %ebx
	jl	LBB0_26
LBB0_24:
	incl	%ebx
	.p2align	4, 0x90
LBB0_25:                                ## =>This Inner Loop Header: Depth=1
	leal	-2(%rbx), %esi
	movq	%r15, %rdi
	callq	_mlxsw_m_port_module_unmap
	decl	%ebx
	cmpl	$2, %ebx
	ja	LBB0_25
LBB0_26:
	movq	8(%r15), %rdi
	callq	_kfree
LBB0_27:
	movq	(%r15), %rdi
	callq	_kfree
LBB0_28:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mlxsw_m_ports_create
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlxsw_m_ports_create
_mlxsw_m_ports_create:                  ; @mlxsw_m_ports_create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	ldr	w0, [x0, #20]
	bl	_mlxsw_core_max_ports
	mov	x20, x0
	str	w0, [sp, #12]
Lloh0:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19]
	cbz	x0, LBB0_13
; %bb.1:
	ldr	w2, [x21]
	mov	x0, x20
	mov	w1, #4
	bl	_kmalloc_array
	str	x0, [x19, #8]
	cbz	x0, LBB0_15
; %bb.2:
	cbz	w20, LBB0_7
; %bb.3:
	mov	w8, w20
	lsl	x2, x8, #2
	mov	w1, #255
	bl	_memset
	cmp	w20, #1
	b.eq	LBB0_7
; %bb.4:
	mov	w22, #1
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x22
	bl	_mlxsw_m_port_module_map
	cbnz	w0, LBB0_22
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w22, w22, #1
	cmp	w20, w22
	b.ne	LBB0_5
LBB0_7:
	ldr	w8, [x19, #16]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.8:
	mov	x22, #0
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x22, x22, #1
	cmp	x22, w8, sxtw
	b.ge	LBB0_14
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #8]
	ldr	w1, [x9, x22, lsl #2]
	cmp	w1, #1
	b.lt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x19
	mov	x2, x22
	bl	_mlxsw_m_port_create
	cbnz	w0, LBB0_16
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x19, #16]
	b	LBB0_9
LBB0_13:
Lloh2:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_27
LBB0_14:
	mov	w21, #0
	b	LBB0_27
LBB0_15:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_26
LBB0_16:
	mov	x21, x0
	cbz	w22, LBB0_21
; %bb.17:
	sub	x22, x22, #1
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=1
	add	x8, x22, #1
	sub	x22, x22, #1
	cmp	x8, #1
	b.le	LBB0_21
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	ldr	w1, [x8, x22, lsl #2]
	cmp	w1, #1
	b.lt	LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	mov	x0, x19
	bl	_mlxsw_m_port_remove
	b	LBB0_18
LBB0_21:
	mov	x22, x20
	cmp	w22, #2
	b.ge	LBB0_23
	b	LBB0_25
LBB0_22:
	mov	x21, x0
	cmp	w22, #2
	b.lt	LBB0_25
LBB0_23:
	add	w20, w22, #1
LBB0_24:                                ; =>This Inner Loop Header: Depth=1
	sub	w1, w20, #2
	mov	x0, x19
	bl	_mlxsw_m_port_module_unmap
	sub	w20, w20, #1
	cmp	w20, #2
	b.hi	LBB0_24
LBB0_25:
	ldr	x0, [x19, #8]
	bl	_kfree
LBB0_26:
	ldr	x0, [x19]
	bl	_kfree
LBB0_27:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mlxsw_m_ports_create
.subsections_via_symbols
