	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vc4_perfmon_create_ioctl       ## -- Begin function vc4_perfmon_create_ioctl
	.p2align	4, 0x90
_vc4_perfmon_create_ioctl:              ## @vc4_perfmon_create_ioctl
	.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
	movq	%rdx, %rbx
	movq	%rsi, %r12
	callq	_to_vc4_dev
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movl	(%r12), %edx
	movq	_DRM_VC4_MAX_PERF_COUNTERS@GOTPCREL(%rip), %rax
	leal	-1(%rdx), %ecx
	cmpl	(%rax), %ecx
	jae	LBB0_4
## %bb.3:
	movq	(%rbx), %r14
	movq	8(%r12), %rax
	movq	_VC4_PERFCNT_NUM_EVENTS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rcx, (%rax,%rsi,8)
	jge	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_7 Depth=1
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_7
## %bb.8:
	movq	_counters@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_struct_size
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movl	%eax, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_28
## %bb.9:
	movq	%rax, %r15
	movl	(%r12), %r8d
	testq	%r8, %r8
	je	LBB0_24
## %bb.10:
	movq	8(%r12), %rcx
	movq	(%r15), %rdx
	xorl	%esi, %esi
	cmpl	$4, %r8d
	jb	LBB0_20
## %bb.11:
	movq	%rdx, %rax
	subq	%rcx, %rax
	cmpq	$32, %rax
	jb	LBB0_20
## %bb.12:
	movl	%r8d, %esi
	andl	$-4, %esi
	leaq	-4(%rsi), %rax
	movq	%rax, %rdi
	shrq	$2, %rdi
	incq	%rdi
	movl	%edi, %r9d
	andl	$3, %r9d
	cmpq	$12, %rax
	jae	LBB0_14
## %bb.13:
	xorl	%eax, %eax
	jmp	LBB0_16
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_27:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_28:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_14:
	andq	$-4, %rdi
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movups	(%rcx,%rax,8), %xmm0
	movups	16(%rcx,%rax,8), %xmm1
	movups	%xmm0, (%rdx,%rax,8)
	movups	%xmm1, 16(%rdx,%rax,8)
	movups	32(%rcx,%rax,8), %xmm0
	movups	48(%rcx,%rax,8), %xmm1
	movups	%xmm0, 32(%rdx,%rax,8)
	movups	%xmm1, 48(%rdx,%rax,8)
	movups	64(%rcx,%rax,8), %xmm0
	movups	80(%rcx,%rax,8), %xmm1
	movups	%xmm0, 64(%rdx,%rax,8)
	movups	%xmm1, 80(%rdx,%rax,8)
	movups	96(%rcx,%rax,8), %xmm0
	movups	112(%rcx,%rax,8), %xmm1
	movups	%xmm0, 96(%rdx,%rax,8)
	movups	%xmm1, 112(%rdx,%rax,8)
	addq	$16, %rax
	addq	$-4, %rdi
	jne	LBB0_15
LBB0_16:
	testq	%r9, %r9
	je	LBB0_19
## %bb.17:
	leaq	(%rdx,%rax,8), %rdi
	addq	$16, %rdi
	leaq	(%rcx,%rax,8), %rax
	addq	$16, %rax
	shlq	$5, %r9
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movups	-16(%rax,%rbx), %xmm0
	movups	(%rax,%rbx), %xmm1
	movups	%xmm0, -16(%rdi,%rbx)
	movups	%xmm1, (%rdi,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %r9
	jne	LBB0_18
LBB0_19:
	cmpq	%r8, %rsi
	je	LBB0_24
LBB0_20:
	movq	%rsi, %rax
	notq	%rax
	addq	%r8, %rax
	movq	%r8, %rdi
	andq	$3, %rdi
	je	LBB0_22
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rcx,%rsi,8), %rbx
	movq	%rbx, (%rdx,%rsi,8)
	incq	%rsi
	decq	%rdi
	jne	LBB0_21
LBB0_22:
	cmpq	$3, %rax
	jb	LBB0_24
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rcx,%rsi,8), %rax
	movq	%rax, (%rdx,%rsi,8)
	movq	8(%rcx,%rsi,8), %rax
	movq	%rax, 8(%rdx,%rsi,8)
	movq	16(%rcx,%rsi,8), %rax
	movq	%rax, 16(%rdx,%rsi,8)
	movq	24(%rcx,%rsi,8), %rax
	movq	%rax, 24(%rdx,%rsi,8)
	addq	$4, %rsi
	cmpq	%rsi, %r8
	jne	LBB0_23
LBB0_24:
	movl	%r8d, 8(%r15)
	movq	%r15, %rdi
	addq	$12, %rdi
	movl	$1, %esi
	callq	_refcount_set
	movq	%r14, %rdi
	callq	_mutex_lock
	leaq	4(%r14), %rdi
	movq	_VC4_PERFMONID_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_VC4_PERFMONID_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	(%r13), %r8d
	movq	%r15, %rsi
	callq	_idr_alloc
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	testl	%ebx, %ebx
	js	LBB0_25
