	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gx_priv_save                   ## -- Begin function gx_priv_save
	.p2align	4, 0x90
_gx_priv_save:                          ## @gx_priv_save
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	testq	%rsi, %rsi
	je	LBB0_2
## %bb.1:
	movq	(%r14), %rax
	movq	_RES_MAGIC@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_vcos_assert
	xorl	%ebx, %ebx
	cmpl	$0, 8(%r14)
	sete	%bl
	jmp	LBB0_3
LBB0_2:
	movl	$1, %ebx
	movl	$1, %edi
	callq	_vcos_assert
LBB0_3:
	movl	%ebx, %edi
	callq	_vcos_assert
	xorl	%eax, %eax
	callq	_eglGetCurrentContext
	movl	%eax, 32(%r15)
	xorl	%eax, %eax
	callq	_eglQueryAPI
	movl	%eax, (%r15)
	movq	_EGL_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_eglGetCurrentSurface
	movq	%rax, 24(%r15)
	movq	_EGL_DRAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_eglGetCurrentSurface
	movq	%rax, 16(%r15)
	movq	%r14, 8(%r15)
	movl	(%r15), %edi
	callq	_vcos_assert
	movq	_lock@GOTPCREL(%rip), %rdi
	callq	_vcos_mutex_lock
	movq	_EGL_OPENVG_API@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_eglBindAPI
	movl	%eax, %edi
	callq	_vcos_assert
	testq	%r14, %r14
	je	LBB0_5
## %bb.4:
	xorl	%eax, %eax
	callq	_vcos_thread_current
	movl	%eax, %edi
	callq	_vcos_thread_get_name
	movl	16(%r14), %r8d
	movl	24(%r14), %ecx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%r14d, %edx
	callq	_GX_TRACE
	movq	_display@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	16(%r14), %rcx
	movq	24(%r14), %rdx
	movq	%rdx, %rsi
	callq	_eglMakeCurrent
	movl	%eax, %edi
	callq	_vcos_assert
	movl	$1, 8(%r14)
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RES_MAGIC,8,3                  ## @RES_MAGIC
	.comm	_EGL_READ,4,2                   ## @EGL_READ
	.comm	_EGL_DRAW,4,2                   ## @EGL_DRAW
	.comm	_lock,4,2                       ## @lock
	.comm	_EGL_OPENVG_API,4,2             ## @EGL_OPENVG_API
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"gx_priv_save: eglMakeCurrent: %s, res %x surface %x, cxt %x"

	.comm	_display,4,2                    ## @display
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gx_priv_save                   ; -- Begin function gx_priv_save
	.p2align	2
_gx_priv_save:                          ; @gx_priv_save
	.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	x19, x1
	mov	x20, x0
	cbz	x1, LBB0_2
; %bb.1:
	ldr	x8, [x19]
Lloh0:
	adrp	x9, _RES_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _RES_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_vcos_assert
	ldr	w8, [x19, #8]
	cmp	w8, #0
	cset	w21, eq
	b	LBB0_3
LBB0_2:
	mov	w21, #1
	mov	w0, #1
	bl	_vcos_assert
LBB0_3:
	mov	x0, x21
	bl	_vcos_assert
	bl	_eglGetCurrentContext
	str	w0, [x20, #32]
	bl	_eglQueryAPI
	str	w0, [x20]
Lloh3:
	adrp	x8, _EGL_READ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EGL_READ@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_eglGetCurrentSurface
	str	x0, [x20, #24]
Lloh6:
	adrp	x8, _EGL_DRAW@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EGL_DRAW@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_eglGetCurrentSurface
	stp	x19, x0, [x20, #8]
	ldr	w0, [x20]
	bl	_vcos_assert
Lloh9:
	adrp	x0, _lock@GOTPAGE
Lloh10:
	ldr	x0, [x0, _lock@GOTPAGEOFF]
	bl	_vcos_mutex_lock
Lloh11:
	adrp	x8, _EGL_OPENVG_API@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EGL_OPENVG_API@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	bl	_eglBindAPI
	bl	_vcos_assert
	cbz	x19, LBB0_5
; %bb.4:
	bl	_vcos_thread_current
	bl	_vcos_thread_get_name
	mov	x1, x0
	ldr	w3, [x19, #24]
	ldr	w4, [x19, #16]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x19
	bl	_GX_TRACE
Lloh16:
	adrp	x8, _display@GOTPAGE
Lloh17:
	ldr	x8, [x8, _display@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	ldp	x3, x1, [x19, #16]
	mov	x2, x1
	bl	_eglMakeCurrent
	bl	_vcos_assert
	mov	w8, #1
	str	w8, [x19, #8]
LBB0_5:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_RES_MAGIC,8,3                  ; @RES_MAGIC
	.comm	_EGL_READ,4,2                   ; @EGL_READ
	.comm	_EGL_DRAW,4,2                   ; @EGL_DRAW
	.comm	_lock,4,2                       ; @lock
	.comm	_EGL_OPENVG_API,4,2             ; @EGL_OPENVG_API
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"gx_priv_save: eglMakeCurrent: %s, res %x surface %x, cxt %x"

	.comm	_display,4,2                    ; @display
.subsections_via_symbols
