	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_graphics_delete_resource       ## -- Begin function graphics_delete_resource
	.p2align	4, 0x90
_graphics_delete_resource:              ## @graphics_delete_resource
	.cfi_startproc
## %bb.0:
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_GX_TRACE
	movl	8(%rbx), %eax
	movq	_RES_MAGIC@GOTPCREL(%rip), %r15
	xorl	%edi, %edi
	cmpl	(%r15), %eax
	sete	%dil
	callq	_vcos_assert
	movq	(%rbx), %rax
	movq	_GX_PBUFFER@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.2:
	leaq	-28(%rbp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_gx_priv_save
	movl	16(%rbx), %edi
	callq	_vgDestroyImage
	xorl	%eax, %eax
	callq	_vgGetError
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_vcos_assert
	movq	%r14, %rdi
	callq	_gx_priv_restore
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_GX_TRACE
	movq	_display@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	12(%rbx), %esi
	callq	_eglDestroySurface
	movl	%eax, %edi
	callq	_vcos_assert
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_GX_TRACE
	xorl	%eax, %eax
	callq	_eglWaitClient
	movq	(%rbx), %rax
	movq	_GX_WINDOW@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.4:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_GX_TRACE
	movq	%rbx, %rdi
	callq	_gx_priv_destroy_native_window
LBB0_5:
	movl	(%r15), %eax
	notl	%eax
	movl	%eax, 8(%rbx)
	movq	%rbx, %rdi
	callq	_vcos_free
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_GX_TRACE
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
LBB0_6:
	xorl	%eax, %eax
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"delete resource @%p"

	.comm	_RES_MAGIC,4,2                  ## @RES_MAGIC
	.comm	_GX_PBUFFER,8,3                 ## @GX_PBUFFER
L_.str.1:                               ## @.str.1
	.asciz	"graphics_delete_resource: calling eglDestroySurface..."

	.comm	_display,4,2                    ## @display
L_.str.2:                               ## @.str.2
	.asciz	"graphics_delete_resource: calling eglWaitClient..."

	.comm	_GX_WINDOW,8,3                  ## @GX_WINDOW
L_.str.3:                               ## @.str.3
	.asciz	"graphics_delete_resource: calling gx_priv_destroy_native_window..."

L_.str.4:                               ## @.str.4
	.asciz	"graphics_delete_resource: done"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_graphics_delete_resource       ; -- Begin function graphics_delete_resource
	.p2align	2
_graphics_delete_resource:              ; @graphics_delete_resource
	.cfi_startproc
; %bb.0:
	cbz	x0, LBB0_6
; %bb.1:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	str	x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_GX_TRACE
	ldr	w8, [x19, #8]
Lloh2:
	adrp	x20, _RES_MAGIC@GOTPAGE
Lloh3:
	ldr	x20, [x20, _RES_MAGIC@GOTPAGEOFF]
	ldr	w9, [x20]
	cmp	w8, w9
	cset	w0, eq
	bl	_vcos_assert
	ldr	x8, [x19]
Lloh4:
	adrp	x9, _GX_PBUFFER@GOTPAGE
Lloh5:
	ldr	x9, [x9, _GX_PBUFFER@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
	add	x0, sp, #12
	mov	x1, x19
	bl	_gx_priv_save
	ldr	w0, [x19, #16]
	bl	_vgDestroyImage
	bl	_vgGetError
	cmp	x0, #0
	cset	w0, eq
	bl	_vcos_assert
	add	x0, sp, #12
	bl	_gx_priv_restore
LBB0_3:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_GX_TRACE
Lloh9:
	adrp	x8, _display@GOTPAGE
Lloh10:
	ldr	x8, [x8, _display@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	ldr	w1, [x19, #12]
	bl	_eglDestroySurface
	bl	_vcos_assert
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_GX_TRACE
	bl	_eglWaitClient
	ldr	x8, [x19]
Lloh14:
	adrp	x9, _GX_WINDOW@GOTPAGE
Lloh15:
	ldr	x9, [x9, _GX_WINDOW@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.4:
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_GX_TRACE
	mov	x0, x19
	bl	_gx_priv_destroy_native_window
LBB0_5:
	ldr	w8, [x20]
	mvn	w8, w8
	str	w8, [x19, #8]
	mov	x0, x19
	bl	_vcos_free
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_GX_TRACE
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
LBB0_6:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	mov	w0, #0
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"delete resource @%p"

	.comm	_RES_MAGIC,4,2                  ; @RES_MAGIC
	.comm	_GX_PBUFFER,8,3                 ; @GX_PBUFFER
l_.str.1:                               ; @.str.1
	.asciz	"graphics_delete_resource: calling eglDestroySurface..."

	.comm	_display,4,2                    ; @display
l_.str.2:                               ; @.str.2
	.asciz	"graphics_delete_resource: calling eglWaitClient..."

	.comm	_GX_WINDOW,8,3                  ; @GX_WINDOW
l_.str.3:                               ; @.str.3
	.asciz	"graphics_delete_resource: calling gx_priv_destroy_native_window..."

l_.str.4:                               ; @.str.4
	.asciz	"graphics_delete_resource: done"

.subsections_via_symbols
