	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function Screen_SavePCX
_Screen_SavePCX:                        ## @Screen_SavePCX
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	movl	$10, %edi
	movq	%r13, %rsi
	callq	_fputc
	movl	$5, %edi
	movq	%r13, %rsi
	callq	_fputc
	movl	$1, %edi
	movq	%r13, %rsi
	callq	_fputc
	movl	$8, %edi
	movq	%r13, %rsi
	callq	_fputc
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputw
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputw
	movq	_ATARI_VISIBLE_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	decl	%edi
	movq	%r13, %rsi
	callq	_fputw
	movq	_Screen_HEIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	decl	%edi
	movq	%r13, %rsi
	callq	_fputw
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputw
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputw
	movl	$48, %ebx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputc
	decl	%ebx
	jne	LBB0_1
## %bb.2:
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputc
	xorl	%eax, %eax
	testq	%r14, %r14
	setne	%al
	leal	(%rax,%rax), %edi
	incl	%edi
	movq	%r13, %rsi
	callq	_fputc
	movq	_ATARI_VISIBLE_WIDTH@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	%r13, %rsi
	callq	_fputw
	movl	$1, %edi
	movq	%r13, %rsi
	callq	_fputw
	movl	(%rbx), %edi
	movq	%r13, %rsi
	callq	_fputw
	movq	_Screen_HEIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_fputw
	movl	$54, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	movq	%r13, %rsi
	callq	_fputc
	decl	%ebx
	jne	LBB0_3
## %bb.4:
	movq	_Screen_HEIGHT@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_25
## %bb.5:
	xorl	%ecx, %ecx
	movl	$16, %r10d
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %r9
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_Screen_WIDTH@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	subq	%rcx, %rax
	testq	%rbx, %rbx
	leaq	(%r14,%rax,8), %r14
	cmoveq	%rbx, %r14
	movl	$16, %ecx
	cmovneq	%rcx, %r10
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	incl	%ecx
LBB0_24:                                ##   in Loop: Header=BB0_6 Depth=1
	leaq	(%r15,%rax,8), %r9
	movq	_Screen_HEIGHT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	jge	LBB0_25
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
                                        ##       Child Loop BB0_11 Depth 3
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	xorl	%r12d, %r12d
	movq	%r10, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_7 Depth=2
	leal	1(%r13), %edi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%r11, -64(%rbp)                 ## 8-byte Spill
	callq	_fputc
	movq	-64(%rbp), %r11                 ## 8-byte Reload
LBB0_19:                                ##   in Loop: Header=BB0_7 Depth=2
	addq	%r13, %r12
	addq	$-191, %r12
	movl	%r11d, %edi
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_fputc
	movq	_ATARI_VISIBLE_WIDTH@GOTPCREL(%rip), %rax
	movslq	(%rax), %rcx
	movq	%r15, %r9
	cmpl	%ecx, %r12d
	movq	-72(%rbp), %r10                 ## 8-byte Reload
	jge	LBB0_20
LBB0_7:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_11 Depth 3
	testq	%r14, %r14
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movq	_Colours_table@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	(%r9), %rcx
	movq	(%r8,%rcx,8), %rdx
	movl	%r10d, %ecx
	shrq	%cl, %rdx
	movq	(%r14), %rcx
	movq	(%r8,%rcx,8), %rsi
	movl	%r10d, %ecx
	shrq	%cl, %rsi
	movzbl	%dl, %ecx
	movzbl	%sil, %r11d
	addq	%rcx, %r11
	shrq	%r11
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=2
	movq	(%r9), %r11
	movq	_Colours_table@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	_ATARI_VISIBLE_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r12d, %r12d
	movl	$191, %esi
	movq	%r9, %r15
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_6 Depth=1
                                        ##     Parent Loop BB0_7 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	%r14, %rbx
	addq	$8, %r14
	movq	-1520(%r9,%rsi,8), %rcx
	testq	%rbx, %rbx
	cmoveq	%rbx, %r14
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=3
	movq	(%r8,%rcx,8), %rdi
	movl	%r10d, %ecx
	shrq	%cl, %rdi
	movq	(%r14), %rcx
	movq	(%r8,%rcx,8), %rax
	movl	%r10d, %ecx
	shrq	%cl, %rax
	movzbl	%dil, %edi
	movzbl	%al, %ecx
	addq	%rdi, %rcx
	shrq	%rcx
LBB0_13:                                ##   in Loop: Header=BB0_11 Depth=3
	leaq	1(%rsi), %r13
	addq	$8, %r15
	cmpq	%rcx, %r11
	jne	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=3
	cmpq	$253, %r13
	ja	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_11 Depth=3
	leaq	(%r12,%rsi), %rax
	addq	$-190, %rax
	movq	%r13, %rsi
	cmpl	%edx, %eax
	jl	LBB0_11
