	.file	"extr_xtensa_perfmon_access.c_xtensa_perfmon_init.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	xtensa_perfmon_init
	.type	xtensa_perfmon_init, @function
xtensa_perfmon_init:
.LFB0:
	.cfi_startproc
	endbr64
	cmp	DWORD PTR ERI_PERFMON_MAX[rip], edi
	jg	.L2
	mov	eax, DWORD PTR ESP_ERR_INVALID_ARG[rip]
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	ebp, ecx
	movsx	rdi, edi
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	and	ebp, 1
	lea	rbx, 0[0+rdi*4]
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	ecx, DWORD PTR PMCTRL_MASK_SHIFT[rip]
	and	edx, DWORD PTR PMCTRL_MASK_MASK[rip]
	and	esi, DWORD PTR PMCTRL_SELECT_MASK[rip]
	mov	rdi, QWORD PTR ERI_PERFMON_PM0[rip]
	sal	edx, cl
	mov	ecx, DWORD PTR PMCTRL_KRNLCNT_SHIFT[rip]
	and	r8d, DWORD PTR PMCTRL_TRACELEVEL_MASK[rip]
	add	rdi, rbx
	sal	ebp, cl
	mov	ecx, DWORD PTR PMCTRL_SELECT_SHIFT[rip]
	or	ebp, edx
	sal	esi, cl
	mov	ecx, DWORD PTR PMCTRL_TRACELEVEL_SHIFT[rip]
	or	ebp, esi
	xor	esi, esi
	sal	r8d, cl
	or	ebp, r8d
	call	eri_write@PLT
	add	rbx, QWORD PTR ERI_PERFMON_PMCTRL0[rip]
	mov	esi, ebp
	mov	rdi, rbx
	call	eri_write@PLT
	mov	eax, DWORD PTR ESP_OK[rip]
	add	rsp, 8
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	xtensa_perfmon_init, .-xtensa_perfmon_init
	.comm	PMCTRL_TRACELEVEL_SHIFT,4,4
	.comm	PMCTRL_TRACELEVEL_MASK,4,4
	.comm	PMCTRL_SELECT_SHIFT,4,4
	.comm	PMCTRL_SELECT_MASK,4,4
	.comm	PMCTRL_MASK_SHIFT,4,4
	.comm	PMCTRL_MASK_MASK,4,4
	.comm	PMCTRL_KRNLCNT_SHIFT,4,4
	.comm	ESP_OK,4,4
	.comm	ESP_ERR_INVALID_ARG,4,4
	.comm	ERI_PERFMON_PMCTRL0,8,8
	.comm	ERI_PERFMON_PM0,8,8
	.comm	ERI_PERFMON_MAX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_xtensa_perfmon_access.c_xtensa_perfmon_init.c"
	.text
	.align	2
	.global	xtensa_perfmon_init
	.syntax unified
	.arm
	.fpu softvfp
	.type	xtensa_perfmon_init, %function
xtensa_perfmon_init:
	@ args = 4, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	ip, r0
	ldr	r0, .L8
	ldr	r0, [r0]
	cmp	r0, ip
	bgt	.L2
	ldr	r3, .L8+4
	ldr	r0, [r3]
	bx	lr
.L2:
	push	{r4, r5, r6, lr}
	ldr	lr, .L8+8
	ldr	r0, .L8+12
	ldr	lr, [lr]
	ldr	r4, [r0]
	and	r3, r3, #1
	ldr	r0, .L8+16
	lsl	r3, r3, lr
	ldr	lr, .L8+20
	ldr	r0, [r0]
	and	r2, r2, r4
	ldr	r4, [lr]
	ldr	lr, .L8+24
	orr	r3, r3, r2, lsl r0
	ldr	r0, .L8+28
	ldr	r2, .L8+32
	ldr	r5, [lr]
	and	r4, r4, r1
	ldr	lr, [r0]
	ldr	r0, [r2]
	ldr	r2, .L8+36
	orr	r4, r3, r4, lsl r5
	ldr	r3, [sp, #16]
	ldr	r2, [r2]
	and	r3, r3, lr
	add	r0, r0, ip, lsl #2
	mov	r1, #0
	orr	r4, r4, r3, lsl r2
	lsl	r5, ip, #2
	bl	eri_write
	ldr	r3, .L8+40
	mov	r1, r4
	ldr	r0, [r3]
	add	r0, r5, r0
	bl	eri_write
	ldr	r3, .L8+44
	ldr	r0, [r3]
	pop	{r4, r5, r6, pc}
.L9:
	.align	2
.L8:
	.word	ERI_PERFMON_MAX
	.word	ESP_ERR_INVALID_ARG
	.word	PMCTRL_KRNLCNT_SHIFT
	.word	PMCTRL_MASK_MASK
	.word	PMCTRL_MASK_SHIFT
	.word	PMCTRL_SELECT_MASK
	.word	PMCTRL_SELECT_SHIFT
	.word	PMCTRL_TRACELEVEL_MASK
	.word	ERI_PERFMON_PM0
	.word	PMCTRL_TRACELEVEL_SHIFT
	.word	ERI_PERFMON_PMCTRL0
	.word	ESP_OK
	.size	xtensa_perfmon_init, .-xtensa_perfmon_init
	.comm	PMCTRL_TRACELEVEL_SHIFT,4,4
	.comm	PMCTRL_TRACELEVEL_MASK,4,4
	.comm	PMCTRL_SELECT_SHIFT,4,4
	.comm	PMCTRL_SELECT_MASK,4,4
	.comm	PMCTRL_MASK_SHIFT,4,4
	.comm	PMCTRL_MASK_MASK,4,4
	.comm	PMCTRL_KRNLCNT_SHIFT,4,4
	.comm	ESP_OK,4,4
	.comm	ESP_ERR_INVALID_ARG,4,4
	.comm	ERI_PERFMON_PMCTRL0,4,4
	.comm	ERI_PERFMON_PM0,4,4
	.comm	ERI_PERFMON_MAX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
