	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ddr_perf_event_add
_ddr_perf_event_add:                    ## @ddr_perf_event_add
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movl	16(%rdi), %edi
	callq	_to_ddr_pmu
	movq	%rax, %rbx
	movl	(%r15), %r12d
	movq	32(%rax), %rax
	movq	_DDR_CAP_AXI_ID_FILTER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_9
## %bb.1:
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movl	4(%r15), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_NUM_COUNTERS@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	cmpl	$2, %eax
	jl	LBB0_7
## %bb.2:
	movl	$1, %r13d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%r13
	movslq	%eax, %rcx
	cmpq	%rcx, %r13
	jge	LBB0_7
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %rcx
	movq	(%rcx,%r13,8), %rsi
	testq	%rsi, %rsi
	je	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	callq	_ddr_perf_filters_compatible
	testl	%eax, %eax
	je	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r14), %eax
	jmp	LBB0_6
LBB0_7:
	movq	%r15, %rdi
	callq	_ddr_perf_is_filtered
	testq	%rax, %rax
	movl	-48(%rbp), %r14d                ## 4-byte Reload
	je	LBB0_9
## %bb.8:
	movq	_AXI_MASKING_REVERT@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	xorl	(%rax), %edi
	movq	_COUNTER_DPCR1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%rbx), %rsi
	callq	_writel
LBB0_9:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_ddr_perf_alloc_counter
	testl	%eax, %eax
	js	LBB0_10
## %bb.13:
	movq	8(%rbx), %rcx
	movl	%eax, %edx
	movq	%r15, (%rcx,%rdx,8)
	incl	(%rbx)
	movl	%eax, 8(%r15)
	movq	_PERF_HES_STOPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 12(%r15)
	movq	_PERF_EF_START@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	testl	%r14d, (%rax)
	je	LBB0_15
## %bb.14:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_ddr_perf_event_start
	jmp	LBB0_15
LBB0_10:
	movl	16(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_11:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_12:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DDR_CAP_AXI_ID_FILTER,4,2      ## @DDR_CAP_AXI_ID_FILTER
	.comm	_NUM_COUNTERS,4,2               ## @NUM_COUNTERS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AXI_MASKING_REVERT,4,2         ## @AXI_MASKING_REVERT
	.comm	_COUNTER_DPCR1,8,3              ## @COUNTER_DPCR1
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"There are not enough counters\n"

	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_PERF_HES_STOPPED,4,2           ## @PERF_HES_STOPPED
	.comm	_PERF_EF_START,4,2              ## @PERF_EF_START
	.no_dead_strip	_ddr_perf_event_add
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ddr_perf_event_add
_ddr_perf_event_add:                    ; @ddr_perf_event_add
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x0
	ldr	w0, [x0, #16]
	bl	_to_ddr_pmu
	mov	x21, x0
	ldr	w22, [x20]
	ldr	x8, [x0, #32]
	ldr	w8, [x8]
Lloh0:
	adrp	x9, _DDR_CAP_AXI_ID_FILTER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DDR_CAP_AXI_ID_FILTER@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.1:
	ldr	w23, [x20, #4]
Lloh3:
	adrp	x24, _NUM_COUNTERS@GOTPAGE
Lloh4:
	ldr	x24, [x24, _NUM_COUNTERS@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #2
	b.lt	LBB0_7
; %bb.2:
	mov	w25, #1
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x25, x25, #1
	cmp	x25, w8, sxtw
	b.ge	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x21, #8]
	ldr	x1, [x9, x25, lsl #3]
	cbz	x1, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_ddr_perf_filters_compatible
	cbz	w0, LBB0_14
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x24]
	b	LBB0_3
LBB0_7:
	mov	x0, x20
	bl	_ddr_perf_is_filtered
	cbz	x0, LBB0_9
; %bb.8:
Lloh5:
	adrp	x8, _AXI_MASKING_REVERT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AXI_MASKING_REVERT@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	eor	w0, w8, w23
	ldr	x8, [x21, #24]
Lloh8:
	adrp	x9, _COUNTER_DPCR1@GOTPAGE
Lloh9:
	ldr	x9, [x9, _COUNTER_DPCR1@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
LBB0_9:
	mov	x0, x21
	mov	x1, x22
	bl	_ddr_perf_alloc_counter
	tbnz	w0, #31, LBB0_13
; %bb.10:
	ldr	x8, [x21, #8]
	str	x20, [x8, w0, uxtw #3]
	ldr	w8, [x21]
	add	w8, w8, #1
	str	w8, [x21]
Lloh11:
	adrp	x8, _PERF_HES_STOPPED@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PERF_HES_STOPPED@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ldr	w9, [x20, #12]
	orr	w8, w9, w8
	stp	w0, w8, [x20, #8]
Lloh14:
	adrp	x8, _PERF_EF_START@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PERF_EF_START@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	tst	w8, w19
	b.eq	LBB0_12
; %bb.11:
	mov	x0, x20
	mov	x1, x19
	bl	_ddr_perf_event_start
LBB0_12:
	mov	w0, #0
	b	LBB0_16
LBB0_13:
	ldr	w0, [x21, #16]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
Lloh19:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
	b	LBB0_15
LBB0_14:
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_16:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_DDR_CAP_AXI_ID_FILTER,4,2      ; @DDR_CAP_AXI_ID_FILTER
	.comm	_NUM_COUNTERS,4,2               ; @NUM_COUNTERS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AXI_MASKING_REVERT,4,2         ; @AXI_MASKING_REVERT
	.comm	_COUNTER_DPCR1,8,3              ; @COUNTER_DPCR1
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"There are not enough counters\n"

	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_PERF_HES_STOPPED,4,2           ; @PERF_HES_STOPPED
	.comm	_PERF_EF_START,4,2              ; @PERF_EF_START
	.no_dead_strip	_ddr_perf_event_add
.subsections_via_symbols
