	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function open_bchannel
_open_bchannel:                         ## @open_bchannel
	.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
	movslq	16(%rsi), %rbx
	testq	%rbx, %rbx
	je	LBB0_2
## %bb.1:
	cmpl	$3, %ebx
	jge	LBB0_2
## %bb.4:
	movq	%rsi, %r14
	movq	(%rsi), %rax
	movq	_ISDN_P_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_3:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	(%rdi), %r15
	decq	%rbx
	movq	_FLG_OPEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shlq	$4, %rbx
	leaq	(%r15,%rbx), %rsi
	addq	$8, %rsi
	callq	_test_and_set_bit
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_7:
	movq	(%r14), %rax
	leaq	(%r15,%rbx), %rcx
	movq	%rax, (%r15,%rbx)
	movq	%rcx, 8(%r14)
	xorl	%eax, %eax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ISDN_P_NONE,8,3                ## @ISDN_P_NONE
	.comm	_FLG_OPEN,4,2                   ## @FLG_OPEN
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_open_bchannel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function open_bchannel
_open_bchannel:                         ; @open_bchannel
	.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	w8, [x1, #16]
	cmp	w8, #0
	ccmp	w8, #3, #0, ne
	b.ge	LBB0_2
; %bb.1:
	mov	x19, x1
	ldr	x9, [x1]
Lloh0:
	adrp	x10, _ISDN_P_NONE@GOTPAGE
Lloh1:
	ldr	x10, [x10, _ISDN_P_NONE@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_5
LBB0_2:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	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_5:
	ldr	x20, [x0]
	sub	w21, w8, #1
Lloh5:
	adrp	x8, _FLG_OPEN@GOTPAGE
Lloh6:
	ldr	x8, [x8, _FLG_OPEN@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	add	x8, x20, w21, sxtw #4
	add	x1, x8, #8
	bl	_test_and_set_bit
	cbz	x0, LBB0_7
; %bb.6:
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_3
LBB0_7:
	sxtw	x8, w21
	ldr	x9, [x19]
	add	x8, x20, x8, lsl #4
	str	x9, [x8]
	str	x8, [x19, #8]
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ISDN_P_NONE,8,3                ; @ISDN_P_NONE
	.comm	_FLG_OPEN,4,2                   ; @FLG_OPEN
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_open_bchannel
.subsections_via_symbols
