	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gl_core_read_viewport
_gl_core_read_viewport:                 ## @gl_core_read_viewport
	.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	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movl	%edx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %rbx
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	_gl_core_context_bind_hw_render
	movl	52(%rbx), %r15d
	imull	48(%rbx), %r15d
	cmpq	$0, 40(%rbx)
	je	LBB0_5
## %bb.3:
	movq	(%rbx), %rcx
	movq	8(%rbx), %rax
	cmpl	$0, (%rcx,%rax,4)
	je	LBB0_10
## %bb.4:
	leaq	32(%rbx), %r12
	movl	$0, (%rcx,%rax,4)
	movq	_GL_PIXEL_PACK_BUFFER@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	24(%rbx), %rcx
	movl	(%rcx,%rax,4), %esi
	callq	_glBindBuffer
	movl	(%r13), %edi
	shll	$2, %r15d
	movq	_GL_MAP_READ_BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%esi, %esi
	movl	%r15d, %edx
	callq	_glMapBufferRange
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%rax, %rdx
	callq	_scaler_ctx_scale_direct
	movl	(%r13), %edi
	callq	_glUnmapBuffer
	movl	(%r13), %edi
	xorl	%esi, %esi
	callq	_glBindBuffer
	jmp	LBB0_9
LBB0_1:
	xorl	%r12d, %r12d
	jmp	LBB0_11
LBB0_5:
	leal	(,%r15,4), %edi
	callq	_malloc
	movq	%rax, 16(%rbx)
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	testl	%r13d, %r13d
	jne	LBB0_8
## %bb.7:
	xorl	%eax, %eax
	callq	_video_driver_cached_frame
	movq	16(%rbx), %rax
LBB0_8:
	movq	%rax, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_video_frame_convert_rgba_to_bgr
	movq	16(%rbx), %rdi
	callq	_free
	movq	$0, 16(%rbx)
LBB0_9:
	movl	$1, %r12d
LBB0_10:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_gl_core_context_bind_hw_render
LBB0_11:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GL_PIXEL_PACK_BUFFER,4,2       ## @GL_PIXEL_PACK_BUFFER
	.comm	_GL_MAP_READ_BIT,4,2            ## @GL_MAP_READ_BIT
	.no_dead_strip	_gl_core_read_viewport
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gl_core_read_viewport
_gl_core_read_viewport:                 ; @gl_core_read_viewport
	.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	x0, LBB0_4
; %bb.1:
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	mov	w1, #0
	bl	_gl_core_context_bind_hw_render
	ldp	w8, w9, [x19, #48]
	mul	w21, w9, w8
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_5
; %bb.2:
	ldp	x8, x9, [x19]
	ldr	w10, [x8, x9, lsl #2]
	cbz	w10, LBB0_10
; %bb.3:
	add	x22, x19, #32
	lsl	x9, x9, #2
	str	wzr, [x8, x9]
Lloh0:
	adrp	x23, _GL_PIXEL_PACK_BUFFER@GOTPAGE
Lloh1:
	ldr	x23, [x23, _GL_PIXEL_PACK_BUFFER@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	x8, [x19, #24]
	ldr	w1, [x8, x9]
	bl	_glBindBuffer
	ldr	w0, [x23]
	lsl	w2, w21, #2
Lloh2:
	adrp	x8, _GL_MAP_READ_BIT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GL_MAP_READ_BIT@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	mov	w1, #0
	bl	_glMapBufferRange
	mov	x2, x0
	mov	x0, x22
	mov	x1, x20
	bl	_scaler_ctx_scale_direct
	ldr	w0, [x23]
	bl	_glUnmapBuffer
	ldr	w0, [x23]
	mov	w1, #0
	bl	_glBindBuffer
	b	LBB0_9
LBB0_4:
	mov	w20, #0
	b	LBB0_12
LBB0_5:
	lsl	w0, w21, #2
	bl	_malloc
	str	x0, [x19, #16]
	cbz	x0, LBB0_10
; %bb.6:
	cbnz	w22, LBB0_8
; %bb.7:
	bl	_video_driver_cached_frame
	ldr	x0, [x19, #16]
LBB0_8:
	mov	x1, x20
	mov	x2, x21
	bl	_video_frame_convert_rgba_to_bgr
	ldr	x0, [x19, #16]
	bl	_free
	str	xzr, [x19, #16]
LBB0_9:
	mov	w20, #1
	b	LBB0_11
LBB0_10:
	mov	w20, #0
LBB0_11:
	mov	x0, x19
	mov	w1, #1
	bl	_gl_core_context_bind_hw_render
LBB0_12:
	mov	x0, x20
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_GL_PIXEL_PACK_BUFFER,4,2       ; @GL_PIXEL_PACK_BUFFER
	.comm	_GL_MAP_READ_BIT,4,2            ; @GL_MAP_READ_BIT
	.no_dead_strip	_gl_core_read_viewport
.subsections_via_symbols
