	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CDVD_read                      ## -- Begin function CDVD_read
	.p2align	4, 0x90
_CDVD_read:                             ## @CDVD_read
	.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
                                        ## kill: def $edx killed $edx def $rdx
	movq	_fd_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	xorl	%ecx, %ecx
	cmpq	%rdi, 16(%rax)
	je	LBB0_31
## %bb.1:
	cmpq	%rdi, 40(%rax)
	je	LBB0_2
## %bb.3:
	cmpq	%rdi, 64(%rax)
	je	LBB0_4
## %bb.5:
	cmpq	%rdi, 88(%rax)
	je	LBB0_6
## %bb.7:
	cmpq	%rdi, 112(%rax)
	je	LBB0_8
## %bb.9:
	cmpq	%rdi, 136(%rax)
	je	LBB0_10
## %bb.11:
	cmpq	%rdi, 160(%rax)
	je	LBB0_12
## %bb.13:
	cmpq	%rdi, 184(%rax)
	je	LBB0_14
## %bb.15:
	cmpq	%rdi, 208(%rax)
	je	LBB0_16
## %bb.17:
	cmpq	%rdi, 232(%rax)
	je	LBB0_18
## %bb.19:
	cmpq	%rdi, 256(%rax)
	je	LBB0_20
## %bb.21:
	cmpq	%rdi, 280(%rax)
	je	LBB0_22
## %bb.23:
	cmpq	%rdi, 304(%rax)
	je	LBB0_24
## %bb.25:
	cmpq	%rdi, 328(%rax)
	je	LBB0_26
## %bb.27:
	cmpq	%rdi, 352(%rax)
	je	LBB0_28
## %bb.29:
	movl	$-1, %r12d
	cmpq	%rdi, 376(%rax)
	jne	LBB0_42
## %bb.30:
	movl	$15, %ecx
	jmp	LBB0_31
LBB0_2:
	movl	$1, %ecx
	jmp	LBB0_31
LBB0_4:
	movl	$2, %ecx
	jmp	LBB0_31
LBB0_6:
	movl	$3, %ecx
	jmp	LBB0_31
LBB0_8:
	movl	$4, %ecx
	jmp	LBB0_31
LBB0_10:
	movl	$5, %ecx
	jmp	LBB0_31
LBB0_12:
	movl	$6, %ecx
	jmp	LBB0_31
LBB0_14:
	movl	$7, %ecx
	jmp	LBB0_31
LBB0_16:
	movl	$8, %ecx
	jmp	LBB0_31
LBB0_18:
	movl	$9, %ecx
	jmp	LBB0_31
LBB0_20:
	movl	$10, %ecx
	jmp	LBB0_31
LBB0_22:
	movl	$11, %ecx
	jmp	LBB0_31
LBB0_24:
	movl	$12, %ecx
	jmp	LBB0_31
LBB0_26:
	movl	$13, %ecx
	jmp	LBB0_31
LBB0_28:
	movl	$14, %ecx
LBB0_31:
	leaq	(%rcx,%rcx,2), %r13
	movl	(%rax,%r13,8), %r15d
	movl	4(%rax,%r13,8), %ebx
	cmpl	%r15d, %ebx
	jge	LBB0_33
## %bb.32:
	xorl	%r12d, %r12d
	jmp	LBB0_42
LBB0_33:
	movl	%ebx, %ecx
	subl	%r15d, %ecx
	leal	(%r15,%rdx), %edi
	cmpl	%ebx, %edi
	cmovlel	%edx, %ecx
	movl	$0, %r12d
	testl	%ecx, %ecx
	jle	LBB0_42
## %bb.34:
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	cmpl	$16384, %ecx                    ## imm = 0x4000
	movl	$16384, %r12d                   ## imm = 0x4000
	cmovll	%ecx, %r12d
	movl	%r15d, %r14d
	sarl	$11, %r14d
	addl	8(%rax,%r13,8), %r14d
	andl	$2047, %r15d                    ## imm = 0x7FF
	leal	(%r15,%r12), %eax
	movl	%eax, %ebx
	shrl	$11, %ebx
	andl	$2047, %eax                     ## imm = 0x7FF
	cmpl	$1, %eax
	sbbl	$-1, %ebx
	movq	_lastsector@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r14d
	jne	LBB0_35
## %bb.36:
	movq	_last_bk@GOTPCREL(%rip), %rax
	movslq	(%rax), %rsi
	testq	%rsi, %rsi
	jle	LBB0_38
