	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	cmpl	$2, %edi
	je	LBB0_2
## %bb.1:
	movq	_EX_USAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
LBB0_2:
	movq	8(%rbx), %r15
	xorl	%eax, %eax
	callq	_pmc_init
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
LBB0_4:
	movq	_PMC_MODE_SC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %r8
	movq	%r15, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	$65536, %r9d                    ## imm = 0x10000
	callq	_pmc_allocate
	testq	%rax, %rax
	jns	LBB0_6
## %bb.5:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_6:
	xorl	%eax, %eax
	callq	_rdtsc
	movl	-44(%rbp), %edi
	xorl	%esi, %esi
	callq	_pmc_write
	testq	%rax, %rax
	jns	LBB0_8
## %bb.7:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_8:
	xorl	%eax, %eax
	callq	_rdtsc
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %edi
	callq	_pmc_start
	testq	%rax, %rax
	jns	LBB0_10
## %bb.9:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_10:
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, %r13
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %edi
	leaq	-52(%rbp), %rsi
	callq	_pmc_read
	testq	%rax, %rax
	jns	LBB0_12
## %bb.11:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_12:
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, %r14
	movl	-44(%rbp), %edi
	callq	_pmc_stop
	testq	%rax, %rax
	jns	LBB0_14
## %bb.13:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.6(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_14:
	xorl	%eax, %eax
	callq	_rdtsc
	movq	%rax, %r12
	movl	-44(%rbp), %edi
	leaq	-48(%rbp), %rdx
	xorl	%esi, %esi
	callq	_pmc_rw
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.7(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_16:
	movl	-44(%rbp), %edi
	callq	_pmc_release
	testq	%rax, %rax
	jns	LBB0_18
## %bb.17:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.8(%rip), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_18:
	subq	%r14, %r12
	subq	-64(%rbp), %rbx                 ## 8-byte Folded Reload
	subq	-72(%rbp), %r13                 ## 8-byte Folded Reload
	movslq	-52(%rbp), %rdx
	movslq	-48(%rbp), %rcx
	leaq	L_.str.9(%rip), %rdi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	_printf
	leaq	L_.str.10(%rip), %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	movq	%rbx, %rcx
	movq	%r12, %r8
	xorl	%eax, %eax
	callq	_printf
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EX_USAGE,4,2                   ## @EX_USAGE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"counter-name required"

	.comm	_EX_OSERR,4,2                   ## @EX_OSERR
L_.str.1:                               ## @.str.1
	.asciz	"hwpmc(4) not loaded, kldload or update your kernel"

	.comm	_PMC_MODE_SC,4,2                ## @PMC_MODE_SC
L_.str.2:                               ## @.str.2
	.asciz	"failed to allocate %s as a system counter in counting mode"

L_.str.3:                               ## @.str.3
	.asciz	"failed to zero counter %s"

L_.str.4:                               ## @.str.4
	.asciz	"failed to start counter %s"

L_.str.5:                               ## @.str.5
	.asciz	"failed to read counter %s"

L_.str.6:                               ## @.str.6
	.asciz	"failed to stop counter %s"

L_.str.7:                               ## @.str.7
	.asciz	"failed to read and zero %s"

L_.str.8:                               ## @.str.8
	.asciz	"failed to release %s as a system counter in counting mode"

L_.str.9:                               ## @.str.9
	.asciz	"Counter %s, read value %ld, read/clear value %ld\n"

L_.str.10:                              ## @.str.10
	.asciz	"Cycles to start: %ld\tstop: %ld\tread: %ld\twrite: %ld\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	cmp	w0, #2
	b.eq	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EX_USAGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EX_USAGE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_err
LBB0_2:
	ldr	x19, [x19, #8]
	bl	_pmc_init
Lloh5:
	adrp	x26, _EX_OSERR@GOTPAGE
Lloh6:
	ldr	x26, [x26, _EX_OSERR@GOTPAGEOFF]
	cbz	x0, LBB0_4
; %bb.3:
	ldr	w0, [x26]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_err
LBB0_4:
Lloh9:
	adrp	x8, _PMC_MODE_SC@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PMC_MODE_SC@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x4, sp, #28
	mov	x0, x19
	mov	w2, #0
	mov	w3, #0
	mov	w5, #65536
	bl	_pmc_allocate
	tbz	x0, #63, LBB0_6
; %bb.5:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_err
LBB0_6:
	bl	_rdtsc
	ldr	w0, [sp, #28]
	mov	w1, #0
	bl	_pmc_write
	tbz	x0, #63, LBB0_8
; %bb.7:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_err
LBB0_8:
	bl	_rdtsc
	bl	_rdtsc
	mov	x20, x0
	ldr	w0, [sp, #28]
	bl	_pmc_start
	tbz	x0, #63, LBB0_10
; %bb.9:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh16:
	adrp	x1, l_.str.4@PAGE
Lloh17:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_err
LBB0_10:
	bl	_rdtsc
	mov	x21, x0
	bl	_rdtsc
	mov	x22, x0
	ldr	w0, [sp, #28]
	add	x1, sp, #24
	bl	_pmc_read
	tbz	x0, #63, LBB0_12
; %bb.11:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh18:
	adrp	x1, l_.str.5@PAGE
Lloh19:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_err
LBB0_12:
	bl	_rdtsc
	mov	x23, x0
	bl	_rdtsc
	mov	x24, x0
	ldr	w0, [sp, #28]
	bl	_pmc_stop
	tbz	x0, #63, LBB0_14
; %bb.13:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh20:
	adrp	x1, l_.str.6@PAGE
Lloh21:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_err
LBB0_14:
	bl	_rdtsc
	mov	x25, x0
	ldr	w0, [sp, #28]
	add	x2, sp, #20
	mov	w1, #0
	bl	_pmc_rw
	cbz	x0, LBB0_16
; %bb.15:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh22:
	adrp	x1, l_.str.7@PAGE
Lloh23:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_err
LBB0_16:
	ldr	w0, [sp, #28]
	bl	_pmc_release
	tbz	x0, #63, LBB0_18
; %bb.17:
	ldr	w0, [x26]
	str	x19, [sp]
Lloh24:
	adrp	x1, l_.str.8@PAGE
Lloh25:
	add	x1, x1, l_.str.8@PAGEOFF
	bl	_err
LBB0_18:
	sub	x24, x25, x24
	sub	x22, x23, x22
	sub	x20, x21, x20
	ldpsw	x3, x2, [sp, #20]
Lloh26:
	adrp	x0, l_.str.9@PAGE
Lloh27:
	add	x0, x0, l_.str.9@PAGEOFF
	mov	x1, x19
	bl	_printf
	str	x24, [sp]
Lloh28:
	adrp	x0, l_.str.10@PAGE
Lloh29:
	add	x0, x0, l_.str.10@PAGEOFF
	mov	x1, x20
	mov	x2, x24
	mov	x3, x22
	bl	_printf
	mov	w0, #0
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_EX_USAGE,4,2                   ; @EX_USAGE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"counter-name required"

	.comm	_EX_OSERR,4,2                   ; @EX_OSERR
l_.str.1:                               ; @.str.1
	.asciz	"hwpmc(4) not loaded, kldload or update your kernel"

	.comm	_PMC_MODE_SC,4,2                ; @PMC_MODE_SC
l_.str.2:                               ; @.str.2
	.asciz	"failed to allocate %s as a system counter in counting mode"

l_.str.3:                               ; @.str.3
	.asciz	"failed to zero counter %s"

l_.str.4:                               ; @.str.4
	.asciz	"failed to start counter %s"

l_.str.5:                               ; @.str.5
	.asciz	"failed to read counter %s"

l_.str.6:                               ; @.str.6
	.asciz	"failed to stop counter %s"

l_.str.7:                               ; @.str.7
	.asciz	"failed to read and zero %s"

l_.str.8:                               ; @.str.8
	.asciz	"failed to release %s as a system counter in counting mode"

l_.str.9:                               ; @.str.9
	.asciz	"Counter %s, read value %ld, read/clear value %ld\n"

l_.str.10:                              ; @.str.10
	.asciz	"Cycles to start: %ld\tstop: %ld\tread: %ld\twrite: %ld\n"

.subsections_via_symbols
