	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SaveMovie                      ## -- Begin function SaveMovie
	.p2align	4, 0x90
_SaveMovie:                             ## @SaveMovie
	.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
	movq	%rdi, %r14
	movl	$1024, %edi                     ## imm = 0x400
	callq	_malloc
	movq	%rax, %rbx
	movq	_Movie@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	_Playback@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	callq	_StopMovie
LBB0_2:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_fopen
	movq	%rax, 16(%r15)
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_strcpy
	movq	%rbx, 8(%r15)
	movq	_RecordingFileOpened@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	_framecounter@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_Recording@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r15)
	movq	_MovieStatus@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_strcpy
	movq	$0, 24(%r15)
	movq	16(%r15), %rdi
	callq	_WriteHeader
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_YabauseReset
	jmp	LBB0_5
LBB0_3:
	movq	%rbx, %rdi
	callq	_free
	movl	$-1, %ebx
LBB0_5:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_Movie,32,3                     ## @Movie
	.comm	_Playback,8,3                   ## @Playback
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"w+b"

	.comm	_RecordingFileOpened,4,2        ## @RecordingFileOpened
	.comm	_framecounter,8,3               ## @framecounter
	.comm	_Recording,8,3                  ## @Recording
	.comm	_MovieStatus,8,3                ## @MovieStatus
L_.str.1:                               ## @.str.1
	.asciz	"Recording Started"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SaveMovie                      ; -- Begin function SaveMovie
	.p2align	2
_SaveMovie:                             ; @SaveMovie
	.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
	mov	x20, x0
	mov	w0, #1024
	bl	_malloc
	mov	x19, x0
Lloh0:
	adrp	x21, _Movie@GOTPAGE
Lloh1:
	ldr	x21, [x21, _Movie@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh2:
	adrp	x9, _Playback@GOTPAGE
Lloh3:
	ldr	x9, [x9, _Playback@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	bl	_StopMovie
LBB0_2:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_fopen
	str	x0, [x21, #16]
	cbz	x0, LBB0_4
; %bb.3:
	mov	x0, x19
	mov	x1, x20
	bl	_strcpy
Lloh7:
	adrp	x8, _RecordingFileOpened@GOTPAGE
Lloh8:
	ldr	x8, [x8, _RecordingFileOpened@GOTPAGEOFF]
	mov	w9, #1
Lloh9:
	str	w9, [x8]
Lloh10:
	adrp	x8, _framecounter@GOTPAGE
Lloh11:
	ldr	x8, [x8, _framecounter@GOTPAGEOFF]
Lloh12:
	str	xzr, [x8]
Lloh13:
	adrp	x8, _Recording@GOTPAGE
Lloh14:
	ldr	x8, [x8, _Recording@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	stp	x8, x19, [x21]
Lloh16:
	adrp	x8, _MovieStatus@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MovieStatus@GOTPAGEOFF]
Lloh18:
	ldr	x0, [x8]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_strcpy
	str	xzr, [x21, #24]
	ldr	x0, [x21, #16]
	bl	_WriteHeader
	bl	_YabauseReset
	mov	w0, #0
	b	LBB0_5
LBB0_4:
	mov	x0, x19
	bl	_free
	mov	w0, #-1
LBB0_5:
	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
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotStr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_Movie,32,3                     ; @Movie
	.comm	_Playback,8,3                   ; @Playback
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"w+b"

	.comm	_RecordingFileOpened,4,2        ; @RecordingFileOpened
	.comm	_framecounter,8,3               ; @framecounter
	.comm	_Recording,8,3                  ; @Recording
	.comm	_MovieStatus,8,3                ; @MovieStatus
l_.str.1:                               ; @.str.1
	.asciz	"Recording Started"

.subsections_via_symbols
