	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function open_collection
_open_collection:                       ## @open_collection
	.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	(%rdi), %rax
	movq	_HID_COLLECTION_STACK_SIZE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rdi
LBB0_2:
	callq	_dbg_hid
	movl	$-1, %eax
	jmp	LBB0_10
LBB0_3:
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	24(%rdi), %rcx
	movl	(%rcx), %r12d
	movq	16(%rdi), %rcx
	movl	(%rcx), %edi
	cmpl	4(%rcx), %edi
	jne	LBB0_4
## %bb.5:
	shll	$5, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	%rax, %r15
	movq	16(%rbx), %rax
	movq	16(%rax), %rsi
	movl	4(%rax), %edx
	shll	$4, %edx
	movq	%r15, %rdi
	callq	_memcpy
	movq	16(%rbx), %rax
	movslq	4(%rax), %rdx
	movq	%rdx, %rdi
	shlq	$4, %rdi
	addq	%r15, %rdi
	shll	$4, %edx
	xorl	%esi, %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	movq	16(%rbx), %rax
	movq	16(%rax), %rdi
	callq	_kfree
	movq	16(%rbx), %rcx
	movq	%r15, 16(%rcx)
	shll	4(%rcx)
	movl	(%rcx), %edi
	movq	(%rbx), %rax
	jmp	LBB0_8
LBB0_4:
	movq	16(%rcx), %r15
LBB0_8:
	movq	8(%rbx), %rdx
	leaq	1(%rax), %rsi
	movq	%rsi, (%rbx)
	movl	%edi, (%rdx,%rax,4)
	movslq	(%rcx), %rdx
	leal	1(%rdx), %esi
	movl	%esi, (%rcx)
	shlq	$4, %rdx
	movl	%r14d, (%r15,%rdx)
	movl	%r12d, 4(%r15,%rdx)
	movq	%rax, 8(%r15,%rdx)
	movq	_HID_COLLECTION_APPLICATION@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	cmpl	%r14d, (%rdx)
	jne	LBB0_10
## %bb.9:
	incl	8(%rcx)
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_HID_COLLECTION_STACK_SIZE,8,3  ## @HID_COLLECTION_STACK_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"collection stack overflow\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.1:                               ## @.str.1
	.asciz	"failed to reallocate collection array\n"

	.comm	_HID_COLLECTION_APPLICATION,4,2 ## @HID_COLLECTION_APPLICATION
	.no_dead_strip	_open_collection
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function open_collection
_open_collection:                       ; @open_collection
	.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
	ldr	x9, [x0]
Lloh0:
	adrp	x8, _HID_COLLECTION_STACK_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HID_COLLECTION_STACK_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x9, x8
	b.ne	LBB0_3
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
LBB0_2:
	bl	_dbg_hid
	mov	w0, #-1
	b	LBB0_10
LBB0_3:
	mov	x19, x1
	mov	x20, x0
	ldp	x8, x10, [x0, #16]
	ldr	w22, [x10]
	ldp	w10, w11, [x8]
	cmp	w10, w11
	b.ne	LBB0_6
; %bb.4:
	lsl	w0, w10, #5
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_11
; %bb.5:
	mov	x21, x0
	ldr	x8, [x20, #16]
	ldr	x1, [x8, #16]
	ldr	w8, [x8, #4]
	lsl	w2, w8, #4
	bl	_memcpy
	ldr	x8, [x20, #16]
	ldrsw	x8, [x8, #4]
	add	x0, x21, x8, lsl #4
	lsl	w2, w8, #4
	mov	w1, #0
	bl	_memset
	ldr	x8, [x20, #16]
	ldr	x0, [x8, #16]
	bl	_kfree
	ldr	x8, [x20, #16]
	str	x21, [x8, #16]
	ldp	w10, w9, [x8]
	lsl	w9, w9, #1
	str	w9, [x8, #4]
	ldr	x9, [x20]
	b	LBB0_7
LBB0_6:
	ldr	x21, [x8, #16]
LBB0_7:
	ldr	x11, [x20, #8]
	add	x12, x9, #1
	str	w10, [x11, x9, lsl #2]
	str	x12, [x20]
	ldrsw	x10, [x8]
	add	w11, w10, #1
	str	w11, [x8]
	add	x10, x21, x10, lsl #4
	stp	w19, w22, [x10]
	str	x9, [x10, #8]
Lloh8:
	adrp	x9, _HID_COLLECTION_APPLICATION@GOTPAGE
Lloh9:
	ldr	x9, [x9, _HID_COLLECTION_APPLICATION@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w9, w19
	b.ne	LBB0_9
; %bb.8:
	mov	w0, #0
	ldr	w9, [x8, #8]
	add	w9, w9, #1
	str	w9, [x8, #8]
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	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_11:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_HID_COLLECTION_STACK_SIZE,8,3  ; @HID_COLLECTION_STACK_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"collection stack overflow\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.1:                               ; @.str.1
	.asciz	"failed to reallocate collection array\n"

	.comm	_HID_COLLECTION_APPLICATION,4,2 ; @HID_COLLECTION_APPLICATION
	.no_dead_strip	_open_collection
.subsections_via_symbols
