	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apm_open
_apm_open:                              ## @apm_open
	.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	%rsi, %r14
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_lock_kernel
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_CAP_SYS_ADMIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_capable
	movl	%eax, 12(%rbx)
	movl	(%r14), %eax
	movq	_FMODE_WRITE@GOTPCREL(%rip), %rcx
	notl	%eax
	xorl	%edx, %edx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	sete	%dl
	movl	%edx, (%rbx)
	movq	_FMODE_READ@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	andl	(%rcx), %eax
	sete	%dl
	movl	%edx, 4(%rbx)
	movq	_user_list_lock@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_down_write
	leaq	8(%rbx), %rdi
	movq	_apm_user_list@GOTPCREL(%rip), %rsi
	callq	_list_add
	movq	%r15, %rdi
	callq	_up_write
	movq	%rbx, 8(%r14)
LBB0_2:
	xorl	%eax, %eax
	callq	_unlock_kernel
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	testq	%rbx, %rbx
	cmovnel	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_CAP_SYS_ADMIN,4,2              ## @CAP_SYS_ADMIN
	.comm	_FMODE_WRITE,4,2                ## @FMODE_WRITE
	.comm	_FMODE_READ,4,2                 ## @FMODE_READ
	.comm	_user_list_lock,4,2             ## @user_list_lock
	.comm	_apm_user_list,4,2              ## @apm_user_list
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_apm_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apm_open
_apm_open:                              ; @apm_open
	.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, x1
	bl	_lock_kernel
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	mov	x20, x0
	cbz	x0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _CAP_SYS_ADMIN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CAP_SYS_ADMIN@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_capable
	str	w0, [x20, #12]
	ldr	w8, [x19]
Lloh6:
	adrp	x9, _FMODE_WRITE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _FMODE_WRITE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	bics	wzr, w9, w8
	cset	w9, eq
	str	w9, [x20]
Lloh9:
	adrp	x9, _FMODE_READ@GOTPAGE
Lloh10:
	ldr	x9, [x9, _FMODE_READ@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	bics	wzr, w9, w8
	cset	w8, eq
	str	w8, [x20, #4]
Lloh12:
	adrp	x21, _user_list_lock@GOTPAGE
Lloh13:
	ldr	x21, [x21, _user_list_lock@GOTPAGEOFF]
	mov	x0, x21
	bl	_down_write
	add	x0, x20, #8
Lloh14:
	adrp	x1, _apm_user_list@GOTPAGE
Lloh15:
	ldr	x1, [x1, _apm_user_list@GOTPAGEOFF]
	bl	_list_add
	mov	x0, x21
	bl	_up_write
	str	x20, [x19, #8]
LBB0_2:
	bl	_unlock_kernel
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmp	x20, #0
	csneg	w0, wzr, w8, ne
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_CAP_SYS_ADMIN,4,2              ; @CAP_SYS_ADMIN
	.comm	_FMODE_WRITE,4,2                ; @FMODE_WRITE
	.comm	_FMODE_READ,4,2                 ; @FMODE_READ
	.comm	_user_list_lock,4,2             ; @user_list_lock
	.comm	_apm_user_list,4,2              ; @apm_user_list
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_apm_open
.subsections_via_symbols
