	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function caca_gfx_frame
_caca_gfx_frame:                        ## @caca_gfx_frame
	.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
	movq	$0, -48(%rbp)
	testq	%rsi, %rsi
	je	LBB0_19
## %bb.1:
	movl	%edx, %ebx
	testl	%edx, %edx
	je	LBB0_19
## %bb.2:
	movl	%ecx, %r14d
	testl	%ecx, %ecx
	je	LBB0_19
## %bb.3:
	movq	%rsi, %r15
	movq	_caca_video_width@GOTPCREL(%rip), %rax
	movq	_caca_video_height@GOTPCREL(%rip), %rcx
	movq	_caca_video_pitch@GOTPCREL(%rip), %rdx
	cmpl	%ebx, (%rax)
	jne	LBB0_6
## %bb.4:
	cmpl	%r14d, (%rcx)
	jne	LBB0_6
## %bb.5:
	cmpl	%r9d, (%rdx)
	je	LBB0_9
LBB0_6:
	cmpl	$5, %ebx
	jb	LBB0_9
## %bb.7:
	cmpl	$5, %r14d
	jb	LBB0_9
## %bb.8:
	movl	%ebx, (%rax)
	movl	%r14d, (%rcx)
	movl	%r9d, (%rdx)
	xorl	%edi, %edi
	callq	_caca_gfx_free
	xorl	%eax, %eax
	callq	_caca_gfx_create
LBB0_9:
	movq	_caca_cv@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	testl	%edi, %edi
	je	LBB0_19
## %bb.10:
	movq	24(%rbp), %rcx
	movq	_caca_menu_frame@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%r15, %r12
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	cmpq	$0, (%rcx)
	cmoveq	%r15, %rax
	movq	%rax, %r12
LBB0_12:
	callq	_caca_get_canvas_width
	movl	%eax, %r13d
	movq	_caca_cv@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_caca_get_canvas_height
	cmpq	%r15, %r12
	setne	%dl
	cmpl	$4, %ebx
	setne	%cl
	orb	%dl, %cl
	cmpl	$4, %r14d
	movl	%r13d, %r14d
	movl	%eax, %r13d
	movq	24(%rbp), %r15
	setne	%al
	cmpl	$5, %r14d
	setb	%dl
	orb	%cl, %al
	orb	%dl, %al
	cmpl	$5, %r13d
	setb	%cl
	orb	%al, %cl
	cmpq	$0, (%r15)
	sete	%bl
	andb	%cl, %bl
	movq	_caca_cv@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_caca_clear_canvas
	movq	16(%rbp), %rdx
	testq	%rdx, %rdx
	je	LBB0_14
## %bb.13:
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	callq	_font_driver_render_msg
LBB0_14:
	testb	%bl, %bl
	je	LBB0_19
## %bb.15:
	movq	_caca_cv@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	_caca_dither@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	%r12, (%rsp)
	xorl	%esi, %esi
	xorl	%edx, %edx
	movl	%r14d, %ecx
	movl	%r13d, %r8d
	callq	_caca_dither_bitmap
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	leaq	-48(%rbp), %rdx
	callq	_caca_export_canvas_to_memory
	testq	%rax, %rax
	je	LBB0_19
## %bb.16:
	movq	%rax, %rbx
	cmpq	$0, -48(%rbp)
	je	LBB0_18
## %bb.17:
	movq	_caca_display@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_caca_refresh_display
LBB0_18:
	movq	%rbx, %rdi
	callq	_free
LBB0_19:
	movl	$1, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_caca_video_width,4,2           ## @caca_video_width
	.comm	_caca_video_height,4,2          ## @caca_video_height
	.comm	_caca_video_pitch,4,2           ## @caca_video_pitch
	.comm	_caca_cv,4,2                    ## @caca_cv
	.comm	_caca_menu_frame,8,3            ## @caca_menu_frame
	.comm	_caca_dither,4,2                ## @caca_dither
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"caca"

	.comm	_caca_display,4,2               ## @caca_display
	.no_dead_strip	_caca_gfx_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function caca_gfx_frame
