	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_StateSav_SaveAtariState        ## -- Begin function StateSav_SaveAtariState
	.p2align	4, 0x90
_StateSav_SaveAtariState:               ## @StateSav_SaveAtariState
	.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	%rsi, %rbx
	movq	%rdi, %r14
	movl	%edx, -48(%rbp)
	movq	_SAVE_VERSION_NUMBER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)
	movq	_StateFile@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	callq	_GZCLOSE
	movq	$0, (%r15)
LBB0_2:
	movq	_Z_OK@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	_nFileError@GOTPCREL(%rip), %r13
	movq	%rax, (%r13)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_GZOPEN
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_7
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	movq	%rax, %rdi
	movl	$8, %edx
	callq	_GZWRITE
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:
	leaq	-52(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveUBYTE
	leaq	-48(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveUBYTE
	xorl	%eax, %eax
	callq	_Atari800_StateSave
	xorl	%eax, %eax
	callq	_CARTRIDGE_StateSave
	xorl	%eax, %eax
	callq	_SIO_StateSave
	xorl	%eax, %eax
	callq	_ANTIC_StateSave
	movl	-48(%rbp), %edi
	callq	_CPU_StateSave
	xorl	%eax, %eax
	callq	_GTIA_StateSave
	xorl	%eax, %eax
	callq	_PIA_StateSave
	xorl	%eax, %eax
	callq	_POKEY_StateSave
	movq	_FALSE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)
	leaq	-44(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveINT
	xorl	%eax, %eax
	callq	_PBI_StateSave
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)
	leaq	-44(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveINT
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)
	leaq	-44(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveINT
	movl	(%rbx), %eax
	movl	%eax, -44(%rbp)
	leaq	-44(%rbp), %rdi
	movl	$1, %esi
	callq	_StateSav_SaveINT
	movq	(%r15), %rdi
	callq	_GZCLOSE
	movq	$0, (%r15)
	testq	%rax, %rax
	jne	LBB0_10
## %bb.5:
	movq	(%r13), %rax
	cmpq	(%r12), %rax
	jne	LBB0_9
## %bb.6:
	movq	_TRUE@GOTPCREL(%rip), %rbx
	jmp	LBB0_10
LBB0_7:
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	callq	_Log_print
	xorl	%eax, %eax
	callq	_GetGZErrorText
	jmp	LBB0_9
LBB0_8:
	xorl	%eax, %eax
	callq	_GetGZErrorText
	movq	(%r15), %rdi
	callq	_GZCLOSE
	movq	$0, (%r15)
LBB0_9:
	movq	_FALSE@GOTPCREL(%rip), %rbx
LBB0_10:
	movl	(%rbx), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SAVE_VERSION_NUMBER,4,2        ## @SAVE_VERSION_NUMBER
	.comm	_StateFile,8,3                  ## @StateFile
	.comm	_Z_OK,8,3                       ## @Z_OK
	.comm	_nFileError,8,3                 ## @nFileError
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not open %s for state save."

	.comm	_FALSE,4,2                      ## @FALSE
L_.str.1:                               ## @.str.1
	.asciz	"ATARI800"

	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_StateSav_SaveAtariState        ; -- Begin function StateSav_SaveAtariState
	.p2align	2
_StateSav_SaveAtariState:               ; @StateSav_SaveAtariState
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _SAVE_VERSION_NUMBER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SAVE_VERSION_NUMBER@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	stp	w8, w2, [sp, #8]
Lloh3:
	adrp	x21, _StateFile@GOTPAGE
Lloh4:
	ldr	x21, [x21, _StateFile@GOTPAGEOFF]
	ldr	x0, [x21]
	cbz	x0, LBB0_2
; %bb.1:
	bl	_GZCLOSE
	str	xzr, [x21]
LBB0_2:
Lloh5:
	adrp	x22, _Z_OK@GOTPAGE
Lloh6:
	ldr	x22, [x22, _Z_OK@GOTPAGEOFF]
	ldr	x8, [x22]
Lloh7:
	adrp	x23, _nFileError@GOTPAGE
Lloh8:
	ldr	x23, [x23, _nFileError@GOTPAGEOFF]
	str	x8, [x23]
	mov	x0, x19
	mov	x1, x20
	bl	_GZOPEN
	str	x0, [x21]
	cbz	x0, LBB0_6
; %bb.3:
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w2, #8
	bl	_GZWRITE
	cbz	x0, LBB0_7
; %bb.4:
	add	x0, sp, #8
	mov	w1, #1
	bl	_StateSav_SaveUBYTE
	add	x0, sp, #12
	mov	w1, #1
	bl	_StateSav_SaveUBYTE
	bl	_Atari800_StateSave
	bl	_CARTRIDGE_StateSave
	bl	_SIO_StateSave
	bl	_ANTIC_StateSave
	ldr	w0, [sp, #12]
	bl	_CPU_StateSave
	bl	_GTIA_StateSave
	bl	_PIA_StateSave
	bl	_POKEY_StateSave
Lloh11:
	adrp	x19, _FALSE@GOTPAGE
Lloh12:
	ldr	x19, [x19, _FALSE@GOTPAGEOFF]
	ldr	w8, [x19]
	str	w8, [sp, #4]
	add	x0, sp, #4
	mov	w1, #1
	bl	_StateSav_SaveINT
	bl	_PBI_StateSave
	ldr	w8, [x19]
	str	w8, [sp, #4]
	add	x0, sp, #4
	mov	w1, #1
	bl	_StateSav_SaveINT
	ldr	w8, [x19]
	str	w8, [sp, #4]
	add	x0, sp, #4
	mov	w1, #1
	bl	_StateSav_SaveINT
	ldr	w8, [x19]
	str	w8, [sp, #4]
	add	x0, sp, #4
	mov	w1, #1
	bl	_StateSav_SaveINT
	ldr	x0, [x21]
	bl	_GZCLOSE
	str	xzr, [x21]
	cbnz	x0, LBB0_9
; %bb.5:
	ldr	x8, [x23]
	ldr	x9, [x22]
Lloh13:
	adrp	x10, _TRUE@GOTPAGE
Lloh14:
	ldr	x10, [x10, _TRUE@GOTPAGEOFF]
	cmp	x8, x9
	csel	x19, x10, x19, eq
	b	LBB0_9
LBB0_6:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_Log_print
	bl	_GetGZErrorText
	b	LBB0_8
LBB0_7:
	bl	_GetGZErrorText
	ldr	x0, [x21]
	bl	_GZCLOSE
	str	xzr, [x21]
LBB0_8:
Lloh17:
	adrp	x19, _FALSE@GOTPAGE
Lloh18:
	ldr	x19, [x19, _FALSE@GOTPAGEOFF]
LBB0_9:
	ldr	w0, [x19]
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_SAVE_VERSION_NUMBER,4,2        ; @SAVE_VERSION_NUMBER
	.comm	_StateFile,8,3                  ; @StateFile
	.comm	_Z_OK,8,3                       ; @Z_OK
	.comm	_nFileError,8,3                 ; @nFileError
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not open %s for state save."

	.comm	_FALSE,4,2                      ; @FALSE
l_.str.1:                               ; @.str.1
	.asciz	"ATARI800"

	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
