	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ipath_assign_port
_ipath_assign_port:                     ## @ipath_assign_port
	.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	%rsi, %r14
	movq	%rdi, %r15
	callq	_port_fp
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_3:
	movl	(%r14), %eax
	movl	%eax, %ebx
	sarl	$16, %ebx
	movq	_IPATH_USER_SWMAJOR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	cmpl	%edx, %ebx
	jne	LBB0_4
## %bb.5:
	movzwl	%ax, %r12d
	movq	_IPATH_USER_SWMINOR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	cmpl	%edx, %r12d
	je	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	callq	_ipath_dbg
LBB0_7:
	movq	_ipath_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_ipath_compatible_subports
	testq	%rax, %rax
	je	LBB0_11
## %bb.8:
	cmpq	$0, 8(%r14)
	je	LBB0_11
## %bb.9:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_find_shared_port
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %ebx
	sarl	$31, %ebx
	andl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_17
	jmp	LBB0_16
LBB0_4:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_ipath_dbg
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	8(%r15), %rax
	movq	(%rax), %rdi
	callq	_iminor
	movl	%eax, %ebx
	movq	_IPATH_USER_MINOR_BASE@GOTPCREL(%rip), %rax
	movq	_VERBOSE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	8(%r15), %rcx
	movq	(%rcx), %rcx
	movq	(%rcx), %rdx
	movl	(%rax), %r12d
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %ecx
	subl	%r12d, %ecx
	callq	_ipath_cdbg
	subl	%r12d, %ebx
	jne	LBB0_12
## %bb.13:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_find_best_unit
	jmp	LBB0_14
LBB0_12:
	decl	%ebx
	movl	%ebx, %edi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_find_free_port
LBB0_14:
	movl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_17
LBB0_16:
	movq	(%r15), %rbx
	movq	8(%rbx), %rax
	movq	8(%rax), %rcx
	movq	8(%rcx), %rdi
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movl	4(%rbx), %ecx
	callq	_ipath_user_sdma_queue_create
	movl	%eax, (%rbx)
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	subl	(%rcx), %ebx
	xorl	%ecx, %ecx
	testl	%eax, %eax
	cmovnel	%ecx, %ebx
LBB0_17:
	movq	_ipath_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IPATH_USER_SWMAJOR,4,2         ## @IPATH_USER_SWMAJOR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"User major version %d not same as driver major %d\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_IPATH_USER_SWMINOR,4,2         ## @IPATH_USER_SWMINOR
L_.str.1:                               ## @.str.1
	.asciz	"User minor version %d not same as driver minor %d\n"

	.comm	_ipath_mutex,4,2                ## @ipath_mutex
	.comm	_IPATH_USER_MINOR_BASE,4,2      ## @IPATH_USER_MINOR_BASE
	.comm	_VERBOSE,4,2                    ## @VERBOSE
L_.str.2:                               ## @.str.2
	.asciz	"open on dev %lx (minor %d)\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_ipath_assign_port
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ipath_assign_port
_ipath_assign_port:                     ; @ipath_assign_port
	.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
	mov	x20, x1
	mov	x19, x0
	bl	_port_fp
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_10
LBB0_2:
	ldr	w8, [x20]
	asr	w21, w8, #16
Lloh2:
	adrp	x9, _IPATH_USER_SWMAJOR@GOTPAGE
Lloh3:
	ldr	x9, [x9, _IPATH_USER_SWMAJOR@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x9]
	cmp	w21, w2
	b.ne	LBB0_9
; %bb.3:
	and	w22, w8, #0xffff
Lloh5:
	adrp	x8, _IPATH_USER_SWMINOR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IPATH_USER_SWMINOR@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	cmp	w22, w2
	b.eq	LBB0_5
; %bb.4:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x22
	bl	_ipath_dbg
LBB0_5:
Lloh10:
	adrp	x0, _ipath_mutex@GOTPAGE
Lloh11:
	ldr	x0, [x0, _ipath_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	mov	x0, x21
	mov	x1, x22
	bl	_ipath_compatible_subports
	cbz	x0, LBB0_12
; %bb.6:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_12
; %bb.7:
	mov	x0, x19
	mov	x1, x20
	bl	_find_shared_port
	cbz	w0, LBB0_12
; %bb.8:
	cmp	w0, #0
	csel	w20, w0, wzr, lt
	cbnz	w20, LBB0_17
	b	LBB0_16
LBB0_9:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_ipath_dbg
Lloh14:
	adrp	x8, _ENODEV@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_11:
	mov	x0, x20
	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_12:
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	bl	_iminor
	mov	x21, x0
Lloh16:
	adrp	x8, _IPATH_USER_MINOR_BASE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _IPATH_USER_MINOR_BASE@GOTPAGEOFF]
Lloh18:
	ldr	w22, [x8]
	subs	w3, w0, w22
Lloh19:
	adrp	x8, _VERBOSE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _VERBOSE@GOTPAGEOFF]
Lloh21:
	ldr	w0, [x8]
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	x2, [x8]
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_ipath_cdbg
	subs	w8, w21, w22
	b.ne	LBB0_14
; %bb.13:
	mov	x0, x19
	mov	x1, x20
	bl	_find_best_unit
	b	LBB0_15
LBB0_14:
	sub	w0, w8, #1
	mov	x1, x19
	mov	x2, x20
	bl	_find_free_port
LBB0_15:
	mov	x20, x0
	cbnz	w20, LBB0_17
LBB0_16:
	ldr	x19, [x19]
	ldr	x8, [x19, #8]
	ldr	x9, [x8, #8]
	ldr	x0, [x9, #8]
	ldr	w1, [x9]
	ldr	w2, [x8]
	ldr	w3, [x19, #4]
	bl	_ipath_user_sdma_queue_create
	str	w0, [x19]
Lloh24:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w20, wzr, w8, ne
LBB0_17:
Lloh27:
	adrp	x0, _ipath_mutex@GOTPAGE
Lloh28:
	ldr	x0, [x0, _ipath_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	b	LBB0_11
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IPATH_USER_SWMAJOR,4,2         ; @IPATH_USER_SWMAJOR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"User major version %d not same as driver major %d\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_IPATH_USER_SWMINOR,4,2         ; @IPATH_USER_SWMINOR
l_.str.1:                               ; @.str.1
	.asciz	"User minor version %d not same as driver minor %d\n"

	.comm	_ipath_mutex,4,2                ; @ipath_mutex
	.comm	_IPATH_USER_MINOR_BASE,4,2      ; @IPATH_USER_MINOR_BASE
	.comm	_VERBOSE,4,2                    ; @VERBOSE
l_.str.2:                               ; @.str.2
	.asciz	"open on dev %lx (minor %d)\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_ipath_assign_port
.subsections_via_symbols
