	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_enclosure_add_device           ## -- Begin function enclosure_add_device
	.p2align	4, 0x90
_enclosure_add_device:                  ## @enclosure_add_device
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	cmpl	%esi, (%rdi)
	jle	LBB0_2
## %bb.4:
	movq	%rdx, %rbx
	movq	8(%rdi), %rax
	movslq	%esi, %rdx
	movq	(%rax,%rdx,8), %rcx
	cmpq	%rbx, %rcx
	je	LBB0_5
## %bb.6:
	leaq	(%rax,%rdx,8), %r14
	testq	%rcx, %rcx
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	callq	_enclosure_remove_links
	movq	(%r14), %rdi
	callq	_put_device
LBB0_8:
	movq	%rbx, %rdi
	callq	_get_device
	movq	%rax, (%r14)
	movq	%r14, %rdi
	callq	_enclosure_add_links
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movl	%eax, %ebx
	movq	(%r14), %rdi
	callq	_put_device
	movq	$0, (%r14)
	jmp	LBB0_11
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_5:
	movq	_EEXIST@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_9:
	xorl	%ebx, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EEXIST,4,2                     ## @EEXIST
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_enclosure_add_device           ; -- Begin function enclosure_add_device
	.p2align	2
_enclosure_add_device:                  ; @enclosure_add_device
	.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_7
; %bb.1:
	ldr	w8, [x0]
	cmp	w8, w1
	b.le	LBB0_7
; %bb.2:
	mov	x20, x2
	ldr	x8, [x0, #8]
	add	x19, x8, w1, sxtw #3
	ldr	x8, [x19]
	cmp	x8, x2
	b.eq	LBB0_10
; %bb.3:
	cbz	x8, LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_enclosure_remove_links
	ldr	x0, [x19]
	bl	_put_device
LBB0_5:
	mov	x0, x20
	bl	_get_device
	str	x0, [x19]
	mov	x0, x19
	bl	_enclosure_add_links
	mov	x20, x0
	cbz	w0, LBB0_9
; %bb.6:
	ldr	x0, [x19]
	bl	_put_device
	str	xzr, [x19]
	b	LBB0_9
LBB0_7:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_10:
Lloh2:
	adrp	x8, _EEXIST@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EEXIST@GOTPAGEOFF]
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EEXIST,4,2                     ; @EEXIST
.subsections_via_symbols
