	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ESC_PatchOS                    ## -- Begin function ESC_PatchOS
	.p2align	4, 0x90
_ESC_PatchOS:                           ## @ESC_PatchOS
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%eax, %eax
	callq	_Devices_PatchOS
	movl	%eax, %ebx
	movq	_ESC_enable_sio_patch@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_14
## %bb.1:
	movq	_Atari800_os_version@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$-128, %eax
	cmpl	$15, %eax
	ja	LBB0_18
## %bb.2:
	movslq	%eax, %rbx
	leaq	l_switch.table.ESC_PatchOS(%rip), %rax
	movl	(%rax,%rbx,4), %r15d
	movl	%r15d, %edi
	callq	_MEMORY_dGetByte
	cmpl	$169, %eax
	jne	LBB0_13
## %bb.3:
	leal	1(%r15), %edi
	callq	_MEMORY_dGetByte
	cmpl	$3, %eax
	jne	LBB0_13
## %bb.4:
	leal	2(%r15), %edi
	callq	_MEMORY_dGetByte
	cmpl	$141, %eax
	jne	LBB0_13
## %bb.5:
	leal	3(%r15), %edi
	callq	_MEMORY_dGetByte
	cmpl	$42, %eax
	jne	LBB0_13
## %bb.6:
	leal	4(%r15), %edi
	callq	_MEMORY_dGetByte
	cmpl	$2, %eax
	jne	LBB0_13
## %bb.7:
	leaq	l_switch.table.ESC_PatchOS.1(%rip), %rax
	movl	(%rax,%rbx,4), %r14d
	leaq	l_switch.table.ESC_PatchOS.2(%rip), %rax
	movl	(%rax,%rbx,4), %r12d
	movl	%r14d, %edi
	callq	_MEMORY_dGetByte
	cmpl	%r12d, %eax
	jne	LBB0_13
## %bb.8:
	leaq	l_switch.table.ESC_PatchOS.3(%rip), %rax
	movl	(%rax,%rbx,4), %ebx
	movl	%r14d, %edi
	orl	$1, %edi
	callq	_MEMORY_dGetByte
	cmpl	%ebx, %eax
	jne	LBB0_13
## %bb.9:
	movl	%r14d, %edi
	orl	$2, %edi
	callq	_MEMORY_dGetByte
	cmpl	$32, %eax
	jne	LBB0_13
## %bb.10:
	movl	%r14d, %edi
	orl	$3, %edi
	callq	_MEMORY_dGetByte
	cmpl	$92, %eax
	jne	LBB0_13
## %bb.11:
	leal	4(%r14), %edi
	callq	_MEMORY_dGetByte
	cmpl	$228, %eax
	jne	LBB0_13
## %bb.12:
	movq	_ESC_COPENLOAD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CASSETTE_LeaderLoad@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r15d, %edi
	callq	_ESC_Add
	movq	_ESC_COPENSAVE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CASSETTE_LeaderSave@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r14d, %edi
	callq	_ESC_Add
LBB0_13:
	movq	_ESC_SIOV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SIO_Handler@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$58457, %edi                    ## imm = 0xE459
	callq	_ESC_AddEscRts
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	testl	%ebx, %ebx
	jne	LBB0_16
	jmp	LBB0_18
LBB0_14:
	movq	_ESC_COPENLOAD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ESC_Remove
	movq	_ESC_COPENSAVE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ESC_Remove
	movq	_ESC_SIOV@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ESC_Remove
	testl	%ebx, %ebx
	je	LBB0_18
LBB0_16:
	movq	_Atari800_os_version@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$-128, %eax
	cmpl	$14, %eax
	ja	LBB0_18
## %bb.17:
	movl	$26619, %ecx                    ## imm = 0x67FB
	btl	%eax, %ecx
	jb	LBB0_19
