	.file	"extr_perfmon.c_perfmon_stop.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	perfmon_stop
	.type	perfmon_stop, @function
perfmon_stop:
.LFB0:
	.cfi_startproc
	endbr64
	test	edi, edi
	js	.L8
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	ebp, edi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	cmp	DWORD PTR NPMC[rip], edi
	mov	eax, DWORD PTR EINVAL[rip]
	jle	.L1
	mov	ecx, DWORD PTR perfmon_inuse[rip]
	mov	eax, DWORD PTR EBUSY[rip]
	bt	ecx, edi
	jc	.L12
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	xor	eax, eax
	call	intr_disable@PLT
	mov	rdx, QWORD PTR msr_pmc[rip]
	mov	r13, QWORD PTR pmc_shadow[rip]
	mov	r12d, eax
	movsx	rax, ebp
	mov	edi, DWORD PTR [rdx+rax*4]
	lea	rbx, 0[0+rax*4]
	add	r13, rbx
	call	rdmsr@PLT
	add	rbx, QWORD PTR ctl_shadow[rip]
	mov	edi, ebp
	mov	DWORD PTR 0[r13], eax
	mov	eax, DWORD PTR PMCF_EN[rip]
	sal	eax, 16
	not	eax
	and	DWORD PTR [rbx], eax
	call	writectl@PLT
	mov	edi, r12d
	call	intr_restore@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	mov	eax, DWORD PTR EINVAL[rip]
	ret
	.cfi_endproc
.LFE0:
	.size	perfmon_stop, .-perfmon_stop
	.comm	pmc_shadow,8,8
	.comm	perfmon_inuse,4,4
	.comm	msr_pmc,8,8
	.comm	ctl_shadow,8,8
	.comm	PMCF_EN,4,4
	.comm	NPMC,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,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_perfmon.c_perfmon_stop.c"
	.text
	.align	2
	.global	perfmon_stop
	.syntax unified
	.arm
	.fpu softvfp
	.type	perfmon_stop, %function
perfmon_stop:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	subs	r4, r0, #0
	blt	.L2
	ldr	r3, .L9
	ldr	r3, [r3]
	cmp	r3, r4
	ble	.L2
	ldr	r3, .L9+4
	ldr	r3, [r3]
	asr	r3, r3, r4
	tst	r3, #1
	bne	.L8
	ldr	r3, .L9+8
	ldr	r0, [r3]
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r3, .L9+12
	ldr	r0, [r3]
	pop	{r4, r5, r6, pc}
.L8:
	bl	intr_disable
	ldr	r2, .L9+16
	ldr	r3, .L9+20
	ldr	r2, [r2]
	mov	r5, r0
	ldr	r0, [r2, r4, lsl #2]
	ldr	r6, [r3]
	bl	rdmsr
	ldr	r2, .L9+24
	ldr	r3, .L9+28
	ldr	r2, [r2]
	str	r0, [r6, r4, lsl #2]
	ldr	r1, [r3]
	ldr	r3, [r2, r4, lsl #2]
	mov	r0, r4
	bic	r3, r3, r1, lsl #16
	str	r3, [r2, r4, lsl #2]
	bl	writectl
	mov	r0, r5
	bl	intr_restore
	mov	r0, #0
	pop	{r4, r5, r6, pc}
.L10:
	.align	2
.L9:
	.word	NPMC
	.word	perfmon_inuse
	.word	EBUSY
	.word	EINVAL
	.word	msr_pmc
	.word	pmc_shadow
	.word	ctl_shadow
	.word	PMCF_EN
	.size	perfmon_stop, .-perfmon_stop
	.comm	pmc_shadow,4,4
	.comm	perfmon_inuse,4,4
	.comm	msr_pmc,4,4
	.comm	ctl_shadow,4,4
	.comm	PMCF_EN,4,4
	.comm	NPMC,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