LBB0_16:                                ##   in Loop: Header=BB0_7 Depth=2
	cmpq	$192, %r13
	ja	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_7 Depth=2
	cmpq	$192, %r11
	jb	LBB0_19
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_6 Depth=1
	testq	%rbx, %rbx
	je	LBB0_23
## %bb.21:                              ##   in Loop: Header=BB0_6 Depth=1
	testq	%r10, %r10
	je	LBB0_23
## %bb.22:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%rcx, %rax
	negq	%rax
	shlq	$3, %rcx
	subq	%rcx, %r14
	addq	$-8, %r10
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_24
LBB0_25:
	testq	%r14, %r14
	jne	LBB0_28
## %bb.26:
	movl	$12, %edi
	movq	%r13, %rsi
	callq	_fputc
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_Colours_GetR
	movl	%eax, %edi
	movq	%r13, %rsi
	callq	_fputc
	movl	%ebx, %edi
	callq	_Colours_GetG
	movl	%eax, %edi
	movq	%r13, %rsi
	callq	_fputc
	movl	%ebx, %edi
	callq	_Colours_GetB
	movl	%eax, %edi
	movq	%r13, %rsi
	callq	_fputc
	incl	%ebx
	cmpl	$256, %ebx                      ## imm = 0x100
	jne	LBB0_27
LBB0_28:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATARI_VISIBLE_WIDTH,4,2        ## @ATARI_VISIBLE_WIDTH
	.comm	_Screen_HEIGHT,4,2              ## @Screen_HEIGHT
	.comm	_Colours_table,8,3              ## @Colours_table
	.comm	_Screen_WIDTH,4,2               ## @Screen_WIDTH
	.no_dead_strip	_Screen_SavePCX
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function Screen_SavePCX
_Screen_SavePCX:                        ; @Screen_SavePCX
	.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
	mov	x25, x2
	mov	x28, x1
	mov	x19, x0
	mov	w0, #10
	mov	x1, x19
	bl	_fputc
	mov	w0, #5
	mov	x1, x19
	bl	_fputc
	mov	w0, #1
	mov	x1, x19
	bl	_fputc
	mov	w0, #8
	mov	x1, x19
	bl	_fputc
	mov	w0, #0
	mov	x1, x19
	bl	_fputw
	mov	w0, #0
	mov	x1, x19
	bl	_fputw
Lloh0:
	adrp	x23, _ATARI_VISIBLE_WIDTH@GOTPAGE
Lloh1:
	ldr	x23, [x23, _ATARI_VISIBLE_WIDTH@GOTPAGEOFF]
	ldr	w8, [x23]
	sub	w0, w8, #1
	mov	x1, x19
	bl	_fputw
Lloh2:
	adrp	x8, _Screen_HEIGHT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _Screen_HEIGHT@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	sub	w0, w8, #1
	mov	x1, x19
	bl	_fputw
	mov	w0, #0
	mov	x1, x19
	bl	_fputw
	mov	w0, #0
	mov	x1, x19
	bl	_fputw
	mov	w20, #48
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #0
	mov	x1, x19
	bl	_fputc
	subs	w20, w20, #1
	b.ne	LBB0_1
; %bb.2:
	mov	w0, #0
	mov	x1, x19
	bl	_fputc
	cmp	x25, #0
	mov	w8, #3
	csinc	w0, w8, wzr, ne
	mov	x1, x19
	bl	_fputc
	ldr	w0, [x23]
	mov	x1, x19
	bl	_fputw
	mov	w0, #1
	mov	x1, x19
	bl	_fputw
	ldr	w0, [x23]
	mov	x1, x19
	bl	_fputw
Lloh5:
	adrp	x8, _Screen_HEIGHT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _Screen_HEIGHT@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_fputw
	mov	w20, #54
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #0
	mov	x1, x19
	bl	_fputc
	subs	w20, w20, #1
	b.ne	LBB0_3
; %bb.4:
Lloh8:
	adrp	x8, _Screen_HEIGHT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _Screen_HEIGHT@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_25
; %bb.5:
	mov	w9, #0
	mov	w26, #16
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
Lloh11:
	adrp	x8, _Screen_WIDTH@GOTPAGE
Lloh12:
	ldr	x8, [x8, _Screen_WIDTH@GOTPAGEOFF]
Lloh13:
	ldrsw	x8, [x8]
	sub	x8, x8, x9
	add	x9, x25, x8, lsl #3
	cmp	x20, #0
	csel	x25, xzr, x9, eq
	mov	w9, #16
	csel	x26, x26, x9, eq
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	add	w9, w9, #1
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x28, x21, x8, lsl #3
Lloh14:
	adrp	x8, _Screen_HEIGHT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _Screen_HEIGHT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	cmp	w9, w8
	b.ge	LBB0_25