LBB0_18:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	cltq
	leaq	l_switch.table.ESC_PatchOS.4(%rip), %rcx
	movl	(%rcx,%rax,4), %ebx
	movl	%ebx, %edi
	movl	$234, %esi
	callq	_MEMORY_dPutByte
	incl	%ebx
	movl	%ebx, %edi
	movl	$234, %esi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_MEMORY_dPutByte                ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ESC_enable_sio_patch,8,3       ## @ESC_enable_sio_patch
	.comm	_Atari800_os_version,4,2        ## @Atari800_os_version
	.comm	_ESC_COPENLOAD,4,2              ## @ESC_COPENLOAD
	.comm	_CASSETTE_LeaderLoad,4,2        ## @CASSETTE_LeaderLoad
	.comm	_ESC_COPENSAVE,4,2              ## @ESC_COPENSAVE
	.comm	_CASSETTE_LeaderSave,4,2        ## @CASSETTE_LeaderSave
	.comm	_ESC_SIOV,4,2                   ## @ESC_SIOV
	.comm	_SIO_Handler,4,2                ## @SIO_Handler
	.comm	_TRUE,4,2                       ## @TRUE
	.section	__TEXT,__const
	.p2align	2                               ## @switch.table.ESC_PatchOS
l_switch.table.ESC_PatchOS:
	.long	64787                           ## 0xfd13
	.long	61300                           ## 0xef74
	.long	61300                           ## 0xef74
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	64787                           ## 0xfd13
	.long	61300                           ## 0xef74
	.long	61300                           ## 0xef74
	.long	64787                           ## 0xfd13
	.long	60743                           ## 0xed47
	.long	61300                           ## 0xef74

	.p2align	2                               ## @switch.table.ESC_PatchOS.1
l_switch.table.ESC_PatchOS.1:
	.long	64864                           ## 0xfd60
	.long	61372                           ## 0xefbc
	.long	61372                           ## 0xefbc
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	64864                           ## 0xfd60
	.long	61372                           ## 0xefbc
	.long	61372                           ## 0xefbc
	.long	64864                           ## 0xfd60
	.long	60820                           ## 0xed94
	.long	61372                           ## 0xefbc

	.p2align	2                               ## @switch.table.ESC_PatchOS.2
l_switch.table.ESC_PatchOS.2:
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	160                             ## 0xa0
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	160                             ## 0xa0
	.long	160                             ## 0xa0
	.long	169                             ## 0xa9
	.long	169                             ## 0xa9
	.long	160                             ## 0xa0

	.p2align	2                               ## @switch.table.ESC_PatchOS.3
l_switch.table.ESC_PatchOS.3:
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	128                             ## 0x80
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	192                             ## 0xc0
	.long	128                             ## 0x80
	.long	3                               ## 0x3
	.long	3                               ## 0x3
	.long	128                             ## 0x80

	.p2align	2                               ## @switch.table.ESC_PatchOS.4
l_switch.table.ESC_PatchOS.4:
	.long	49949                           ## 0xc31d
	.long	49888                           ## 0xc2e0
	.long	50130                           ## 0xc3d2
	.long	49964                           ## 0xc32c
	.long	49949                           ## 0xc31d
	.long	49949                           ## 0xc31d
	.long	49949                           ## 0xc31d
	.long	49949                           ## 0xc31d
	.long	49949                           ## 0xc31d
	.long	49949                           ## 0xc31d
	.long	49963                           ## 0xc32b
	.long	50130                           ## 0xc3d2
	.long	50130                           ## 0xc3d2
	.long	49990                           ## 0xc346
	.long	50130                           ## 0xc3d2

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ESC_PatchOS                    ; -- Begin function ESC_PatchOS
	.p2align	2
_ESC_PatchOS:                           ; @ESC_PatchOS
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	bl	_Devices_PatchOS
Lloh0:
	adrp	x8, _ESC_enable_sio_patch@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ESC_enable_sio_patch@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x21, _Atari800_os_version@GOTPAGE
Lloh4:
	ldr	x21, [x21, _Atari800_os_version@GOTPAGEOFF]
	cbz	x8, LBB0_14
; %bb.1:
	ldr	w8, [x21]
	sub	w8, w8, #128
	cmp	w8, #15
	b.hi	LBB0_17
; %bb.2:
	sbfiz	x22, x8, #2, #32
Lloh5:
	adrp	x8, l_switch.table.ESC_PatchOS@PAGE
