	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sdma_ahg_alloc                 ## -- Begin function sdma_ahg_alloc
	.p2align	4, 0x90
_sdma_ahg_alloc:                        ## @sdma_ahg_alloc
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.1:
	movq	%rdi, %r14
	movl	(%rdi), %edi
	callq	_READ_ONCE
	movl	%eax, %edi
	callq	_ffz
	cmpl	$31, %eax
	jg	LBB0_5
## %bb.2:
	movl	%eax, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	movq	%r14, %rsi
	callq	_test_and_set_bit
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	movl	(%r14), %edi
	callq	_READ_ONCE
	movl	%eax, %edi
	callq	_ffz
	movl	%eax, %ebx
	cmpl	$31, %eax
	jle	LBB0_3
LBB0_5:
	movq	_ENOSPC@GOTPCREL(%rip), %r15
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	subl	(%r15), %esi
	movq	%r14, %rdi
	callq	_trace_hfi1_ahg_allocate
	subl	(%r15), %ebx
	jmp	LBB0_8
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %r14
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	subl	(%r14), %esi
	xorl	%edi, %edi
	callq	_trace_hfi1_ahg_allocate
	subl	(%r14), %ebx
	jmp	LBB0_8
LBB0_7:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_trace_hfi1_ahg_allocate
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOSPC,4,2                     ## @ENOSPC
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sdma_ahg_alloc                 ; -- Begin function sdma_ahg_alloc
	.p2align	2
_sdma_ahg_alloc:                        ; @sdma_ahg_alloc
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
	ldr	w0, [x0]
	bl	_READ_ONCE
	bl	_ffz
	cmp	w0, #31
	b.gt	LBB0_5
; %bb.2:
	mov	x20, x0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_test_and_set_bit
	cbz	w0, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_cpu_relax
	ldr	w0, [x19]
	bl	_READ_ONCE
	bl	_ffz
	mov	x20, x0
	cmp	w0, #31
	b.le	LBB0_3
LBB0_5:
Lloh0:
	adrp	x20, _ENOSPC@GOTPAGE
Lloh1:
	ldr	x20, [x20, _ENOSPC@GOTPAGEOFF]
	ldr	w8, [x20]
	neg	w1, w8
	mov	x0, x19
	bl	_trace_hfi1_ahg_allocate
	ldr	w8, [x20]
	neg	w20, w8
	b	LBB0_8
LBB0_6:
Lloh2:
	adrp	x19, _EINVAL@GOTPAGE
Lloh3:
	ldr	x19, [x19, _EINVAL@GOTPAGEOFF]
	ldr	w8, [x19]
	neg	w1, w8
	bl	_trace_hfi1_ahg_allocate
	ldr	w8, [x19]
	neg	w20, w8
	b	LBB0_8
LBB0_7:
	mov	x0, x19
	mov	x1, x20
	bl	_trace_hfi1_ahg_allocate
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOSPC,4,2                     ; @ENOSPC
.subsections_via_symbols
