	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ng_l2cap_get_cid
_ng_l2cap_get_cid:                      ## @ng_l2cap_get_cid
	.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
	xorl	%ecx, %ecx
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	testl	%esi, %esi
	movq	_NG_L2CAP_L2CA_IDTYPE_LE@GOTPCREL(%rip), %rax
	cmoveq	_NG_L2CAP_L2CA_IDTYPE_BREDR@GOTPCREL(%rip), %rax
	movq	_NG_L2CAP_LELAST_CID@GOTPCREL(%rip), %rdx
	cmoveq	_NG_L2CAP_LAST_CID@GOTPCREL(%rip), %rdx
	sete	%cl
	movl	(%rdx), %r13d
	movl	(%rdi,%rcx,4), %r14d
	leal	1(%r14), %ebx
	andl	%r13d, %ebx
	movq	_NG_L2CAP_FIRST_CID@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %ebx
	cmovlel	%ecx, %ebx
	cmpl	%r14d, %ebx
	je	LBB0_7
## %bb.1:
	movq	%rdi, %r15
	movl	(%rax), %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_ng_l2cap_chan_by_scid
	testq	%rax, %rax
	je	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	incl	%ebx
	andl	%r13d, %ebx
	movq	_NG_L2CAP_FIRST_CID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ebx
	cmovlel	%eax, %ebx
	cmpl	%r14d, %ebx
	jne	LBB0_2
LBB0_7:
	movq	_NG_L2CAP_NULL_CID@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_4
## %bb.5:
	movl	%ebx, (%r15)
	jmp	LBB0_8
LBB0_4:
	movl	%ebx, 4(%r15)
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_NG_L2CAP_LELAST_CID,4,2        ## @NG_L2CAP_LELAST_CID
	.comm	_NG_L2CAP_L2CA_IDTYPE_LE,4,2    ## @NG_L2CAP_L2CA_IDTYPE_LE
	.comm	_NG_L2CAP_LAST_CID,4,2          ## @NG_L2CAP_LAST_CID
	.comm	_NG_L2CAP_L2CA_IDTYPE_BREDR,4,2 ## @NG_L2CAP_L2CA_IDTYPE_BREDR
	.comm	_NG_L2CAP_FIRST_CID,4,2         ## @NG_L2CAP_FIRST_CID
	.comm	_NG_L2CAP_NULL_CID,4,2          ## @NG_L2CAP_NULL_CID
	.no_dead_strip	_ng_l2cap_get_cid
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ng_l2cap_get_cid
_ng_l2cap_get_cid:                      ; @ng_l2cap_get_cid
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cmp	w1, #0
Lloh0:
	adrp	x8, _NG_L2CAP_L2CA_IDTYPE_BREDR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NG_L2CAP_L2CA_IDTYPE_BREDR@GOTPAGEOFF]
Lloh2:
	adrp	x9, _NG_L2CAP_L2CA_IDTYPE_LE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _NG_L2CAP_L2CA_IDTYPE_LE@GOTPAGEOFF]
	cset	w10, eq
	csel	x8, x8, x9, eq
Lloh4:
	adrp	x9, _NG_L2CAP_LAST_CID@GOTPAGE
Lloh5:
	ldr	x9, [x9, _NG_L2CAP_LAST_CID@GOTPAGEOFF]
Lloh6:
	adrp	x11, _NG_L2CAP_LELAST_CID@GOTPAGE
Lloh7:
	ldr	x11, [x11, _NG_L2CAP_LELAST_CID@GOTPAGEOFF]
	csel	x9, x9, x11, eq
	ldr	w23, [x9]
	ldr	w24, [x0, w10, uxtw #2]
	add	w9, w24, #1
	and	w9, w9, w23
Lloh8:
	adrp	x25, _NG_L2CAP_FIRST_CID@GOTPAGE
Lloh9:
	ldr	x25, [x25, _NG_L2CAP_FIRST_CID@GOTPAGEOFF]
	ldr	w10, [x25]
	cmp	w9, w10
	csel	w21, w9, w10, gt
	cmp	w21, w24
	b.eq	LBB0_4
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	ldr	w22, [x8]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_ng_l2cap_chan_by_scid
	cbz	x0, LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w8, w21, #1
	and	w8, w8, w23
	ldr	w9, [x25]
	cmp	w8, w9
	csel	w21, w8, w9, gt
	cmp	w21, w24
	b.ne	LBB0_2
LBB0_4:
Lloh10:
	adrp	x8, _NG_L2CAP_NULL_CID@GOTPAGE
Lloh11:
	ldr	x8, [x8, _NG_L2CAP_NULL_CID@GOTPAGEOFF]
Lloh12:
	ldr	w21, [x8]
LBB0_5:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_6:
	cbz	w20, LBB0_8
; %bb.7:
	str	w21, [x19]
	b	LBB0_5
LBB0_8:
	str	w21, [x19, #4]
	b	LBB0_5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_NG_L2CAP_LELAST_CID,4,2        ; @NG_L2CAP_LELAST_CID
	.comm	_NG_L2CAP_L2CA_IDTYPE_LE,4,2    ; @NG_L2CAP_L2CA_IDTYPE_LE
	.comm	_NG_L2CAP_LAST_CID,4,2          ; @NG_L2CAP_LAST_CID
	.comm	_NG_L2CAP_L2CA_IDTYPE_BREDR,4,2 ; @NG_L2CAP_L2CA_IDTYPE_BREDR
	.comm	_NG_L2CAP_FIRST_CID,4,2         ; @NG_L2CAP_FIRST_CID
	.comm	_NG_L2CAP_NULL_CID,4,2          ; @NG_L2CAP_NULL_CID
	.no_dead_strip	_ng_l2cap_get_cid
.subsections_via_symbols