Lloh6:
	add	x8, x8, l_switch.table.ESC_PatchOS@PAGEOFF
	ldr	w19, [x8, x22]
	mov	x0, x19
	bl	_MEMORY_dGetByte
	cmp	w0, #169
	b.ne	LBB0_13
; %bb.3:
	add	w0, w19, #1
	bl	_MEMORY_dGetByte
	cmp	w0, #3
	b.ne	LBB0_13
; %bb.4:
	add	w0, w19, #2
	bl	_MEMORY_dGetByte
	cmp	w0, #141
	b.ne	LBB0_13
; %bb.5:
	add	w0, w19, #3
	bl	_MEMORY_dGetByte
	cmp	w0, #42
	b.ne	LBB0_13
; %bb.6:
	add	w0, w19, #4
	bl	_MEMORY_dGetByte
	cmp	w0, #2
	b.ne	LBB0_13
; %bb.7:
Lloh7:
	adrp	x8, l_switch.table.ESC_PatchOS.1@PAGE
Lloh8:
	add	x8, x8, l_switch.table.ESC_PatchOS.1@PAGEOFF
	ldr	w20, [x8, x22]
Lloh9:
	adrp	x8, l_switch.table.ESC_PatchOS.2@PAGE
Lloh10:
	add	x8, x8, l_switch.table.ESC_PatchOS.2@PAGEOFF
	ldr	w23, [x8, x22]
	mov	x0, x20
	bl	_MEMORY_dGetByte
	cmp	w0, w23
	b.ne	LBB0_13
; %bb.8:
Lloh11:
	adrp	x8, l_switch.table.ESC_PatchOS.3@PAGE
Lloh12:
	add	x8, x8, l_switch.table.ESC_PatchOS.3@PAGEOFF
	ldr	w22, [x8, x22]
	orr	w0, w20, #0x1
	bl	_MEMORY_dGetByte
	cmp	w0, w22
	b.ne	LBB0_13
; %bb.9:
	orr	w0, w20, #0x2
	bl	_MEMORY_dGetByte
	cmp	w0, #32
	b.ne	LBB0_13
; %bb.10:
	orr	w0, w20, #0x3
	bl	_MEMORY_dGetByte
	cmp	w0, #92
	b.ne	LBB0_13
; %bb.11:
	add	w0, w20, #4
	bl	_MEMORY_dGetByte
	cmp	w0, #228
	b.ne	LBB0_13
; %bb.12:
Lloh13:
	adrp	x8, _ESC_COPENLOAD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ESC_COPENLOAD@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
Lloh16:
	adrp	x8, _CASSETTE_LeaderLoad@GOTPAGE
Lloh17:
	ldr	x8, [x8, _CASSETTE_LeaderLoad@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ESC_Add
Lloh19:
	adrp	x8, _ESC_COPENSAVE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ESC_COPENSAVE@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
Lloh22:
	adrp	x8, _CASSETTE_LeaderSave@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CASSETTE_LeaderSave@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_ESC_Add
LBB0_13:
Lloh25:
	adrp	x8, _ESC_SIOV@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ESC_SIOV@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
Lloh28:
	adrp	x8, _SIO_Handler@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SIO_Handler@GOTPAGEOFF]
Lloh30:
	ldr	w2, [x8]
	mov	w0, #58457
	bl	_ESC_AddEscRts
Lloh31:
	adrp	x8, _TRUE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh33:
	ldr	w19, [x8]
	cbnz	w19, LBB0_15
	b	LBB0_17
LBB0_14:
	mov	x19, x0
Lloh34:
	adrp	x8, _ESC_COPENLOAD@GOTPAGE
Lloh35:
	ldr	x8, [x8, _ESC_COPENLOAD@GOTPAGEOFF]
Lloh36:
	ldr	w0, [x8]
	bl	_ESC_Remove
Lloh37:
	adrp	x8, _ESC_COPENSAVE@GOTPAGE
