	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gfx_ctx_vc_image_buffer_write
_gfx_ctx_vc_image_buffer_write:         ## @gfx_ctx_vc_image_buffer_write
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $ecx killed $ecx def $rcx
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rsi, %r13
	movq	24(%rbp), %rsi
	testq	%rdi, %rdi
	je	LBB0_12
## %bb.1:
	movl	16(%rbp), %r15d
	movq	_MAX_EGLIMAGE_TEXTURES@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jbe	LBB0_12
## %bb.2:
	movl	%r9d, %r14d
	movq	%rdi, %rbx
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	_EGL_OPENVG_API@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_eglBindAPI
	movl	40(%rbx), %edx
	movl	8(%rbx), %edi
	movl	32(%rbx), %ecx
	movl	%edx, %esi
	callq	_eglMakeCurrent
	movq	16(%rbx), %rax
	movl	%r15d, %r12d
	cmpq	$0, (%rax,%r12,8)
	je	LBB0_4
## %bb.3:
	movq	24(%rbx), %rax
	movq	(%rax,%r12,8), %rdi
	xorl	%r15d, %r15d
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.8:
	testl	%r14d, %r14d
	jne	LBB0_9
LBB0_10:
	movq	_VG_sRGB_565@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_12:
	movq	$0, (%rsi)
	xorl	%r15d, %r15d
	jmp	LBB0_13
LBB0_4:
	testl	%r14d, %r14d
	jne	LBB0_5
## %bb.6:
	movq	_VG_sRGB_565@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	movq	_VG_sXRGB_8888@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %edi
	movl	36(%rbx), %edx
	movq	_VG_IMAGE_QUALITY_NONANTIALIASED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%edx, %esi
	callq	_vgCreateImage
	movq	24(%rbx), %rcx
	movq	%rax, (%rcx,%r12,8)
	movl	8(%rbx), %edi
	movl	32(%rbx), %esi
	movq	_EGL_VG_PARENT_IMAGE_KHR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%eax, %ecx
	xorl	%r8d, %r8d
	callq	_peglCreateImageKHR
	movq	16(%rbx), %rcx
	movq	%rax, (%rcx,%r12,8)
	movq	24(%rbx), %rax
	movq	(%rax,%r12,8), %rdi
	movl	$1, %r15d
	testl	%r14d, %r14d
	je	LBB0_10
LBB0_9:
	movq	_VG_sXRGB_8888@GOTPCREL(%rip), %rax
LBB0_11:
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	(%rax), %ecx
	movq	%r13, %rsi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	-56(%rbp)                       ## 8-byte Folded Reload
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	callq	_vgImageSubData
	addq	$16, %rsp
	movq	16(%rbx), %rax
	movq	(%rax,%r12,8), %rax
	movq	24(%rbp), %rcx
	movq	%rax, (%rcx)
	movq	_vc_api@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_gfx_ctx_vc_bind_api
	movl	8(%rbx), %edi
	movl	(%rbx), %ecx
	movl	4(%rbx), %edx
	movl	%edx, %esi
	callq	_eglMakeCurrent
LBB0_13:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_EGLIMAGE_TEXTURES,4,2      ## @MAX_EGLIMAGE_TEXTURES
	.comm	_EGL_OPENVG_API,4,2             ## @EGL_OPENVG_API
	.comm	_VG_sXRGB_8888,4,2              ## @VG_sXRGB_8888
	.comm	_VG_sRGB_565,4,2                ## @VG_sRGB_565
	.comm	_VG_IMAGE_QUALITY_NONANTIALIASED,4,2 ## @VG_IMAGE_QUALITY_NONANTIALIASED
	.comm	_EGL_VG_PARENT_IMAGE_KHR,4,2    ## @EGL_VG_PARENT_IMAGE_KHR
	.comm	_vc_api,4,2                     ## @vc_api
	.no_dead_strip	_gfx_ctx_vc_image_buffer_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gfx_ctx_vc_image_buffer_write
_gfx_ctx_vc_image_buffer_write:         ; @gfx_ctx_vc_image_buffer_write
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x7
	cbz	x0, LBB0_5
; %bb.1:
	mov	x26, x6
Lloh0:
	adrp	x8, _MAX_EGLIMAGE_TEXTURES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_EGLIMAGE_TEXTURES@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w6
	b.ls	LBB0_5
