	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qib_assign_ctxt
_qib_assign_ctxt:                       ## @qib_assign_ctxt
	.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	%rsi, %r14
	movq	%rdi, %r12
	movq	_QIB_PORT_ALG_ACROSS@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	callq	_ctxt_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	_QIB_USER_SWMAJOR@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jne	LBB0_4
## %bb.5:
	movzwl	%ax, %r13d
	cmpl	$11, %r13d
	jb	LBB0_7
## %bb.6:
	movl	4(%r14), %eax
	movq	_QIB_PORT_ALG_COUNT@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	cmovbl	%eax, %r15d
LBB0_7:
	movq	_qib_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movl	%ebx, %edi
	movl	%r13d, %esi
	callq	_qib_compatible_subctxts
	testq	%rax, %rax
	je	LBB0_12
## %bb.8:
	cmpq	$0, 8(%r14)
	je	LBB0_12
## %bb.9:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_find_shared_ctxt
	testl	%eax, %eax
	jle	LBB0_12
## %bb.10:
	movq	%r12, %rdi
	callq	_do_qib_user_sdma_queue_create
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_24
## %bb.11:
	movq	%r12, %rdi
	callq	_ctxt_fp
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_assign_ctxt_affinity
	xorl	%ebx, %ebx
	jmp	LBB0_24
LBB0_4:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_25:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	%r12, %rdi
	callq	_file_inode
	movl	%eax, %edi
	callq	_iminor
	movq	_QIB_USER_MINOR_BASE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	jne	LBB0_13
## %bb.14:
	movq	_current@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movl	4(%rax), %edi
	callq	_cpumask_first
	movl	%eax, %r13d
	movq	(%rbx), %rax
	cmpl	$1, (%rax)
	jne	LBB0_20
## %bb.15:
	movq	_qib_cpulist@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_test_bit
	testl	%eax, %eax
	je	LBB0_16
LBB0_20:
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_get_a_ctxt
	jmp	LBB0_21
LBB0_13:
	notl	%ecx
	addl	%ecx, %eax
	movl	%eax, %edi
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	_find_free_ctxt
LBB0_21:
	movl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_24
LBB0_23:
	movq	%r12, %rdi
	callq	_do_qib_user_sdma_queue_create
	movl	%eax, %ebx
LBB0_24:
	movq	_qib_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	jmp	LBB0_25
LBB0_16:
	leaq	-44(%rbp), %rsi
	movl	%r13d, %edi
	callq	_find_hca
	testl	%eax, %eax
	jne	LBB0_20
## %bb.17:
	movl	-44(%rbp), %edi
	testl	%edi, %edi
	js	LBB0_20
## %bb.18:
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	_find_free_ctxt
	testl	%eax, %eax
	jne	LBB0_20
## %bb.19:
	xorl	%ebx, %ebx
	testl	%ebx, %ebx
	jne	LBB0_24
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.comm	_QIB_PORT_ALG_ACROSS,4,2        ## @QIB_PORT_ALG_ACROSS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_QIB_USER_SWMAJOR,4,2           ## @QIB_USER_SWMAJOR
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_QIB_PORT_ALG_COUNT,4,2         ## @QIB_PORT_ALG_COUNT
	.comm	_qib_mutex,4,2                  ## @qib_mutex
	.comm	_QIB_USER_MINOR_BASE,4,2        ## @QIB_USER_MINOR_BASE
	.comm	_current,8,3                    ## @current
	.comm	_qib_cpulist,4,2                ## @qib_cpulist
	.no_dead_strip	_qib_assign_ctxt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qib_assign_ctxt
_qib_assign_ctxt:                       ; @qib_assign_ctxt
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _QIB_PORT_ALG_ACROSS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _QIB_PORT_ALG_ACROSS@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
	bl	_ctxt_fp
	cbz	x0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_11
LBB0_2:
	ldr	w8, [x20]
	asr	w22, w8, #16
Lloh5:
	adrp	x9, _QIB_USER_SWMAJOR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _QIB_USER_SWMAJOR@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	cmp	w22, w9
	b.ne	LBB0_10