Lloh38:
	ldr	x8, [x8, _ESC_COPENSAVE@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	bl	_ESC_Remove
Lloh40:
	adrp	x8, _ESC_SIOV@GOTPAGE
Lloh41:
	ldr	x8, [x8, _ESC_SIOV@GOTPAGEOFF]
Lloh42:
	ldr	w0, [x8]
	bl	_ESC_Remove
	cbz	w19, LBB0_17
LBB0_15:
	ldr	w8, [x21]
	sub	w8, w8, #128
	cmp	w8, #14
	b.hi	LBB0_17
; %bb.16:
	mov	w9, #26619
	lsr	w9, w9, w8
	tbnz	w9, #0, LBB0_18
LBB0_17:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_18:
Lloh43:
	adrp	x9, l_switch.table.ESC_PatchOS.4@PAGE
Lloh44:
	add	x9, x9, l_switch.table.ESC_PatchOS.4@PAGEOFF
	ldr	w19, [x9, w8, sxtw #2]
	mov	x0, x19
	mov	w1, #234
	bl	_MEMORY_dPutByte
	add	w0, w19, #1
	mov	w1, #234
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_MEMORY_dPutByte
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.comm	_ESC_enable_sio_patch,8,3       ; @ESC_enable_sio_patch
	.comm	_Atari800_os_version,4,2        ; @Atari800_os_version
	.comm	_ESC_COPENLOAD,4,2              ; @ESC_COPENLOAD
	.comm	_CASSETTE_LeaderLoad,4,2        ; @CASSETTE_LeaderLoad
	.comm	_ESC_COPENSAVE,4,2              ; @ESC_COPENSAVE
	.comm	_CASSETTE_LeaderSave,4,2        ; @CASSETTE_LeaderSave
	.comm	_ESC_SIOV,4,2                   ; @ESC_SIOV
	.comm	_SIO_Handler,4,2                ; @SIO_Handler
	.comm	_TRUE,4,2                       ; @TRUE
	.section	__TEXT,__const
	.p2align	2                               ; @switch.table.ESC_PatchOS
l_switch.table.ESC_PatchOS:
	.long	64787                           ; 0xfd13
	.long	61300                           ; 0xef74
	.long	61300                           ; 0xef74
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	64787                           ; 0xfd13
	.long	61300                           ; 0xef74
	.long	61300                           ; 0xef74
	.long	64787                           ; 0xfd13
	.long	60743                           ; 0xed47
	.long	61300                           ; 0xef74

	.p2align	2                               ; @switch.table.ESC_PatchOS.1
l_switch.table.ESC_PatchOS.1:
	.long	64864                           ; 0xfd60
	.long	61372                           ; 0xefbc
	.long	61372                           ; 0xefbc
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	64864                           ; 0xfd60
	.long	61372                           ; 0xefbc
	.long	61372                           ; 0xefbc
	.long	64864                           ; 0xfd60
	.long	60820                           ; 0xed94
	.long	61372                           ; 0xefbc

	.p2align	2                               ; @switch.table.ESC_PatchOS.2
l_switch.table.ESC_PatchOS.2:
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	160                             ; 0xa0
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	160                             ; 0xa0
	.long	160                             ; 0xa0
	.long	169                             ; 0xa9
	.long	169                             ; 0xa9
	.long	160                             ; 0xa0

	.p2align	2                               ; @switch.table.ESC_PatchOS.3
l_switch.table.ESC_PatchOS.3:
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	128                             ; 0x80
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	192                             ; 0xc0
	.long	128                             ; 0x80
	.long	3                               ; 0x3
	.long	3                               ; 0x3
	.long	128                             ; 0x80

	.p2align	2                               ; @switch.table.ESC_PatchOS.4
l_switch.table.ESC_PatchOS.4:
	.long	49949                           ; 0xc31d
	.long	49888                           ; 0xc2e0
	.long	50130                           ; 0xc3d2
	.long	49964                           ; 0xc32c
	.long	49949                           ; 0xc31d
	.long	49949                           ; 0xc31d
	.long	49949                           ; 0xc31d
	.long	49949                           ; 0xc31d
	.long	49949                           ; 0xc31d
	.long	49949                           ; 0xc31d
	.long	49963                           ; 0xc32b
	.long	50130                           ; 0xc3d2
	.long	50130                           ; 0xc3d2
	.long	49990                           ; 0xc346
	.long	50130                           ; 0xc3d2

.subsections_via_symbols