LBB0_8:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
                                        ;       Child Loop BB0_15 Depth 3
	str	w9, [sp, #12]                   ; 4-byte Folded Spill
	mov	w24, #0
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=2
	add	w0, w27, #192
	mov	x1, x19
	bl	_fputc
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	add	x24, x27, w24, uxtw
	mov	x0, x22
	mov	x1, x19
	bl	_fputc
	ldrsw	x9, [x23]
	mov	x28, x21
	cmp	w24, w9
	b.ge	LBB0_22
LBB0_11:                                ;   Parent Loop BB0_8 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_15 Depth 3
	cbz	x25, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
Lloh17:
	adrp	x8, _Colours_table@GOTPAGE
Lloh18:
	ldr	x8, [x8, _Colours_table@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	ldr	x9, [x28]
	ldr	x9, [x8, x9, lsl #3]
	lsr	x9, x9, x26
	ldr	x10, [x25]
	ldr	x10, [x8, x10, lsl #3]
	lsr	x10, x10, x26
	and	x10, x10, #0xff
	add	x9, x10, w9, uxtb
	lsr	x22, x9, #1
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_11 Depth=2
	ldr	x22, [x28]
Lloh20:
	adrp	x8, _Colours_table@GOTPAGE
Lloh21:
	ldr	x8, [x8, _Colours_table@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
LBB0_14:                                ;   in Loop: Header=BB0_11 Depth=2
	mov	x11, #0
	ldr	w9, [x23]
	mov	w10, w24
	mov	x21, x28
LBB0_15:                                ;   Parent Loop BB0_8 Depth=1
                                        ;     Parent Loop BB0_11 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	mov	x20, x25
	add	x12, x28, x11, lsl #3
	add	x13, x25, #8
	cmp	x25, #0
	csel	x25, xzr, x13, eq
	ldr	x12, [x12, #8]
	cbz	x20, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=3
	ldr	x12, [x8, x12, lsl #3]
	lsr	x12, x12, x26
	ldr	x13, [x25]
	ldr	x13, [x8, x13, lsl #3]
	lsr	x13, x13, x26
	and	x13, x13, #0xff
	add	x12, x13, w12, uxtb
	lsr	x12, x12, #1
LBB0_17:                                ;   in Loop: Header=BB0_15 Depth=3
	add	x21, x21, #8
	add	x27, x11, #1
	cmp	x22, x12
	b.ne	LBB0_20
; %bb.18:                               ;   in Loop: Header=BB0_15 Depth=3
	add	x12, x11, #192
	cmp	x12, #253
	b.hi	LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_15 Depth=3
	add	x11, x10, x11
	add	x12, x11, #1
	mov	x11, x27
	cmp	w12, w9
	b.lt	LBB0_15
LBB0_20:                                ;   in Loop: Header=BB0_11 Depth=2
	add	x8, x27, #191
	cmp	x8, #192
	b.hi	LBB0_9
; %bb.21:                               ;   in Loop: Header=BB0_11 Depth=2
	cmp	x22, #192
	b.lo	LBB0_10
	b	LBB0_9
LBB0_22:                                ;   in Loop: Header=BB0_8 Depth=1
	cbz	x20, LBB0_6
; %bb.23:                               ;   in Loop: Header=BB0_8 Depth=1
	cbz	x26, LBB0_6
; %bb.24:                               ;   in Loop: Header=BB0_8 Depth=1
	neg	x8, x9
	sub	x25, x25, x9, lsl #3
	sub	x26, x26, #8
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	b	LBB0_7
LBB0_25:
	cbnz	x25, LBB0_28
; %bb.26:
	mov	w0, #12
	mov	x1, x19
	bl	_fputc
	mov	w20, #0
LBB0_27:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_Colours_GetR
	mov	x1, x19
	bl	_fputc
	mov	x0, x20
	bl	_Colours_GetG
	mov	x1, x19
	bl	_fputc
	mov	x0, x20
	bl	_Colours_GetB
	mov	x1, x19
	bl	_fputc
	add	w20, w20, #1
	cmp	w20, #256
	b.ne	LBB0_27
LBB0_28:
	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 AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_ATARI_VISIBLE_WIDTH,4,2        ; @ATARI_VISIBLE_WIDTH
	.comm	_Screen_HEIGHT,4,2              ; @Screen_HEIGHT
	.comm	_Colours_table,8,3              ; @Colours_table
	.comm	_Screen_WIDTH,4,2               ; @Screen_WIDTH
	.no_dead_strip	_Screen_SavePCX
.subsections_via_symbols