; %bb.3:
	and	w23, w8, #0xffff
	cmp	w23, #11
	b.lo	LBB0_5
; %bb.4:
	ldr	w8, [x20, #4]
Lloh8:
	adrp	x9, _QIB_PORT_ALG_COUNT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _QIB_PORT_ALG_COUNT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w9
	csel	w21, w8, w21, lo
LBB0_5:
Lloh11:
	adrp	x0, _qib_mutex@GOTPAGE
Lloh12:
	ldr	x0, [x0, _qib_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	mov	x0, x22
	mov	x1, x23
	bl	_qib_compatible_subctxts
	cbz	x0, LBB0_13
; %bb.6:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_13
; %bb.7:
	mov	x0, x19
	mov	x1, x20
	bl	_find_shared_ctxt
	cmp	w0, #1
	b.lt	LBB0_13
; %bb.8:
	mov	x0, x19
	bl	_do_qib_user_sdma_queue_create
	mov	x20, x0
	cbnz	w0, LBB0_20
; %bb.9:
	mov	x0, x19
	bl	_ctxt_fp
	ldr	w1, [x0]
	mov	x0, x19
	bl	_assign_ctxt_affinity
	b	LBB0_20
LBB0_10:
Lloh13:
	adrp	x8, _ENODEV@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_12:
	mov	x0, x20
	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_13:
	mov	x0, x19
	bl	_file_inode
	bl	_iminor
Lloh15:
	adrp	x8, _QIB_USER_MINOR_BASE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _QIB_USER_MINOR_BASE@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_17
; %bb.14:
Lloh18:
	adrp	x23, _current@GOTPAGE
Lloh19:
	ldr	x23, [x23, _current@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	w0, [x8, #4]
	bl	_cpumask_first
	ldr	x8, [x23]
	ldr	w8, [x8]
	cmp	w8, #1
	b.ne	LBB0_16
; %bb.15:
	mov	x22, x0
Lloh20:
	adrp	x8, _qib_cpulist@GOTPAGE
Lloh21:
	ldr	x8, [x8, _qib_cpulist@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	bl	_test_bit
	cbz	w0, LBB0_21
LBB0_16:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_get_a_ctxt
	b	LBB0_18
LBB0_17:
	mvn	w8, w8
	add	w0, w0, w8
	mov	x1, x19
	mov	x2, x20
	bl	_find_free_ctxt
LBB0_18:
	mov	x20, x0
	cbnz	w20, LBB0_20
LBB0_19:
	mov	x0, x19
	bl	_do_qib_user_sdma_queue_create
	mov	x20, x0
LBB0_20:
Lloh23:
	adrp	x0, _qib_mutex@GOTPAGE
Lloh24:
	ldr	x0, [x0, _qib_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	b	LBB0_12
LBB0_21:
	add	x1, sp, #12
	mov	x0, x22
	bl	_find_hca
	cbnz	w0, LBB0_16
; %bb.22:
	ldr	w0, [sp, #12]
	tbnz	w0, #31, LBB0_16
; %bb.23:
	mov	x1, x19
	mov	x2, x20
	bl	_find_free_ctxt
	cbnz	w0, LBB0_16
; %bb.24:
	mov	w20, #0
	cbnz	w20, LBB0_20
	b	LBB0_19
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_QIB_PORT_ALG_ACROSS,4,2        ; @QIB_PORT_ALG_ACROSS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_QIB_USER_SWMAJOR,4,2           ; @QIB_USER_SWMAJOR
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_QIB_PORT_ALG_COUNT,4,2         ; @QIB_PORT_ALG_COUNT
	.comm	_qib_mutex,4,2                  ; @qib_mutex
	.comm	_QIB_USER_MINOR_BASE,4,2        ; @QIB_USER_MINOR_BASE
	.comm	_current,8,3                    ; @current
	.comm	_qib_cpulist,4,2                ; @qib_cpulist
	.no_dead_strip	_qib_assign_ctxt
.subsections_via_symbols
