	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_ctx_query2
_amdgpu_ctx_query2:                     ## @amdgpu_ctx_query2
	.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
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	%rcx, %r14
	movl	%edx, %ebx
	movq	%rsi, %r12
	movq	%rdi, %r15
	movq	%rsi, %rdi
	callq	_mutex_lock
	leaq	4(%r12), %rdi
	movl	%ebx, %esi
	callq	_idr_find
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %rbx
	movq	$0, (%r14)
	movq	(%rax), %r13
	leaq	4(%r15), %rdi
	callq	_atomic_read
	cmpq	%rax, %r13
	je	LBB0_6
## %bb.5:
	movq	_AMDGPU_CTX_QUERY2_FLAGS_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r14)
LBB0_6:
	movq	8(%rbx), %r13
	movq	%r15, %rdi
	callq	_atomic_read
	cmpq	%rax, %r13
	je	LBB0_8
## %bb.7:
	movq	_AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r14)
LBB0_8:
	movq	%rbx, %rdi
	addq	$32, %rdi
	callq	_atomic_read
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movq	_AMDGPU_CTX_QUERY2_FLAGS_GUILTY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r14)
LBB0_10:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_amdgpu_ras_query_error_count
	cmpq	16(%rbx), %rax
	je	LBB0_12
## %bb.11:
	movq	_AMDGPU_CTX_QUERY2_FLAGS_RAS_UE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, (%r14)
	movq	%rax, 16(%rbx)
LBB0_12:
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_amdgpu_ras_query_error_count
	cmpq	24(%rbx), %rax
	je	LBB0_14
## %bb.13:
	movq	_AMDGPU_CTX_QUERY2_FLAGS_RAS_CE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, (%r14)
	movq	%rax, 24(%rbx)
LBB0_14:
	movq	%r12, %rdi
	callq	_mutex_unlock
	xorl	%eax, %eax
	jmp	LBB0_15
LBB0_3:
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RESET,4,2 ## @AMDGPU_CTX_QUERY2_FLAGS_RESET
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST,4,2 ## @AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_GUILTY,4,2 ## @AMDGPU_CTX_QUERY2_FLAGS_GUILTY
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RAS_UE,4,2 ## @AMDGPU_CTX_QUERY2_FLAGS_RAS_UE
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RAS_CE,4,2 ## @AMDGPU_CTX_QUERY2_FLAGS_RAS_CE
	.no_dead_strip	_amdgpu_ctx_query2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_ctx_query2
_amdgpu_ctx_query2:                     ; @amdgpu_ctx_query2
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	cbz	x1, LBB0_14
; %bb.1:
	mov	x20, x3
	mov	x21, x2
	mov	x19, x1
	mov	x22, x0
	mov	x0, x1
	bl	_mutex_lock
	add	x0, x19, #4
	mov	x1, x21
	bl	_idr_find
	cbz	x0, LBB0_13
; %bb.2:
	mov	x21, x0
	str	xzr, [x20]
	ldr	x23, [x0]
	add	x0, x22, #4
	bl	_atomic_read
	cmp	x23, x0
	b.eq	LBB0_4
; %bb.3:
Lloh0:
	adrp	x8, _AMDGPU_CTX_QUERY2_FLAGS_RESET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AMDGPU_CTX_QUERY2_FLAGS_RESET@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
LBB0_4:
	ldr	x23, [x21, #8]
	mov	x0, x22
	bl	_atomic_read
	cmp	x23, x0
	b.eq	LBB0_6
; %bb.5:
Lloh3:
	adrp	x8, _AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
LBB0_6:
	add	x0, x21, #32
	bl	_atomic_read
	cbz	x0, LBB0_8
; %bb.7:
Lloh6:
	adrp	x8, _AMDGPU_CTX_QUERY2_FLAGS_GUILTY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AMDGPU_CTX_QUERY2_FLAGS_GUILTY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
LBB0_8:
	mov	x0, x22
	mov	w1, #0
	bl	_amdgpu_ras_query_error_count
	ldr	x8, [x21, #16]
	cmp	x0, x8
	b.eq	LBB0_10
; %bb.9:
Lloh9:
	adrp	x8, _AMDGPU_CTX_QUERY2_FLAGS_RAS_UE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AMDGPU_CTX_QUERY2_FLAGS_RAS_UE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
	str	x0, [x21, #16]
LBB0_10:
	mov	x0, x22
	mov	w1, #1
	bl	_amdgpu_ras_query_error_count
	ldr	x8, [x21, #24]
	cmp	x0, x8
	b.eq	LBB0_12
; %bb.11:
Lloh12:
	adrp	x8, _AMDGPU_CTX_QUERY2_FLAGS_RAS_CE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AMDGPU_CTX_QUERY2_FLAGS_RAS_CE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
	str	x0, [x21, #24]
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w0, #0
	b	LBB0_15
LBB0_13:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_14:
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RESET,4,2 ; @AMDGPU_CTX_QUERY2_FLAGS_RESET
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST,4,2 ; @AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_GUILTY,4,2 ; @AMDGPU_CTX_QUERY2_FLAGS_GUILTY
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RAS_UE,4,2 ; @AMDGPU_CTX_QUERY2_FLAGS_RAS_UE
	.comm	_AMDGPU_CTX_QUERY2_FLAGS_RAS_CE,4,2 ; @AMDGPU_CTX_QUERY2_FLAGS_RAS_CE
	.no_dead_strip	_amdgpu_ctx_query2
.subsections_via_symbols