## %bb.26:
	movl	%ebx, 16(%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_27
LBB0_25:
	movq	%r15, %rdi
	callq	_kfree
	jmp	LBB0_27
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Creating perfmon no VC4 V3D probed\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_DRM_VC4_MAX_PERF_COUNTERS,4,2  ## @DRM_VC4_MAX_PERF_COUNTERS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_VC4_PERFCNT_NUM_EVENTS,8,3     ## @VC4_PERFCNT_NUM_EVENTS
	.comm	_counters,4,2                   ## @counters
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_VC4_PERFMONID_MIN,4,2          ## @VC4_PERFMONID_MIN
	.comm	_VC4_PERFMONID_MAX,4,2          ## @VC4_PERFMONID_MAX
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vc4_perfmon_create_ioctl       ; -- Begin function vc4_perfmon_create_ioctl
	.p2align	2
_vc4_perfmon_create_ioctl:              ; @vc4_perfmon_create_ioctl
	.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
	mov	x20, x2
	mov	x19, x1
	bl	_to_vc4_dev
	ldr	w8, [x0]
	cbz	w8, LBB0_17
; %bb.1:
	ldr	w2, [x19]
Lloh0:
	adrp	x8, _DRM_VC4_MAX_PERF_COUNTERS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DRM_VC4_MAX_PERF_COUNTERS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w9, w2, #1
	cmp	w9, w8
	b.hs	LBB0_16
; %bb.2:
	ldr	x20, [x20]
	ldr	x8, [x19, #8]
Lloh3:
	adrp	x9, _VC4_PERFCNT_NUM_EVENTS@GOTPAGE
Lloh4:
	ldr	x9, [x9, _VC4_PERFCNT_NUM_EVENTS@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	mov	x10, x2
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x8]
	cmp	x11, x9
	b.ge	LBB0_16
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x8, x8, #8
	subs	x10, x10, #1
	b.ne	LBB0_3
; %bb.5:
Lloh6:
	adrp	x8, _counters@GOTPAGE
Lloh7:
	ldr	x8, [x8, _counters@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_struct_size
Lloh9:
	adrp	x22, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x22, [x22, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_kzalloc
	cbz	x0, LBB0_20
; %bb.6:
	mov	x21, x0
	ldr	w8, [x19]
	cbz	w8, LBB0_14
; %bb.7:
	mov	x9, #0
	ldr	x11, [x19, #8]
	ldr	x10, [x21]
	cmp	w8, #8
	b.lo	LBB0_12
; %bb.8:
	sub	x12, x10, x11
	cmp	x12, #64
	b.lo	LBB0_12
; %bb.9:
	and	x9, x8, #0xfffffff8
	add	x12, x10, #32
	add	x13, x11, #32
	mov	x14, x9
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x13, #-32]
	ldp	q2, q3, [x13], #64
	stp	q0, q1, [x12, #-32]
	stp	q2, q3, [x12], #64
	subs	x14, x14, #8
	b.ne	LBB0_10
; %bb.11:
	cmp	x9, x8
	b.eq	LBB0_14
LBB0_12:
	lsl	x12, x9, #3
	add	x11, x11, x12
	add	x10, x10, x12
	sub	x9, x8, x9
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x11], #8
	str	x12, [x10], #8
	subs	x9, x9, #1
	b.ne	LBB0_13
LBB0_14:
	str	w8, [x21, #8]
	add	x0, x21, #12
	mov	w1, #1
	bl	_refcount_set
	mov	x0, x20
	bl	_mutex_lock
Lloh11:
	adrp	x8, _VC4_PERFMONID_MIN@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VC4_PERFMONID_MIN@GOTPAGEOFF]
	add	x0, x20, #4
Lloh13:
	ldr	w2, [x8]
Lloh14:
	adrp	x8, _VC4_PERFMONID_MAX@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VC4_PERFMONID_MAX@GOTPAGEOFF]
Lloh16:
	ldr	w3, [x8]
	ldr	w4, [x22]
	mov	x1, x21
	bl	_idr_alloc
	mov	x22, x0
	mov	x0, x20
	bl	_mutex_unlock
	tbnz	w22, #31, LBB0_21
; %bb.15:
	str	w22, [x19, #16]
	mov	w22, #0
	b	LBB0_19
LBB0_16:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_18
LBB0_17:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
Lloh21:
	adrp	x8, _ENODEV@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_18:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_19:
	mov	x0, x22
	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
LBB0_20:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_18
LBB0_21:
	mov	x0, x21
	bl	_kfree
	b	LBB0_19
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Creating perfmon no VC4 V3D probed\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_DRM_VC4_MAX_PERF_COUNTERS,4,2  ; @DRM_VC4_MAX_PERF_COUNTERS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_VC4_PERFCNT_NUM_EVENTS,8,3     ; @VC4_PERFCNT_NUM_EVENTS
	.comm	_counters,4,2                   ; @counters
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_VC4_PERFMONID_MIN,4,2          ; @VC4_PERFMONID_MIN
	.comm	_VC4_PERFMONID_MAX,4,2          ; @VC4_PERFMONID_MAX
.subsections_via_symbols
