	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vga_set_texture_frame
_vga_set_texture_frame:                 ## @vga_set_texture_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	cmpl	$1, %edx
	movb	$2, %al
	sbbb	$0, %al
	movl	%ecx, %r14d
	movl	%ecx, %edx
	movl	%eax, %ecx
	shll	%cl, %edx
	movl	%edx, %ebx
	movl	%r8d, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r15
	movq	_vga_menu_frame@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	callq	_free
	movq	$0, (%r12)
LBB0_2:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_16
## %bb.3:
	testl	%ebx, %ebx
	je	LBB0_16
## %bb.4:
	movq	_VGA_WIDTH@GOTPCREL(%rip), %r13
	movq	_VGA_HEIGHT@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	imull	(%r13), %edi
	callq	_malloc
	movq	_vga_menu_frame@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	testq	%r15, %r15
	je	LBB0_16
## %bb.5:
	testq	%rax, %rax
	je	LBB0_16
## %bb.6:
	movl	$32, %edx
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_15
## %bb.7:
	movl	(%r12), %r11d
	movl	$16, %edx
	testl	%r11d, %r11d
	je	LBB0_15
## %bb.8:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	(%r13), %ebx
	xorl	%r9d, %r9d
	movq	_vga_menu_frame@GOTPCREL(%rip), %r8
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_9 Depth=1
	xorl	%ebx, %ebx
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	incl	%r9d
	cmpl	%r11d, %r9d
	jae	LBB0_14
LBB0_9:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
	testl	%ebx, %ebx
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%r9d, %r10d
	imull	-48(%rbp), %r10d                ## 4-byte Folded Reload
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %edi
	movl	%r10d, %eax
	xorl	%edx, %edx
	divl	%r11d
                                        ## kill: def $eax killed $eax def $rax
	imull	%r14d, %eax
	addl	%edi, %eax
	movzwl	(%r15,%rax,2), %eax
	movl	%eax, %edx
	shrl	$13, %edx
	movl	%eax, %edi
	andl	$192, %edi
	orl	%edx, %edi
	shrl	$6, %eax
	andl	$56, %eax
	orl	%edi, %eax
	movq	(%r8), %rdx
	imull	%r9d, %ebx
	addl	%ecx, %ebx
	movb	%al, (%rdx,%rbx)
	incl	%ecx
	movl	(%r13), %ebx
	movl	(%r12), %r11d
	addl	%r14d, %esi
	cmpl	%ebx, %ecx
	jb	LBB0_12
	jmp	LBB0_13
LBB0_14:
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	$16, %edx
LBB0_15:
	movq	_vga_menu_width@GOTPCREL(%rip), %rax
	movl	%r14d, (%rax)
	movq	_vga_menu_height@GOTPCREL(%rip), %rax
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax)
	movq	_vga_menu_pitch@GOTPCREL(%rip), %rax
	movl	%ebx, (%rax)
	movq	_vga_menu_bits@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_vga_menu_frame,8,3             ## @vga_menu_frame
	.comm	_vga_menu_width,4,2             ## @vga_menu_width
	.comm	_vga_menu_height,4,2            ## @vga_menu_height
	.comm	_vga_menu_pitch,4,2             ## @vga_menu_pitch
	.comm	_VGA_WIDTH,4,2                  ## @VGA_WIDTH
	.comm	_VGA_HEIGHT,4,2                 ## @VGA_HEIGHT
	.comm	_vga_menu_bits,4,2              ## @vga_menu_bits
	.no_dead_strip	_vga_set_texture_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vga_set_texture_frame
_vga_set_texture_frame:                 ; @vga_set_texture_frame
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x4
	mov	x20, x3
	mov	x22, x2
	mov	x21, x1
	cmp	w2, #0
	mov	w8, #1
	cinc	w23, w8, ne
Lloh0:
	adrp	x24, _vga_menu_frame@GOTPAGE
Lloh1:
	ldr	x24, [x24, _vga_menu_frame@GOTPAGEOFF]
	ldr	x0, [x24]
	cbz	x0, LBB0_2
; %bb.1:
	bl	_free
	str	xzr, [x24]
LBB0_2:
	cbz	w19, LBB0_16
; %bb.3:
	lsl	w23, w20, w23
	cbz	w23, LBB0_16
; %bb.4:
Lloh2:
	adrp	x25, _VGA_WIDTH@GOTPAGE
Lloh3:
	ldr	x25, [x25, _VGA_WIDTH@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh4:
	adrp	x26, _VGA_HEIGHT@GOTPAGE
Lloh5:
	ldr	x26, [x26, _VGA_HEIGHT@GOTPAGEOFF]
	ldr	w9, [x26]
	mul	w0, w9, w8
	bl	_malloc
	str	x0, [x24]
	cbz	x21, LBB0_16
; %bb.5:
	cbz	x0, LBB0_16
; %bb.6:
	cbz	w22, LBB0_8
; %bb.7:
	mov	w8, #32
	b	LBB0_15
LBB0_8:
	ldr	w10, [x26]
	cbz	w10, LBB0_14
; %bb.9:
	mov	w8, #0
	ldr	w9, [x25]
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w8, w8, #1
	cmp	w8, w10
	b.hs	LBB0_14
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
	cbz	w9, LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w11, #0
	mov	w12, #0
	mul	w13, w8, w19
LBB0_13:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	udiv	w14, w11, w9
	udiv	w10, w13, w10
	madd	w10, w10, w20, w14
	ldrh	w10, [x21, w10, uxtw #1]
	and	w14, w10, #0xc0
	lsr	w15, w10, #6
	and	w15, w15, #0x38
	orr	w10, w14, w10, lsr #13
	orr	w10, w10, w15
	ldr	x14, [x24]
	madd	w9, w8, w9, w12
	strb	w10, [x14, w9, uxtw]
	add	w12, w12, #1
	ldr	w9, [x25]
	ldr	w10, [x26]
	add	w11, w11, w20
	cmp	w12, w9
	b.lo	LBB0_13
	b	LBB0_10
LBB0_14:
	mov	w8, #16
LBB0_15:
Lloh6:
	adrp	x9, _vga_menu_width@GOTPAGE
Lloh7:
	ldr	x9, [x9, _vga_menu_width@GOTPAGEOFF]
Lloh8:
	str	w20, [x9]
Lloh9:
	adrp	x9, _vga_menu_height@GOTPAGE
Lloh10:
	ldr	x9, [x9, _vga_menu_height@GOTPAGEOFF]
Lloh11:
	str	w19, [x9]
Lloh12:
	adrp	x9, _vga_menu_pitch@GOTPAGE
Lloh13:
	ldr	x9, [x9, _vga_menu_pitch@GOTPAGEOFF]
Lloh14:
	str	w23, [x9]
Lloh15:
	adrp	x9, _vga_menu_bits@GOTPAGE
Lloh16:
	ldr	x9, [x9, _vga_menu_bits@GOTPAGEOFF]
Lloh17:
	str	w8, [x9]
LBB0_16:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotStr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotStr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotStr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_vga_menu_frame,8,3             ; @vga_menu_frame
	.comm	_vga_menu_width,4,2             ; @vga_menu_width
	.comm	_vga_menu_height,4,2            ; @vga_menu_height
	.comm	_vga_menu_pitch,4,2             ; @vga_menu_pitch
	.comm	_VGA_WIDTH,4,2                  ; @VGA_WIDTH
	.comm	_VGA_HEIGHT,4,2                 ; @VGA_HEIGHT
	.comm	_vga_menu_bits,4,2              ; @vga_menu_bits
	.no_dead_strip	_vga_set_texture_frame
.subsections_via_symbols
