	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function take_screenshot_viewport
_take_screenshot_viewport:              ## @take_screenshot_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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $r9d killed $r9d def $r9
	movq	%r9, -56(%rbp)                  ## 8-byte Spill
                                        ## kill: def $r8d killed $r8d def $r8
	movq	%r8, -64(%rbp)                  ## 8-byte Spill
	movl	%ecx, %r13d
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r15
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -96(%rbp)
	movaps	%xmm0, -112(%rbp)
	movq	$0, -80(%rbp)
	leaq	-112(%rbp), %rdi
	callq	_video_driver_get_viewport_info
	movl	-112(%rbp), %eax
	xorl	%r12d, %r12d
	testl	%eax, %eax
	je	LBB0_6
## %bb.1:
	movl	-108(%rbp), %ecx
	testl	%ecx, %ecx
	je	LBB0_6
## %bb.2:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	imull	%ecx, %eax
	leal	(%rax,%rax,2), %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.3:
	movq	%rax, %rbx
	movq	%rax, %rdi
	movl	%r13d, %esi
	callq	_video_driver_read_viewport
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	24(%rbp), %eax
	movl	16(%rbp), %r10d
	movl	-112(%rbp), %ecx
	movl	-108(%rbp), %r8d
	leal	(%rcx,%rcx,2), %r9d
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
                                        ## kill: def $ecx killed $ecx killed $rcx
	pushq	%rax
	pushq	%r10
	pushq	-56(%rbp)                       ## 8-byte Folded Reload
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	pushq	%r13
	pushq	-48(%rbp)                       ## 8-byte Folded Reload
	pushq	%rbx
	pushq	$1
	callq	_screenshot_dump
	addq	$64, %rsp
	movl	$1, %r12d
	testl	%eax, %eax
	jne	LBB0_6
LBB0_5:
	movq	%rbx, %rdi
	callq	_free
	xorl	%r12d, %r12d
LBB0_6:
	movl	%r12d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_take_screenshot_viewport
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function take_screenshot_viewport
_take_screenshot_viewport:              ; @take_screenshot_viewport
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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	x26, x7
	mov	x25, x6
	mov	x19, x5
	mov	x20, x4
	mov	x21, x3
	mov	x23, x2
	mov	x22, x1
	mov	x24, x0
	str	xzr, [sp, #64]
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp, #32]
	add	x0, sp, #32
	bl	_video_driver_get_viewport_info
	ldp	w8, w9, [sp, #32]
	cmp	w8, #0
	ccmp	w9, #0, #4, ne
	b.eq	LBB0_5
; %bb.1:
	mul	w8, w8, w9
	add	w0, w8, w8, lsl #1
	bl	_malloc
	cbz	x0, LBB0_5
; %bb.2:
	mov	x27, x0
	mov	x1, x21
	bl	_video_driver_read_viewport
	cbz	w0, LBB0_4
; %bb.3:
	ldp	w3, w4, [sp, #32]
	add	w5, w3, w3, lsl #1
	stp	w25, w26, [sp, #16]
	mov	w25, #1
	stp	w20, w19, [sp, #8]
	stp	w23, w21, [sp]
	mov	x0, x24
	mov	x1, x22
	mov	x2, x27
	mov	w6, #1
	mov	x7, x27
	bl	_screenshot_dump
	cbnz	w0, LBB0_6
LBB0_4:
	mov	x0, x27
	bl	_free
LBB0_5:
	mov	w25, #0
LBB0_6:
	mov	x0, x25
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_take_screenshot_viewport
.subsections_via_symbols
