	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IJK_EGL_terminate              ## -- Begin function IJK_EGL_terminate
	.p2align	4, 0x90
_IJK_EGL_terminate:                     ## @IJK_EGL_terminate
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	callq	_IJK_EGL_isValid
	testl	%eax, %eax
	je	LBB0_10
## %bb.1:
	movq	24(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.2:
	callq	_IJK_GLES2_Renderer_freeP
LBB0_3:
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.4:
	movq	_EGL_NO_SURFACE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_EGL_NO_CONTEXT@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%rdx, %rsi
	callq	_eglMakeCurrent
	movq	16(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_6
## %bb.5:
	movq	(%rbx), %rdi
	callq	_eglDestroyContext
LBB0_6:
	movq	8(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_8
## %bb.7:
	movq	(%rbx), %rdi
	callq	_eglDestroySurface
LBB0_8:
	movq	(%rbx), %rdi
	callq	_eglTerminate
	xorl	%eax, %eax
	callq	_eglReleaseThread
LBB0_9:
	movq	_EGL_NO_CONTEXT@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 16(%rbx)
	movq	_EGL_NO_SURFACE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%rbx)
	movq	_EGL_NO_DISPLAY@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EGL_NO_SURFACE,8,3             ## @EGL_NO_SURFACE
	.comm	_EGL_NO_CONTEXT,8,3             ## @EGL_NO_CONTEXT
	.comm	_EGL_NO_DISPLAY,8,3             ## @EGL_NO_DISPLAY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IJK_EGL_terminate              ; -- Begin function IJK_EGL_terminate
	.p2align	2
_IJK_EGL_terminate:                     ; @IJK_EGL_terminate
	.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, x0
	bl	_IJK_EGL_isValid
	cbz	w0, LBB0_10
; %bb.1:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_3
; %bb.2:
	bl	_IJK_GLES2_Renderer_freeP
LBB0_3:
	ldr	x0, [x19]
Lloh0:
	adrp	x21, _EGL_NO_CONTEXT@GOTPAGE
Lloh1:
	ldr	x21, [x21, _EGL_NO_CONTEXT@GOTPAGEOFF]
Lloh2:
	adrp	x20, _EGL_NO_SURFACE@GOTPAGE
Lloh3:
	ldr	x20, [x20, _EGL_NO_SURFACE@GOTPAGEOFF]
	cbz	x0, LBB0_9
; %bb.4:
	ldr	x1, [x20]
	ldr	x3, [x21]
	mov	x2, x1
	bl	_eglMakeCurrent
	ldr	x1, [x19, #16]
	cbz	x1, LBB0_6
; %bb.5:
	ldr	x0, [x19]
	bl	_eglDestroyContext
LBB0_6:
	ldr	x1, [x19, #8]
	cbz	x1, LBB0_8
; %bb.7:
	ldr	x0, [x19]
	bl	_eglDestroySurface
LBB0_8:
	ldr	x0, [x19]
	bl	_eglTerminate
	bl	_eglReleaseThread
LBB0_9:
	ldr	x8, [x21]
	str	x8, [x19, #16]
	ldr	x8, [x20]
Lloh4:
	adrp	x9, _EGL_NO_DISPLAY@GOTPAGE
Lloh5:
	ldr	x9, [x9, _EGL_NO_DISPLAY@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	stp	x9, x8, [x19]
LBB0_10:
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_EGL_NO_SURFACE,8,3             ; @EGL_NO_SURFACE
	.comm	_EGL_NO_CONTEXT,8,3             ; @EGL_NO_CONTEXT
	.comm	_EGL_NO_DISPLAY,8,3             ; @EGL_NO_DISPLAY
.subsections_via_symbols
