	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gl2_free
_gl2_free:                              ## @gl2_free
	.cfi_startproc
## %bb.0:
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	xorl	%esi, %esi
	callq	_gl2_context_bind_hw_render
	cmpq	$0, 88(%rbx)
	je	LBB0_3
## %bb.2:
	movq	8(%rbx), %rsi
	movq	%rbx, %rdi
	callq	_gl2_renderchain_fence_free
LBB0_3:
	xorl	%eax, %eax
	callq	_font_driver_free_osd
	movq	80(%rbx), %rax
	movl	72(%rbx), %edi
	callq	*(%rax)
	movl	(%rbx), %edi
	movq	64(%rbx), %rsi
	callq	_glDeleteTextures
	leaq	48(%rbx), %rdi
	callq	_scaler_ctx_gen_reset
	cmpq	$0, 40(%rbx)
	je	LBB0_5
## %bb.4:
	movq	32(%rbx), %rsi
	movl	$4, %edi
	callq	_glDeleteBuffers
	leaq	24(%rbx), %rdi
	callq	_scaler_ctx_gen_reset
LBB0_5:
	cmpq	$0, 16(%rbx)
	je	LBB0_7
## %bb.6:
	movq	8(%rbx), %r14
	xorl	%edi, %edi
	callq	_glBindVertexArray
	movl	$1, %edi
	movq	%r14, %rsi
	callq	_glDeleteVertexArrays
LBB0_7:
	movq	8(%rbx), %rsi
	movq	%rbx, %rdi
	callq	_gl2_renderchain_deinit_fbo
	movq	8(%rbx), %rsi
	movq	%rbx, %rdi
	callq	_gl2_renderchain_deinit_hw_render
	movq	%rbx, %rdi
	callq	_gl2_deinit_chain
	xorl	%eax, %eax
	callq	_video_context_driver_free
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_gl2_destroy_resources          ## TAILCALL
LBB0_8:
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GL_TEXTURE_REFERENCE_BUFFER_SCE,4,2 ## @GL_TEXTURE_REFERENCE_BUFFER_SCE
	.no_dead_strip	_gl2_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gl2_free
_gl2_free:                              ; @gl2_free
	.cfi_startproc
; %bb.0:
	cbz	x0, LBB0_8
; %bb.1:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	mov	w1, #0
	bl	_gl2_context_bind_hw_render
	ldr	x8, [x19, #88]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_gl2_renderchain_fence_free
LBB0_3:
	bl	_font_driver_free_osd
	ldr	x8, [x19, #80]
	ldr	x8, [x8]
	ldr	w0, [x19, #72]
	blr	x8
	ldr	w0, [x19]
	ldr	x1, [x19, #64]
	bl	_glDeleteTextures
	add	x0, x19, #48
	bl	_scaler_ctx_gen_reset
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_5
; %bb.4:
	ldr	x1, [x19, #32]
	mov	w0, #4
	bl	_glDeleteBuffers
	add	x0, x19, #24
	bl	_scaler_ctx_gen_reset
LBB0_5:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	x20, [x19, #8]
	mov	w0, #0
	bl	_glBindVertexArray
	mov	w0, #1
	mov	x1, x20
	bl	_glDeleteVertexArrays
LBB0_7:
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_gl2_renderchain_deinit_fbo
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_gl2_renderchain_deinit_hw_render
	mov	x0, x19
	bl	_gl2_deinit_chain
	bl	_video_context_driver_free
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_gl2_destroy_resources
LBB0_8:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	ret
	.cfi_endproc
                                        ; -- End function
	.comm	_GL_TEXTURE_REFERENCE_BUFFER_SCE,4,2 ; @GL_TEXTURE_REFERENCE_BUFFER_SCE
	.no_dead_strip	_gl2_free
.subsections_via_symbols
