	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ngfrm_newhook
_ngfrm_newhook:                         ## @ngfrm_newhook
	.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	%rdx, %r12
	movq	%rsi, %r14
	callq	_NG_NODE_PRIVATE
	movq	%rax, %r15
	movq	_NG_FRAMERELAY_HOOK_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	movq	_NG_FRAMERELAY_HOOK_DLCI@GOTPCREL(%rip), %r13
	movl	(%r13), %ebx
	movl	%ebx, %edi
	callq	_strlen
	movq	%r12, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_strncmp
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	_NG_FRAMERELAY_HOOK_DOWNSTREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_strcmp
	testq	%rax, %rax
	jne	LBB0_15
## %bb.3:
	cmpq	$0, 24(%r15)
	je	LBB0_18
LBB0_4:
	movq	_EADDRINUSE@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_5:
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_NG_HOOK_SET_PRIVATE
	jmp	LBB0_17
LBB0_6:
	movl	(%r13), %edi
	callq	_strlen
	movslq	%eax, %rbx
	movsbl	(%r12,%rbx), %edi
	callq	_isdigit
	testl	%eax, %eax
	je	LBB0_15
## %bb.7:
	addq	%rbx, %r12
	cmpb	$48, (%r12)
	jne	LBB0_9
## %bb.8:
	cmpb	$0, 1(%r12)
	jne	LBB0_15
LBB0_9:
	leaq	-48(%rbp), %rsi
	movq	%r12, %rdi
	movl	$10, %edx
	callq	_strtoul
	movq	-48(%rbp), %rcx
	cmpb	$0, (%rcx)
	jne	LBB0_15
## %bb.10:
	testl	%eax, %eax
	js	LBB0_15
## %bb.11:
	cmpl	$1024, %eax                     ## imm = 0x400
	jge	LBB0_15
## %bb.12:
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_ngfrm_allocate_CTX
	cmpl	$-1, %eax
	je	LBB0_20
## %bb.13:
	movq	8(%r15), %rsi
	cltq
	leaq	(%rax,%rax,2), %rcx
	cmpq	$0, 8(%rsi,%rcx,8)
	jne	LBB0_4
## %bb.14:
	movq	_CHAN_ACTIVE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	shlq	$3, %rax
	leaq	(%rax,%rax,2), %rbx
	orl	%ecx, 16(%rsi,%rbx)
	addq	%rbx, %rsi
	movq	%r14, %rdi
	callq	_NG_HOOK_SET_PRIVATE
	movq	8(%r15), %rax
	movq	%r14, 8(%rax,%rbx)
	jmp	LBB0_19
LBB0_15:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_16:
	movl	(%rax), %ebx
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movq	%r15, %rsi
	addq	$16, %rsi
	movq	%r14, %rdi
	callq	_NG_HOOK_SET_PRIVATE
	movq	%r14, 24(%r15)
	movl	$-1, 16(%r15)
	movq	_CHAN_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 32(%r15)
LBB0_19:
	incl	(%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_17
LBB0_20:
	movq	_ENOBUFS@GOTPCREL(%rip), %rax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_NG_FRAMERELAY_HOOK_DEBUG,4,2   ## @NG_FRAMERELAY_HOOK_DEBUG
	.comm	_NG_FRAMERELAY_HOOK_DLCI,4,2    ## @NG_FRAMERELAY_HOOK_DLCI
	.comm	_NG_FRAMERELAY_HOOK_DOWNSTREAM,4,2 ## @NG_FRAMERELAY_HOOK_DOWNSTREAM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EADDRINUSE,4,2                 ## @EADDRINUSE
	.comm	_CHAN_ACTIVE,4,2                ## @CHAN_ACTIVE
	.comm	_ENOBUFS,4,2                    ## @ENOBUFS
	.no_dead_strip	_ngfrm_newhook
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ngfrm_newhook
_ngfrm_newhook:                         ; @ngfrm_newhook
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x21, x2
	mov	x20, x1
	bl	_NG_NODE_PRIVATE
	mov	x19, x0
Lloh0:
	adrp	x8, _NG_FRAMERELAY_HOOK_DEBUG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NG_FRAMERELAY_HOOK_DEBUG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_strcmp
	cbz	x0, LBB0_5
; %bb.1:
Lloh3:
	adrp	x23, _NG_FRAMERELAY_HOOK_DLCI@GOTPAGE
Lloh4:
	ldr	x23, [x23, _NG_FRAMERELAY_HOOK_DLCI@GOTPAGEOFF]
	ldr	w22, [x23]
	mov	x0, x22
	bl	_strlen
	mov	x2, x0
	mov	x0, x21
	mov	x1, x22
	bl	_strncmp
	cbz	x0, LBB0_6
; %bb.2:
Lloh5:
	adrp	x8, _NG_FRAMERELAY_HOOK_DOWNSTREAM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NG_FRAMERELAY_HOOK_DOWNSTREAM@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_strcmp
	cbnz	x0, LBB0_15
; %bb.3:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_18
LBB0_4:
Lloh8:
	adrp	x8, _EADDRINUSE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EADDRINUSE@GOTPAGEOFF]
	b	LBB0_16
