	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sctp_close                     ## -- Begin function sctp_close
	.p2align	4, 0x90
_sctp_close:                            ## @sctp_close
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	16(%rdi), %rbx
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.1:
	movq	%rdi, %r14
	movl	(%rbx), %esi
	movq	_SCTP_PCB_FLAGS_SOCKET_GONE@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movq	_SCTP_PCB_FLAGS_CLOSE_IP@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	testl	%esi, %edx
	jne	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	orl	%esi, %edx
	orl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_atomic_cmpset_int
	testq	%rax, %rax
	jne	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %esi
	movl	(%r15), %edx
	testl	%esi, %edx
	je	LBB0_2
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_SO_LINGER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_6
## %bb.5:
	cmpq	$0, 8(%r14)
	je	LBB0_8
LBB0_6:
	cmpq	$0, 24(%r14)
	jle	LBB0_7
LBB0_8:
	movq	_SCTP_FREE_SHOULD_USE_ABORT@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	movq	_SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %esi
	movq	_SCTP_CALLED_AFTER_CMPSET_OFCLOSE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_sctp_inpcb_free
	movq	%r14, %rdi
	callq	_SOCK_LOCK
	movq	32(%r14), %rdi
	callq	_SCTP_SB_CLEAR
	movq	24(%r14), %rdi
	callq	_SCTP_SB_CLEAR
	movq	$0, 16(%r14)
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_SOCK_UNLOCK                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SCTP_PCB_FLAGS_SOCKET_GONE,4,2 ## @SCTP_PCB_FLAGS_SOCKET_GONE
	.comm	_SCTP_PCB_FLAGS_CLOSE_IP,4,2    ## @SCTP_PCB_FLAGS_CLOSE_IP
	.comm	_SO_LINGER,4,2                  ## @SO_LINGER
	.comm	_SCTP_FREE_SHOULD_USE_ABORT,4,2 ## @SCTP_FREE_SHOULD_USE_ABORT
	.comm	_SCTP_CALLED_AFTER_CMPSET_OFCLOSE,4,2 ## @SCTP_CALLED_AFTER_CMPSET_OFCLOSE
	.comm	_SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE,4,2 ## @SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sctp_close                     ; -- Begin function sctp_close
	.p2align	2
_sctp_close:                            ; @sctp_close
	.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
	ldr	x20, [x0, #16]
	cbz	x20, LBB0_5
; %bb.1:
	mov	x19, x0
	ldr	w1, [x20]
Lloh0:
	adrp	x21, _SCTP_PCB_FLAGS_SOCKET_GONE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SCTP_PCB_FLAGS_SOCKET_GONE@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x22, _SCTP_PCB_FLAGS_CLOSE_IP@GOTPAGE
Lloh3:
	ldr	x22, [x22, _SCTP_PCB_FLAGS_CLOSE_IP@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	tst	w8, w1
	b.ne	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	orr	w8, w8, w1
	ldr	w9, [x22]
	orr	w2, w8, w9
	mov	x0, x20
	bl	_atomic_cmpset_int
	cbnz	x0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x20]
	ldr	w8, [x21]
	tst	w8, w1
	b.eq	LBB0_2
LBB0_5:
	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
LBB0_6:
	ldr	w8, [x19]
Lloh4:
	adrp	x9, _SO_LINGER@GOTPAGE
Lloh5:
	ldr	x9, [x9, _SO_LINGER@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_9
LBB0_8:
Lloh7:
	adrp	x8, _SCTP_FREE_SHOULD_USE_ABORT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SCTP_FREE_SHOULD_USE_ABORT@GOTPAGEOFF]
	ldr	x9, [x19, #24]
Lloh9:
	adrp	x10, _SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE@GOTPAGE
Lloh10:
	ldr	x10, [x10, _SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE@GOTPAGEOFF]
	cmp	x9, #0
	csel	x8, x8, x10, gt
	b	LBB0_10
LBB0_9:
Lloh11:
	adrp	x8, _SCTP_FREE_SHOULD_USE_ABORT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SCTP_FREE_SHOULD_USE_ABORT@GOTPAGEOFF]
LBB0_10:
	ldr	w1, [x8]
Lloh13:
	adrp	x8, _SCTP_CALLED_AFTER_CMPSET_OFCLOSE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SCTP_CALLED_AFTER_CMPSET_OFCLOSE@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_sctp_inpcb_free
	mov	x0, x19
	bl	_SOCK_LOCK
	ldr	x0, [x19, #32]
	bl	_SCTP_SB_CLEAR
	ldr	x0, [x19, #24]
	bl	_SCTP_SB_CLEAR
	str	xzr, [x19, #16]
	mov	x0, x19
	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
	b	_SOCK_UNLOCK
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_SCTP_PCB_FLAGS_SOCKET_GONE,4,2 ; @SCTP_PCB_FLAGS_SOCKET_GONE
	.comm	_SCTP_PCB_FLAGS_CLOSE_IP,4,2    ; @SCTP_PCB_FLAGS_CLOSE_IP
	.comm	_SO_LINGER,4,2                  ; @SO_LINGER
	.comm	_SCTP_FREE_SHOULD_USE_ABORT,4,2 ; @SCTP_FREE_SHOULD_USE_ABORT
	.comm	_SCTP_CALLED_AFTER_CMPSET_OFCLOSE,4,2 ; @SCTP_CALLED_AFTER_CMPSET_OFCLOSE
	.comm	_SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE,4,2 ; @SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE
.subsections_via_symbols
