	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_isdn_get_free_channel          ## -- Begin function isdn_get_free_channel
	.p2align	4, 0x90
_isdn_get_free_channel:                 ## @isdn_get_free_channel
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -72(%rbp)                  ## 8-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %ecx
	movl	$65536, %edx                    ## imm = 0x10000
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	movq	_ISDN_MAX_CHANNELS@GOTPCREL(%rip), %r15
	movl	$-1, %eax
	cmpl	$0, (%r15)
	jle	LBB0_19
## %bb.1:
	movl	%edi, -48(%rbp)                 ## 4-byte Spill
	btsl	%esi, %edx
	movq	_ISDN_FEATURE_L2_V11096@GOTPCREL(%rip), %rax
	movq	_ISDN_FEATURE_L2_V11019@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_ISDN_FEATURE_L2_V11038@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	notl	%ecx
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	andl	%edx, %ecx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	orl	%ebx, %r8d
	movl	%r8d, -56(%rbp)                 ## 4-byte Spill
	xorl	%r12d, %r12d
	movq	_dev@GOTPCREL(%rip), %r14
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	movslq	(%r15), %rax
	cmpq	%rax, %r12
	jge	LBB0_17
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movq	(%rax), %rax
	movl	(%rax,%r12,4), %edi
	callq	_USG_NONE
	testq	%rax, %rax
	je	LBB0_16
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rax
	movq	8(%rax), %rcx
	movslq	(%rcx,%r12,4), %r13
	cmpq	$-1, %r13
	je	LBB0_16
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rax), %rcx
	movq	_ISDN_USAGE_EXCLUSIVE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%rcx,%r12,4)
	je	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%ebx, %r13d
	jne	LBB0_16
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%rax), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, (%rax,%r12,4)
	jne	LBB0_16
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	callq	_isdn_map_eaz2msn
	movl	%eax, %edi
	leaq	L_.str(%rip), %rsi
	callq	_strcmp
	testl	%eax, %eax
	je	LBB0_16
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rdx
	movq	(%rdx), %rax
	movl	(%rax,%r12,4), %ecx
	movq	_ISDN_USAGE_DISABLED@GOTPCREL(%rip), %rsi
	testl	%ecx, (%rsi)
	jne	LBB0_16
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	24(%rdx), %rsi
	movq	(%rsi,%r13,8), %rsi
	movq	_DRV_FLAG_RUNNING@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	testl	%edi, (%rsi)
	je	LBB0_16
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%rsi), %rsi
	movl	(%rsi), %esi
	movl	%esi, %edi
	notl	%edi
	testl	%edi, -60(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	testl	%edi, -52(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_16
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_ISDN_FEATURE_L2_TRANS@GOTPCREL(%rip), %rdi
	testl	%esi, (%rdi)
	je	LBB0_16
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	js	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%ebx, %r13d
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%rdx), %rdx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	cmpl	%esi, (%rdx,%r12,4)
	jne	LBB0_16
LBB0_18:
	movq	_ISDN_USAGE_EXCLUSIVE@GOTPCREL(%rip), %rdx
	andl	(%rdx), %ecx
	orl	-48(%rbp), %ecx                 ## 4-byte Folded Reload
	movl	%ecx, (%rax,%r12,4)
	xorl	%eax, %eax
	callq	_isdn_info_update
	movl	%r12d, %eax
	jmp	LBB0_19
LBB0_17:
	movl	$-1, %eax
LBB0_19:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ISDN_FEATURE_L2_V11096,4,2     ## @ISDN_FEATURE_L2_V11096
	.comm	_ISDN_FEATURE_L2_V11019,4,2     ## @ISDN_FEATURE_L2_V11019
	.comm	_ISDN_FEATURE_L2_V11038,4,2     ## @ISDN_FEATURE_L2_V11038
	.comm	_ISDN_MAX_CHANNELS,4,2          ## @ISDN_MAX_CHANNELS
	.comm	_dev,8,3                        ## @dev
	.comm	_ISDN_USAGE_EXCLUSIVE,4,2       ## @ISDN_USAGE_EXCLUSIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"-"

	.comm	_ISDN_USAGE_DISABLED,4,2        ## @ISDN_USAGE_DISABLED
	.comm	_DRV_FLAG_RUNNING,4,2           ## @DRV_FLAG_RUNNING
	.comm	_ISDN_FEATURE_L2_TRANS,4,2      ## @ISDN_FEATURE_L2_TRANS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_isdn_get_free_channel          ; -- Begin function isdn_get_free_channel
	.p2align	2
_isdn_get_free_channel:                 ; @isdn_get_free_channel
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x26, _ISDN_MAX_CHANNELS@GOTPAGE
Lloh1:
	ldr	x26, [x26, _ISDN_MAX_CHANNELS@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.1:
	mov	x20, x5
	mov	x22, x4
	mov	x23, x3
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	mov	x19, #0
	mov	w8, #1
	lsl	w8, w8, w1
	mov	w9, #65536
	lsl	w9, w9, w2
Lloh2:
	adrp	x10, _ISDN_FEATURE_L2_V11096@GOTPAGE
Lloh3:
	ldr	x10, [x10, _ISDN_FEATURE_L2_V11096@GOTPAGEOFF]
	orr	w27, w9, w8
Lloh4:
	ldr	w8, [x10]
Lloh5:
	adrp	x9, _ISDN_FEATURE_L2_V11019@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ISDN_FEATURE_L2_V11019@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _ISDN_FEATURE_L2_V11038@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ISDN_FEATURE_L2_V11038@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w8, w8, w9
	bic	w8, w27, w8
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
	orr	w8, w4, w3
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
Lloh11:
	adrp	x21, _dev@GOTPAGE
Lloh12:
	ldr	x21, [x21, _dev@GOTPAGEOFF]
Lloh13:
	adrp	x28, _ISDN_USAGE_EXCLUSIVE@GOTPAGE
Lloh14:
	ldr	x28, [x28, _ISDN_USAGE_EXCLUSIVE@GOTPAGEOFF]
Lloh15:
	adrp	x24, l_.str@PAGE
Lloh16:
	add	x24, x24, l_.str@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x19, x19, #1
	ldrsw	x8, [x26]
	cmp	x19, x8
	b.ge	LBB0_18
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21]
	ldr	x8, [x8]
	ldr	w0, [x8, x19, lsl #2]
	bl	_USG_NONE
	cbz	x0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x21]
	ldr	x9, [x8, #8]
	ldrsw	x25, [x9, x19, lsl #2]
	cmn	w25, #1
	b.eq	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x9, [x8]
	ldr	w9, [x9, x19, lsl #2]
	ldr	w10, [x28]
	tst	w10, w9
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w25, w23
	b.ne	LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x8, #16]
	ldr	w8, [x8, x19, lsl #2]
	cmp	w8, w22
	b.ne	LBB0_2
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	x1, x25
	bl	_isdn_map_eaz2msn
	mov	x1, x24
	bl	_strcmp
	cbz	w0, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x10, [x21]
	ldr	x8, [x10]
	ldr	w9, [x8, x19, lsl #2]
Lloh17:
	adrp	x11, _ISDN_USAGE_DISABLED@GOTPAGE
Lloh18:
	ldr	x11, [x11, _ISDN_USAGE_DISABLED@GOTPAGEOFF]
Lloh19:
	ldr	w11, [x11]
	tst	w11, w9
	b.ne	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x11, [x10, #24]
	ldr	x11, [x11, x25, lsl #3]
	ldr	w12, [x11]
Lloh20:
	adrp	x13, _DRV_FLAG_RUNNING@GOTPAGE
Lloh21:
	ldr	x13, [x13, _DRV_FLAG_RUNNING@GOTPAGEOFF]
Lloh22:
	ldr	w13, [x13]
	tst	w13, w12
	b.eq	LBB0_2
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x11, [x11, #8]
	ldr	w11, [x11]
	bics	wzr, w27, w11
	b.eq	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	w12, [sp, #8]                   ; 4-byte Folded Reload
	bics	wzr, w12, w11
	b.ne	LBB0_2
; %bb.13:                               ;   in Loop: Header=BB0_3 Depth=1
Lloh23:
	adrp	x12, _ISDN_FEATURE_L2_TRANS@GOTPAGE
Lloh24:
	ldr	x12, [x12, _ISDN_FEATURE_L2_TRANS@GOTPAGEOFF]
Lloh25:
	ldr	w12, [x12]
	tst	w12, w11
	b.eq	LBB0_2
LBB0_14:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w11, [sp, #12]                  ; 4-byte Folded Reload
	tbnz	w11, #31, LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_3 Depth=1
	cmp	w25, w23
	b.ne	LBB0_2
; %bb.16:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x10, [x10, #16]
	ldr	w10, [x10, x19, lsl #2]
	cmp	w10, w22
	b.ne	LBB0_2
LBB0_17:
	ldr	w10, [x28]
	and	w9, w10, w9
	ldr	w10, [sp, #4]                   ; 4-byte Folded Reload
	orr	w9, w9, w10
	str	w9, [x8, x19, lsl #2]
	bl	_isdn_info_update
	b	LBB0_19
LBB0_18:
	mov	w19, #-1
LBB0_19:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_ISDN_FEATURE_L2_V11096,4,2     ; @ISDN_FEATURE_L2_V11096
	.comm	_ISDN_FEATURE_L2_V11019,4,2     ; @ISDN_FEATURE_L2_V11019
	.comm	_ISDN_FEATURE_L2_V11038,4,2     ; @ISDN_FEATURE_L2_V11038
	.comm	_ISDN_MAX_CHANNELS,4,2          ; @ISDN_MAX_CHANNELS
	.comm	_dev,8,3                        ; @dev
	.comm	_ISDN_USAGE_EXCLUSIVE,4,2       ; @ISDN_USAGE_EXCLUSIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"-"

	.comm	_ISDN_USAGE_DISABLED,4,2        ; @ISDN_USAGE_DISABLED
	.comm	_DRV_FLAG_RUNNING,4,2           ; @DRV_FLAG_RUNNING
	.comm	_ISDN_FEATURE_L2_TRANS,4,2      ; @ISDN_FEATURE_L2_TRANS
.subsections_via_symbols
