	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function context_apply_draw_buffers
_context_apply_draw_buffers:            ## @context_apply_draw_buffers
	.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
	movl	%esi, %ebx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	(%rdi), %r15
	movq	_MAX_RENDER_TARGET_VIEWS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	testl	%ebx, %ebx
	je	LBB0_3
## %bb.1:
	movl	%ebx, %edi
	callq	_is_rt_mask_onscreen
	testq	%rax, %rax
	je	LBB0_4
## %bb.2:
	movq	(%r15), %r14
	movl	%ebx, %edi
	callq	_draw_buffer_from_rt_mask
	movq	%rax, %rdi
	callq	*%r14
	jmp	LBB0_12
LBB0_3:
	movq	_GL_NONE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
LBB0_11:
	callq	*(%r15)
	jmp	LBB0_12
LBB0_4:
	movq	_wined3d_settings@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_ORM_FBO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.5:
	movq	_GL_COLOR_ATTACHMENT0@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	_GL_NONE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%edi, %edi
	movl	%ebx, %edx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edi, %esi
	leaq	(%r8,%rsi), %rax
	testb	$1, %bl
	cmoveq	%rcx, %rax
	movq	%rax, (%r14,%rsi,8)
	sarl	%edx
	incl	%edi
	cmpl	$1, %ebx
	movl	%edx, %ebx
	ja	LBB0_6
## %bb.7:
	movq	8(%r15), %rax
	movq	_ARB_DRAW_BUFFERS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	$0, (%rax,%rcx,8)
	je	LBB0_10
## %bb.8:
	movq	%r14, %rsi
	callq	_glDrawBuffers
	movl	%eax, %edi
	callq	_GL_EXTCALL
	jmp	LBB0_12
LBB0_9:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
LBB0_12:
	leaq	L_.str.1(%rip), %rdi
	callq	_checkGLcall
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_14
## %bb.13:
	leaq	-24(%rbp), %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	(%r14), %rdi
	jmp	LBB0_11
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_RENDER_TARGET_VIEWS,4,2    ## @MAX_RENDER_TARGET_VIEWS
	.comm	_GL_NONE,8,3                    ## @GL_NONE
	.comm	_wined3d_settings,8,3           ## @wined3d_settings
	.comm	_ORM_FBO,8,3                    ## @ORM_FBO
	.comm	_GL_COLOR_ATTACHMENT0,8,3       ## @GL_COLOR_ATTACHMENT0
	.comm	_ARB_DRAW_BUFFERS,8,3           ## @ARB_DRAW_BUFFERS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unexpected draw buffers mask with backbuffer ORM.\n"

L_.str.1:                               ## @.str.1
	.asciz	"apply draw buffers"

	.no_dead_strip	_context_apply_draw_buffers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function context_apply_draw_buffers
_context_apply_draw_buffers:            ; @context_apply_draw_buffers
	.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
	sub	sp, sp, #16
	mov	x19, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
	ldr	x21, [x0]
Lloh3:
	adrp	x8, _MAX_RENDER_TARGET_VIEWS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_RENDER_TARGET_VIEWS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	x8, x8, #3
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x20, x9, x8
	mov	sp, x20
	cbz	w1, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_is_rt_mask_onscreen
	cbz	x0, LBB0_5
; %bb.2:
	ldr	x20, [x21]
	mov	x0, x19
	bl	_draw_buffer_from_rt_mask
	blr	x20
	b	LBB0_11
LBB0_3:
	ldr	x8, [x21]
Lloh8:
	adrp	x9, _GL_NONE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _GL_NONE@GOTPAGEOFF]
Lloh10:
	ldr	x0, [x9]
LBB0_4:
	blr	x8
	b	LBB0_11
LBB0_5:
Lloh11:
	adrp	x8, _wined3d_settings@GOTPAGE
Lloh12:
	ldr	x8, [x8, _wined3d_settings@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
Lloh14:
	adrp	x9, _ORM_FBO@GOTPAGE
Lloh15:
	ldr	x9, [x9, _ORM_FBO@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.6:
	mov	w0, #0
Lloh17:
	adrp	x8, _GL_COLOR_ATTACHMENT0@GOTPAGE
Lloh18:
	ldr	x8, [x8, _GL_COLOR_ATTACHMENT0@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
Lloh20:
	adrp	x9, _GL_NONE@GOTPAGE
Lloh21:
	ldr	x9, [x9, _GL_NONE@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x10, x8, w0, uxtw
	tst	w19, #0x1
	csel	x10, x9, x10, eq
	str	x10, [x20, w0, uxtw #3]
	asr	w10, w19, #1
	add	w0, w0, #1
	cmp	w19, #1
	mov	x19, x10
	b.hi	LBB0_7
; %bb.8:
	ldr	x8, [x21, #8]
Lloh23:
	adrp	x9, _ARB_DRAW_BUFFERS@GOTPAGE
Lloh24:
	ldr	x9, [x9, _ARB_DRAW_BUFFERS@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	ldr	x8, [x8, x9, lsl #3]
	cbz	x8, LBB0_13
; %bb.9:
	mov	x1, x20
	bl	_glDrawBuffers
	bl	_GL_EXTCALL
	b	LBB0_11
LBB0_10:
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
LBB0_11:
Lloh28:
	adrp	x0, l_.str.1@PAGE
Lloh29:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_checkGLcall
	ldur	x8, [x29, #-40]
Lloh30:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh31:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh32:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.12:
	sub	sp, x29, #32
	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
LBB0_13:
	ldr	x8, [x21]
	ldr	x0, [x20]
	b	LBB0_4
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_RENDER_TARGET_VIEWS,4,2    ; @MAX_RENDER_TARGET_VIEWS
	.comm	_GL_NONE,8,3                    ; @GL_NONE
	.comm	_wined3d_settings,8,3           ; @wined3d_settings
	.comm	_ORM_FBO,8,3                    ; @ORM_FBO
	.comm	_GL_COLOR_ATTACHMENT0,8,3       ; @GL_COLOR_ATTACHMENT0
	.comm	_ARB_DRAW_BUFFERS,8,3           ; @ARB_DRAW_BUFFERS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unexpected draw buffers mask with backbuffer ORM.\n"

l_.str.1:                               ; @.str.1
	.asciz	"apply draw buffers"

	.no_dead_strip	_context_apply_draw_buffers
.subsections_via_symbols