; %bb.2:
	mov	x25, x5
	mov	x23, x4
	mov	x21, x3
	mov	x22, x2
	mov	x24, x1
	mov	x19, x0
Lloh3:
	adrp	x8, _EGL_OPENVG_API@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EGL_OPENVG_API@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_eglBindAPI
	ldr	w0, [x19, #8]
	ldr	w1, [x19, #40]
	ldr	w3, [x19, #32]
	mov	x2, x1
	bl	_eglMakeCurrent
	ldr	x8, [x19, #16]
	mov	w27, w26
	ldr	x8, [x8, w26, uxtw #3]
Lloh6:
	adrp	x9, _VG_sXRGB_8888@GOTPAGE
Lloh7:
	ldr	x9, [x9, _VG_sXRGB_8888@GOTPAGEOFF]
Lloh8:
	adrp	x28, _VG_sRGB_565@GOTPAGE
Lloh9:
	ldr	x28, [x28, _VG_sRGB_565@GOTPAGEOFF]
	cbz	x8, LBB0_6
; %bb.3:
	ldr	x8, [x19, #24]
	ldr	x0, [x8, x27, lsl #3]
	cbz	x0, LBB0_6
; %bb.4:
	mov	w26, #0
	b	LBB0_7
LBB0_5:
	mov	w26, #0
	str	xzr, [x20]
	b	LBB0_8
LBB0_6:
	cmp	w25, #0
	csel	x8, x28, x9, eq
	ldr	w0, [x8]
	ldr	w1, [x19, #36]
Lloh10:
	adrp	x8, _VG_IMAGE_QUALITY_NONANTIALIASED@GOTPAGE
Lloh11:
	ldr	x8, [x8, _VG_IMAGE_QUALITY_NONANTIALIASED@GOTPAGEOFF]
Lloh12:
	ldr	w3, [x8]
	mov	x2, x1
	bl	_vgCreateImage
	mov	x3, x0
	ldr	x8, [x19, #24]
	lsl	x26, x27, #3
	str	x0, [x8, x26]
	ldr	w0, [x19, #8]
	ldr	w1, [x19, #32]
Lloh13:
	adrp	x8, _EGL_VG_PARENT_IMAGE_KHR@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EGL_VG_PARENT_IMAGE_KHR@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
                                        ; kill: def $w3 killed $w3 killed $x3
	mov	x4, #0
	bl	_peglCreateImageKHR
Lloh16:
	adrp	x9, _VG_sXRGB_8888@GOTPAGE
Lloh17:
	ldr	x9, [x9, _VG_sXRGB_8888@GOTPAGEOFF]
	ldr	x8, [x19, #16]
	str	x0, [x8, x26]
	ldr	x8, [x19, #24]
	ldr	x0, [x8, x26]
	mov	w26, #1
LBB0_7:
	cmp	w25, #0
	csel	x8, x28, x9, eq
	ldr	w3, [x8]
	mov	x1, x24
	mov	x2, x23
	mov	w4, #0
	mov	w5, #0
	mov	x6, x22
	mov	x7, x21
	bl	_vgImageSubData
	ldr	x8, [x19, #16]
	ldr	x8, [x8, x27, lsl #3]
	str	x8, [x20]
Lloh18:
	adrp	x8, _vc_api@GOTPAGE
Lloh19:
	ldr	x8, [x8, _vc_api@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, #0
	mov	w2, #0
	mov	w3, #0
	bl	_gfx_ctx_vc_bind_api
	ldp	w1, w0, [x19, #4]
	ldr	w3, [x19]
	mov	x2, x1
	bl	_eglMakeCurrent
LBB0_8:
	mov	x0, x26
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_EGLIMAGE_TEXTURES,4,2      ; @MAX_EGLIMAGE_TEXTURES
	.comm	_EGL_OPENVG_API,4,2             ; @EGL_OPENVG_API
	.comm	_VG_sXRGB_8888,4,2              ; @VG_sXRGB_8888
	.comm	_VG_sRGB_565,4,2                ; @VG_sRGB_565
	.comm	_VG_IMAGE_QUALITY_NONANTIALIASED,4,2 ; @VG_IMAGE_QUALITY_NONANTIALIASED
	.comm	_EGL_VG_PARENT_IMAGE_KHR,4,2    ; @EGL_VG_PARENT_IMAGE_KHR
	.comm	_vc_api,4,2                     ; @vc_api
	.no_dead_strip	_gfx_ctx_vc_image_buffer_write
.subsections_via_symbols
