	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function x86_pkru_get_perm_hw
_x86_pkru_get_perm_hw:                  ## @x86_pkru_get_perm_hw
	.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	_MAX_PKRU_IDX@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$-1, %r12d
	jmp	LBB0_3
LBB0_2:
	movq	%rdx, %r14
	movq	%rsi, %r15
	movl	%edi, %ebx
	addl	%edi, %ebx
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_rdpkru
	xorl	%ecx, %ecx
	btl	%ebx, %eax
	setae	%cl
	movl	%ecx, (%r15)
	movl	%ebx, %ecx
	shrl	%cl, %eax
	xorl	%ecx, %ecx
	testb	$2, %al
	sete	%cl
	movl	%ecx, (%r14)
LBB0_3:
	movl	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PKRU_IDX,4,2               ## @MAX_PKRU_IDX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.no_dead_strip	_x86_pkru_get_perm_hw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function x86_pkru_get_perm_hw
_x86_pkru_get_perm_hw:                  ; @x86_pkru_get_perm_hw
	.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
Lloh0:
	adrp	x8, _MAX_PKRU_IDX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_PKRU_IDX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _errno@GOTPAGE
Lloh7:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh8:
	str	w8, [x9]
	mov	w0, #-1
	b	LBB0_3
LBB0_2:
	mov	x19, x2
	mov	x20, x1
	lsl	w21, w0, #1
	bl	_rdpkru
	mov	x8, x0
	mov	w0, #0
	mvn	w9, w8
	lsr	w9, w9, w21
	and	w9, w9, #0x1
	str	w9, [x20]
	lsr	w8, w8, w21
	tst	w8, #0x2
	cset	w8, eq
	str	w8, [x19]
LBB0_3:
	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 AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PKRU_IDX,4,2               ; @MAX_PKRU_IDX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.no_dead_strip	_x86_pkru_get_perm_hw
.subsections_via_symbols
