	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vcos_generic_blockpool_elem_to_handle ## -- Begin function vcos_generic_blockpool_elem_to_handle
	.p2align	4, 0x90
_vcos_generic_blockpool_elem_to_handle: ## @vcos_generic_blockpool_elem_to_handle
	.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	%rdi, %rbx
	callq	_vcos_assert
	movq	-8(%rbx), %r13
	addq	$-8, %rbx
	movq	%r13, %rdi
	callq	_ASSERT_SUBPOOL
	movq	16(%r13), %r15
	movq	%r15, %rdi
	callq	_ASSERT_POOL
	leaq	12(%r15), %r14
	movq	%r14, %rdi
	callq	_vcos_mutex_lock
	subq	8(%r13), %rbx
	movq	(%r15), %rcx
	movq	%rbx, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rax
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %r12
	jmp	LBB0_3
LBB0_1:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r12d
LBB0_3:
	xorl	%edi, %edi
	cmpl	%r12d, (%r13)
	setg	%dil
	callq	_vcos_assert
	subq	16(%r15), %r13
	movabsq	$-6148914691236517205, %rcx     ## imm = 0xAAAAAAAAAAAAAAAB
	movq	%r13, %rax
	mulq	%rcx
	movq	%rdx, %rbx
	shrq	$4, %rbx
	movq	_VCOS_BLOCKPOOL_MAX_SUBPOOLS@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	%ebx, (%rax)
	setg	%dil
	callq	_vcos_assert
	xorl	%edi, %edi
	cmpl	%ebx, 8(%r15)
	setg	%dil
	callq	_vcos_assert
	movl	%r12d, %edi
	movl	%ebx, %esi
	callq	_VCOS_BLOCKPOOL_HANDLE_CREATE
	movl	%eax, %r15d
	movq	_VCOS_FUNCTION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	movl	%r15d, %r8d
	callq	_vcos_log_trace
	movq	%r14, %rdi
	callq	_vcos_mutex_unlock
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VCOS_BLOCKPOOL_MAX_SUBPOOLS,4,2 ## @VCOS_BLOCKPOOL_MAX_SUBPOOLS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: index %d subpool_id %d handle 0x%08x"

	.comm	_VCOS_FUNCTION,4,2              ## @VCOS_FUNCTION
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vcos_generic_blockpool_elem_to_handle ; -- Begin function vcos_generic_blockpool_elem_to_handle
	.p2align	2
_vcos_generic_blockpool_elem_to_handle: ; @vcos_generic_blockpool_elem_to_handle
	.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	x19, x0
	bl	_vcos_assert
	ldr	x20, [x19, #-8]!
	mov	x0, x20
	bl	_ASSERT_SUBPOOL
	ldr	x21, [x20, #16]
	mov	x0, x21
	bl	_ASSERT_POOL
	add	x22, x21, #12
	mov	x0, x22
	bl	_vcos_mutex_lock
	ldr	x8, [x20, #8]
	sub	x8, x19, x8
	ldr	x9, [x21]
	udiv	x19, x8, x9
	ldr	w8, [x20]
	cmp	w8, w19
	cset	w0, gt
	bl	_vcos_assert
	ldr	x8, [x21, #16]
	sub	x8, x20, x8
	mov	x9, #-6148914691236517206
	movk	x9, #43691
	umulh	x8, x8, x9
	lsr	x20, x8, #4
Lloh0:
	adrp	x8, _VCOS_BLOCKPOOL_MAX_SUBPOOLS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VCOS_BLOCKPOOL_MAX_SUBPOOLS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w20
	cset	w0, gt
	bl	_vcos_assert
	ldr	w8, [x21, #8]
	cmp	w8, w20
	cset	w0, gt
	bl	_vcos_assert
	mov	x0, x19
	mov	x1, x20
	bl	_VCOS_BLOCKPOOL_HANDLE_CREATE
	mov	x21, x0
Lloh3:
	adrp	x8, _VCOS_FUNCTION@GOTPAGE
Lloh4:
	ldr	x8, [x8, _VCOS_FUNCTION@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x19
	mov	x3, x20
	mov	x4, x21
	bl	_vcos_log_trace
	mov	x0, x22
	bl	_vcos_mutex_unlock
	mov	x0, x21
	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
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_VCOS_BLOCKPOOL_MAX_SUBPOOLS,4,2 ; @VCOS_BLOCKPOOL_MAX_SUBPOOLS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: index %d subpool_id %d handle 0x%08x"

	.comm	_VCOS_FUNCTION,4,2              ; @VCOS_FUNCTION
.subsections_via_symbols