## %bb.37:
	shlq	$11, %rsi
	leaq	_CDVD_read.local_buffer(%rip), %rdi
	addq	%rdi, %rsi
	movl	$2048, %edx                     ## imm = 0x800
	callq	_memcpy
	movq	_last_bk@GOTPCREL(%rip), %rax
	movq	_lastsector@GOTPCREL(%rip), %rcx
LBB0_38:
	movl	$0, (%rax)
	leal	(%rbx,%r14), %eax
	decl	%eax
	movl	%eax, (%rcx)
	cmpl	$2, %ebx
	jb	LBB0_41
## %bb.39:
	leal	-1(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$1, %eax
	jmp	LBB0_40
LBB0_35:
	leal	-1(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	leal	(%rbx,%r14), %eax
	decl	%eax
	movl	%eax, (%rcx)
	xorl	%eax, %eax
LBB0_40:
	addl	%eax, %r14d
	subl	%eax, %ebx
	shll	$11, %eax
	leaq	_CDVD_read.local_buffer(%rip), %rdx
	addq	%rax, %rdx
	movq	_cdReadMode@GOTPCREL(%rip), %rcx
	movl	%r14d, %edi
	movl	%ebx, %esi
	callq	_ReadSect
	movq	_last_bk@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax)
LBB0_41:
	leaq	_CDVD_read.local_buffer(%rip), %rsi
	addq	%r15, %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %edx
	callq	_memcpy
	movq	_fd_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addl	%r12d, (%rax,%r13,8)
LBB0_42:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_CDVD_read.local_buffer,18432,4 ## @CDVD_read.local_buffer
	.comm	_fd_table,8,3                   ## @fd_table
	.comm	_lastsector,4,2                 ## @lastsector
	.comm	_last_bk,4,2                    ## @last_bk
	.comm	_cdReadMode,4,2                 ## @cdReadMode
	.comm	_TRUE,8,3                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CDVD_read                      ; -- Begin function CDVD_read
	.p2align	2
_CDVD_read:                             ; @CDVD_read
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x1
Lloh0:
	adrp	x8, _fd_table@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fd_table@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x9, [x8, #16]
	cmp	x9, x0
	b.eq	LBB0_17
; %bb.1:
	ldr	x9, [x8, #40]
	cmp	x9, x0
	b.eq	LBB0_18
; %bb.2:
	ldr	x9, [x8, #64]
	cmp	x9, x0
	b.eq	LBB0_19
; %bb.3:
	ldr	x9, [x8, #88]
	cmp	x9, x0
	b.eq	LBB0_20
; %bb.4:
	ldr	x9, [x8, #112]
	cmp	x9, x0
	b.eq	LBB0_21
; %bb.5:
	ldr	x9, [x8, #136]
	cmp	x9, x0
	b.eq	LBB0_22
; %bb.6:
	ldr	x9, [x8, #160]
	cmp	x9, x0
	b.eq	LBB0_23
; %bb.7:
	ldr	x9, [x8, #184]
	cmp	x9, x0
	b.eq	LBB0_24
; %bb.8:
	ldr	x9, [x8, #208]
	cmp	x9, x0
	b.eq	LBB0_25
; %bb.9:
	ldr	x9, [x8, #232]
	cmp	x9, x0
	b.eq	LBB0_26
; %bb.10:
	ldr	x9, [x8, #256]
	cmp	x9, x0
	b.eq	LBB0_27
; %bb.11:
	ldr	x9, [x8, #280]
	cmp	x9, x0
	b.eq	LBB0_28
; %bb.12:
	ldr	x9, [x8, #304]
	cmp	x9, x0
	b.eq	LBB0_29
; %bb.13:
	ldr	x9, [x8, #328]
	cmp	x9, x0
	b.eq	LBB0_30
; %bb.14:
	ldr	x9, [x8, #352]
	cmp	x9, x0
	b.eq	LBB0_31
; %bb.15:
	ldr	x9, [x8, #376]
	cmp	x9, x0
	b.eq	LBB0_32
; %bb.16:
	mov	w20, #-1
	b	LBB0_44
LBB0_17:
	mov	x23, #0
	b	LBB0_33
LBB0_18:
	mov	w23, #1
	b	LBB0_33
LBB0_19:
	mov	w23, #2
	b	LBB0_33
LBB0_20:
	mov	w23, #3
	b	LBB0_33
LBB0_21:
	mov	w23, #4
	b	LBB0_33
LBB0_22:
	mov	w23, #5
	b	LBB0_33
LBB0_23:
	mov	w23, #6
	b	LBB0_33
LBB0_24:
	mov	w23, #7
	b	LBB0_33
LBB0_25:
	mov	w23, #8
	b	LBB0_33
LBB0_26:
	mov	w23, #9
	b	LBB0_33
LBB0_27:
	mov	w23, #10
	b	LBB0_33
LBB0_28:
	mov	w23, #11
	b	LBB0_33
LBB0_29:
	mov	w23, #12
	b	LBB0_33
LBB0_30:
	mov	w23, #13
	b	LBB0_33
LBB0_31:
	mov	w23, #14
	b	LBB0_33
LBB0_32:
	mov	w23, #15
LBB0_33:
	mov	w9, #24
	madd	x10, x23, x9, x8
	ldp	w9, w10, [x10]
	cmp	w10, w9
	b.lt	LBB0_40
; %bb.34:
	sub	w11, w10, w9
	add	w12, w9, w2
	cmp	w12, w10
	csel	w10, w11, w2, gt
	cmp	w10, #1
	b.lt	LBB0_40
; %bb.35:
	mov	w11, #16384
	cmp	w10, #4, lsl #12                ; =16384
	csel	w20, w10, w11, lt
	mov	w10, #24
	madd	x8, x23, x10, x8
	ldr	w8, [x8, #8]
	add	w26, w8, w9, asr #11
	and	x24, x9, #0x7ff
	add	w8, w20, w24
	lsr	w9, w8, #11
	tst	w8, #0x7ff
	cinc	w27, w9, ne
Lloh3:
	adrp	x22, _lastsector@GOTPAGE
Lloh4:
	ldr	x22, [x22, _lastsector@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh5:
	adrp	x21, _CDVD_read.local_buffer@PAGE
Lloh6:
	add	x21, x21, _CDVD_read.local_buffer@PAGEOFF
Lloh7:
	adrp	x25, _last_bk@GOTPAGE
Lloh8:
	ldr	x25, [x25, _last_bk@GOTPAGEOFF]
	cmp	w26, w8
	b.ne	LBB0_41
; %bb.36:
	ldrsw	x8, [x25]
	cmp	w8, #1
	b.lt	LBB0_38
; %bb.37:
	add	x1, x21, x8, lsl #11
	mov	x0, x21
	mov	w2, #2048
	bl	_memcpy
LBB0_38:
	str	wzr, [x25]
	sub	w28, w27, #1
	add	w8, w28, w26
	str	w8, [x22]
	cmp	w27, #2
Lloh9:
	adrp	x22, _fd_table@GOTPAGE
Lloh10:
	ldr	x22, [x22, _fd_table@GOTPAGEOFF]
	b.lo	LBB0_43
; %bb.39:
	mov	w8, #1
	b	LBB0_42
LBB0_40:
	mov	w20, #0
	b	LBB0_44
LBB0_41:
	mov	w8, #0
	sub	w28, w27, #1
	add	w9, w28, w26
	str	w9, [x22]
Lloh11:
	adrp	x22, _fd_table@GOTPAGE
Lloh12:
	ldr	x22, [x22, _fd_table@GOTPAGEOFF]
LBB0_42:
	add	w0, w8, w26
	sub	w1, w27, w8
	lsl	w8, w8, #11
	add	x2, x21, x8
Lloh13:
	adrp	x3, _cdReadMode@GOTPAGE
Lloh14:
	ldr	x3, [x3, _cdReadMode@GOTPAGEOFF]
	bl	_ReadSect
	str	w28, [x25]
LBB0_43:
	add	x1, x21, x24
	mov	x0, x19
	mov	x2, x20
	bl	_memcpy
	ldr	x8, [x22]
	mov	w9, #24
	mul	x9, x23, x9
	ldr	w10, [x8, x9]
	add	w10, w10, w20
	str	w10, [x8, x9]
LBB0_44:
	mov	x0, x20
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_CDVD_read.local_buffer,18432,0 ; @CDVD_read.local_buffer
	.comm	_fd_table,8,3                   ; @fd_table
	.comm	_lastsector,4,2                 ; @lastsector
	.comm	_last_bk,4,2                    ; @last_bk
	.comm	_cdReadMode,4,2                 ; @cdReadMode
	.comm	_TRUE,8,3                       ; @TRUE
.subsections_via_symbols