LBB0_5:
	mov	x0, x20
	mov	x1, #0
	bl	_NG_HOOK_SET_PRIVATE
	mov	w0, #0
	b	LBB0_17
LBB0_6:
	ldr	w0, [x23]
	bl	_strlen
	add	x21, x21, w0, sxtw
	ldrsb	w0, [x21]
	bl	_isdigit
	cbz	w0, LBB0_15
; %bb.7:
	ldrb	w8, [x21]
	cmp	w8, #48
	b.ne	LBB0_9
; %bb.8:
	ldrb	w8, [x21, #1]
	cbnz	w8, LBB0_15
LBB0_9:
	add	x1, sp, #8
	mov	x0, x21
	mov	w2, #10
	bl	_strtoul
	ldr	x8, [sp, #8]
	ldrb	w8, [x8]
	cbnz	w8, LBB0_15
; %bb.10:
	mov	x1, x0
	tbnz	w1, #31, LBB0_15
; %bb.11:
	cmp	w1, #1024
	b.ge	LBB0_15
; %bb.12:
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_ngfrm_allocate_CTX
                                        ; kill: def $w0 killed $w0 def $x0
	cmn	w0, #1
	b.eq	LBB0_20
; %bb.13:
	ldr	x8, [x19, #8]
	mov	w9, #24
	smaddl	x9, w0, w9, x8
	ldr	x9, [x9, #8]
	cbnz	x9, LBB0_4
; %bb.14:
	sxtw	x9, w0
Lloh10:
	adrp	x10, _CHAN_ACTIVE@GOTPAGE
Lloh11:
	ldr	x10, [x10, _CHAN_ACTIVE@GOTPAGEOFF]
Lloh12:
	ldr	w10, [x10]
	add	x9, x9, x9, lsl #1
	lsl	x21, x9, #3
	add	x1, x8, x21
	ldr	w8, [x1, #16]
	orr	w8, w8, w10
	str	w8, [x1, #16]
	mov	x0, x20
	bl	_NG_HOOK_SET_PRIVATE
	mov	w0, #0
	ldr	x8, [x19, #8]
	add	x8, x8, x21
	str	x20, [x8, #8]
	b	LBB0_19
LBB0_15:
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_16:
	ldr	w0, [x8]
LBB0_17:
	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
	add	sp, sp, #80
	ret
LBB0_18:
	add	x1, x19, #16
	mov	x0, x20
	bl	_NG_HOOK_SET_PRIVATE
	mov	w0, #0
	str	x20, [x19, #24]
	mov	w8, #-1
	str	w8, [x19, #16]
Lloh15:
	adrp	x8, _CHAN_ACTIVE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _CHAN_ACTIVE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	w9, [x19, #32]
	orr	w8, w9, w8
	str	w8, [x19, #32]
LBB0_19:
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	b	LBB0_17
LBB0_20:
Lloh18:
	adrp	x8, _ENOBUFS@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOBUFS@GOTPAGEOFF]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_NG_FRAMERELAY_HOOK_DEBUG,4,2   ; @NG_FRAMERELAY_HOOK_DEBUG
	.comm	_NG_FRAMERELAY_HOOK_DLCI,4,2    ; @NG_FRAMERELAY_HOOK_DLCI
	.comm	_NG_FRAMERELAY_HOOK_DOWNSTREAM,4,2 ; @NG_FRAMERELAY_HOOK_DOWNSTREAM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EADDRINUSE,4,2                 ; @EADDRINUSE
	.comm	_CHAN_ACTIVE,4,2                ; @CHAN_ACTIVE
	.comm	_ENOBUFS,4,2                    ; @ENOBUFS
	.no_dead_strip	_ngfrm_newhook
.subsections_via_symbols