_caca_gfx_frame:                        ; @caca_gfx_frame
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	str	xzr, [sp, #8]
	cbz	x1, LBB0_15
; %bb.1:
	mov	x23, x2
	cbz	w2, LBB0_15
; %bb.2:
	mov	x21, x3
	cbz	w3, LBB0_15
; %bb.3:
	mov	x20, x7
	mov	x19, x6
	mov	x22, x1
Lloh0:
	adrp	x8, _caca_video_width@GOTPAGE
Lloh1:
	ldr	x8, [x8, _caca_video_width@GOTPAGEOFF]
	ldr	w11, [x8]
Lloh2:
	adrp	x9, _caca_video_height@GOTPAGE
Lloh3:
	ldr	x9, [x9, _caca_video_height@GOTPAGEOFF]
	ldr	w12, [x9]
Lloh4:
	adrp	x10, _caca_video_pitch@GOTPAGE
Lloh5:
	ldr	x10, [x10, _caca_video_pitch@GOTPAGEOFF]
	ldr	w13, [x10]
	cmp	w11, w23
	ccmp	w12, w21, #0, eq
	ccmp	w13, w5, #0, eq
	ccmp	w23, #5, #0, ne
	ccmp	w21, #5, #0, hs
	b.lo	LBB0_5
; %bb.4:
	str	w23, [x8]
	str	w21, [x9]
	str	w5, [x10]
	mov	x0, #0
	bl	_caca_gfx_free
	bl	_caca_gfx_create
LBB0_5:
Lloh6:
	adrp	x27, _caca_cv@GOTPAGE
Lloh7:
	ldr	x27, [x27, _caca_cv@GOTPAGEOFF]
	ldr	w0, [x27]
	cbz	w0, LBB0_15
; %bb.6:
Lloh8:
	adrp	x8, _caca_menu_frame@GOTPAGE
Lloh9:
	ldr	x8, [x8, _caca_menu_frame@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	mov	x24, x22
	cbz	x8, LBB0_8
; %bb.7:
	ldr	x9, [x20]
	cmp	x9, #0
	csel	x24, x22, x8, eq
LBB0_8:
	bl	_caca_get_canvas_width
	mov	x25, x0
	ldr	w0, [x27]
	bl	_caca_get_canvas_height
	mov	x26, x0
	cmp	w23, #4
	ccmp	x24, x22, #0, eq
	ccmp	w21, #4, #0, eq
	ccmp	w25, #5, #0, eq
	ccmp	w0, #5, #0, hs
	ldr	x8, [x20]
	ccmp	x8, #0, #0, lo
	cset	w21, eq
	ldr	w0, [x27]
	bl	_caca_clear_canvas
	cbz	x19, LBB0_10
; %bb.9:
	mov	x0, x20
	mov	x1, #0
	mov	x2, x19
	mov	x3, #0
	bl	_font_driver_render_msg
LBB0_10:
	cbz	w21, LBB0_15
; %bb.11:
	ldr	w0, [x27]
Lloh11:
	adrp	x8, _caca_dither@GOTPAGE
Lloh12:
	ldr	x8, [x8, _caca_dither@GOTPAGEOFF]
Lloh13:
	ldr	w5, [x8]
	mov	w1, #0
	mov	w2, #0
	mov	x3, x25
	mov	x4, x26
	mov	x6, x24
	bl	_caca_dither_bitmap
	ldr	w0, [x27]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #8
	bl	_caca_export_canvas_to_memory
	cbz	x0, LBB0_15
; %bb.12:
	mov	x19, x0
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_14
; %bb.13:
Lloh16:
	adrp	x8, _caca_display@GOTPAGE
Lloh17:
	ldr	x8, [x8, _caca_display@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	bl	_caca_refresh_display
LBB0_14:
	mov	x0, x19
	bl	_free
LBB0_15:
	mov	w0, #1
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_caca_video_width,4,2           ; @caca_video_width
	.comm	_caca_video_height,4,2          ; @caca_video_height
	.comm	_caca_video_pitch,4,2           ; @caca_video_pitch
	.comm	_caca_cv,4,2                    ; @caca_cv
	.comm	_caca_menu_frame,8,3            ; @caca_menu_frame
	.comm	_caca_dither,4,2                ; @caca_dither
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"caca"

	.comm	_caca_display,4,2               ; @caca_display
	.no_dead_strip	_caca_gfx_frame
.subsections_via_symbols
