	.file	"extr_cdvd_iop.c_CDVD_Cache_Dir.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
	.text
	.p2align 4
	.globl	CDVD_Cache_Dir
	.type	CDVD_Cache_Dir, @function
CDVD_Cache_Dir:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	rax, QWORD PTR TRUE[rip]
	cmp	QWORD PTR CachedDirInfo[rip], rax
	je	.L21
.L2:
	xor	eax, eax
	call	isValidDisc@PLT
	test	eax, eax
	je	.L14
	xor	edi, edi
	call	sceCdDiskReady@PLT
	xor	eax, eax
	call	CDVD_GetVolumeDescriptor@PLT
	cmp	rax, QWORD PTR TRUE[rip]
	jne	.L14
	mov	rdi, QWORD PTR CachedDirInfo[rip+40]
	lea	rsi, .LC0[rip]
	mov	QWORD PTR CachedDirInfo[rip+56], 0
	call	strcpy@PLT
	mov	esi, DWORD PTR CDVolDesc[rip+8]
	xor	eax, eax
	mov	rdi, QWORD PTR CDVolDesc[rip]
	mov	QWORD PTR CachedDirInfo[rip+8], 0
	test	esi, 2047
	mov	QWORD PTR CachedDirInfo[rip+32], rdi
	setne	al
	sar	esi, 11
	add	esi, eax
	mov	rax, QWORD PTR MAX_DIR_CACHE_SECTORS[rip]
	movsx	rsi, esi
	mov	QWORD PTR CachedDirInfo[rip+24], rsi
	mov	QWORD PTR CachedDirInfo[rip+16], rsi
	cmp	rsi, rax
	jbe	.L15
	mov	QWORD PTR CachedDirInfo[rip+16], rax
	mov	rsi, rax
.L15:
	mov	edx, DWORD PTR CachedDirInfo[rip+48]
	lea	rcx, cdReadMode[rip]
	call	ReadSect@PLT
	cmp	rax, QWORD PTR TRUE[rip]
	je	.L16
.L18:
	movsx	rdx, DWORD PTR FALSE[rip]
	mov	QWORD PTR CachedDirInfo[rip], rdx
	mov	rax, rdx
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	mov	rsi, rbp
.L19:
	lea	rdi, dirname.1968[rip]
	call	strcpy@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	lea	rdi, dirname.1968[rip]
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	jmp	FindPath@PLT
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	mov	ebx, esi
	call	ComparePath@PLT
	cmp	rax, QWORD PTR MATCH[rip]
	jne	.L3
	cmp	DWORD PTR CACHE_START[rip], ebx
	mov	rdi, QWORD PTR CachedDirInfo[rip+8]
	je	.L22
	mov	rsi, QWORD PTR CachedDirInfo[rip+24]
	add	rdi, QWORD PTR CachedDirInfo[rip+16]
	mov	rax, QWORD PTR MAX_DIR_CACHE_SECTORS[rip]
	mov	QWORD PTR CachedDirInfo[rip+8], rdi
	sub	rsi, rdi
	mov	QWORD PTR CachedDirInfo[rip+16], rsi
	cmp	rsi, rax
	jbe	.L9
	mov	QWORD PTR CachedDirInfo[rip+16], rax
	mov	rsi, rax
.L9:
	mov	edx, DWORD PTR CachedDirInfo[rip+48]
	add	rdi, QWORD PTR CachedDirInfo[rip+32]
	lea	rcx, cdReadMode[rip]
	call	ReadSect@PLT
	cmp	rax, QWORD PTR TRUE[rip]
	jne	.L18
.L10:
	mov	QWORD PTR CachedDirInfo[rip], rax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rdi, rbp
	call	ComparePath@PLT
	cmp	rax, QWORD PTR SUBDIR[rip]
	jne	.L2
	cmp	QWORD PTR CachedDirInfo[rip+8], 0
	je	.L11
	mov	rsi, QWORD PTR CachedDirInfo[rip+24]
	mov	rax, QWORD PTR MAX_DIR_CACHE_SECTORS[rip]
	mov	QWORD PTR CachedDirInfo[rip+8], 0
	mov	QWORD PTR CachedDirInfo[rip+16], rsi
	cmp	rsi, rax
	jbe	.L12
	mov	QWORD PTR CachedDirInfo[rip+16], rax
	mov	rsi, rax
.L12:
	mov	edx, DWORD PTR CachedDirInfo[rip+48]
	mov	rdi, QWORD PTR CachedDirInfo[rip+32]
	lea	rcx, cdReadMode[rip]
	call	ReadSect@PLT
	cmp	rax, QWORD PTR TRUE[rip]
	jne	.L18
.L11:
	mov	rdi, QWORD PTR CachedDirInfo[rip+40]
	call	strlen@PLT
	movsx	rsi, eax
	add	rsi, rbp
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L22:
	test	rdi, rdi
	je	.L23
	mov	rsi, QWORD PTR CachedDirInfo[rip+24]
	mov	rax, QWORD PTR MAX_DIR_CACHE_SECTORS[rip]
	mov	QWORD PTR CachedDirInfo[rip+8], 0
	mov	QWORD PTR CachedDirInfo[rip+16], rsi
	cmp	rsi, rax
	jbe	.L7
	mov	QWORD PTR CachedDirInfo[rip+16], rax
	mov	rsi, rax
.L7:
	mov	edx, DWORD PTR CachedDirInfo[rip+48]
	mov	rdi, QWORD PTR CachedDirInfo[rip+32]
	lea	rcx, cdReadMode[rip]
	call	ReadSect@PLT
	cmp	rax, QWORD PTR TRUE[rip]
	jne	.L18
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rax, QWORD PTR TRUE[rip]
	mov	QWORD PTR CachedDirInfo[rip], rax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	mov	eax, -1
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	CDVD_Cache_Dir, .-CDVD_Cache_Dir
	.local	dirname.1968
	.comm	dirname.1968,1024,32
	.comm	cdReadMode,4,4
	.comm	TRUE,8,8
	.comm	SUBDIR,8,8
	.comm	MAX_DIR_CACHE_SECTORS,8,8
	.comm	MATCH,8,8
	.comm	FALSE,4,4
	.comm	CachedDirInfo,64,32
	.comm	CDVolDesc,16,16
	.comm	CACHE_START,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cdvd_iop.c_CDVD_Cache_Dir.c"
	.text
	.align	2
	.global	CDVD_Cache_Dir
	.syntax unified
	.arm
	.fpu softvfp
	.type	CDVD_Cache_Dir, %function
CDVD_Cache_Dir:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r4, .L29
	ldr	r5, .L29+4
	ldr	r2, [r4]
	ldr	r3, [r5]
	mov	r6, r0
	cmp	r2, r3
	beq	.L26
.L2:
	bl	isValidDisc
	cmp	r0, #0
	beq	.L14
	mov	r0, #0
	bl	sceCdDiskReady
	bl	CDVD_GetVolumeDescriptor
	ldr	r3, [r5]
	cmp	r0, r3
	bne	.L14
	mov	r3, #0
	ldr	r2, [r4, #20]
	ldr	r0, .L29+8
	str	r3, [r4, #28]
	strb	r3, [r2]
	ldr	r2, [r0, #4]
	ldr	ip, .L29+12
	lsls	r1, r2, #21
	movne	r1, #1
	ldr	ip, [ip]
	add	r1, r1, r2, asr #11
	cmp	r1, ip
	ldr	r0, [r0]
	str	r1, [r4, #8]
	str	r3, [r4, #4]
	str	r1, [r4, #12]
	ldr	r3, .L29+16
	movhi	r1, ip
	ldr	r2, [r4, #24]
	strhi	ip, [r4, #8]
	str	r0, [r4, #16]
	bl	ReadSect
	ldr	r3, [r5]
	cmp	r0, r3
	beq	.L16
.L21:
	ldr	r3, .L29+20
	ldr	r0, [r3]
.L22:
	str	r0, [r4]
	pop	{r4, r5, r6, r7, r8, pc}
.L16:
	mov	r1, r6
	ldr	r0, .L29+24
	bl	strcpy
	pop	{r4, r5, r6, r7, r8, lr}
	ldr	r0, .L29+24
	b	FindPath
.L26:
	mov	r7, r1
	bl	ComparePath
	ldr	r3, .L29+28
	ldr	r3, [r3]
	cmp	r0, r3
	bne	.L3
	ldr	r3, .L29+32
	ldr	r0, [r4, #4]
	ldr	r3, [r3]
	cmp	r3, r7
	beq	.L27
	ldr	r3, [r4, #8]
	ldr	r2, .L29+12
	ldr	r1, [r4, #12]
	add	r3, r3, r0
	ldr	r2, [r2]
	sub	r1, r1, r3
	ldr	r0, [r4, #16]
	cmp	r1, r2
	str	r1, [r4, #8]
	str	r3, [r4, #4]
	movhi	r1, r2
	strhi	r2, [r4, #8]
	add	r0, r3, r0
	ldr	r2, [r4, #24]
	ldr	r3, .L29+16
.L24:
	bl	ReadSect
	mov	r3, r0
	ldr	r0, [r5]
	cmp	r3, r0
	bne	.L21
	b	.L22
.L3:
	mov	r0, r6
	bl	ComparePath
	ldr	r3, .L29+36
	ldr	r3, [r3]
	cmp	r0, r3
	bne	.L2
	ldr	r3, [r4, #4]
	cmp	r3, #0
	beq	.L11
	mov	r2, #0
	ldr	r3, .L29+12
	ldr	r1, [r4, #12]
	ldr	r3, [r3]
	str	r1, [r4, #8]
	cmp	r1, r3
	movhi	r1, r3
	strhi	r3, [r4, #8]
	str	r2, [r4, #4]
	ldr	r3, .L29+16
	ldr	r2, [r4, #24]
	ldr	r0, [r4, #16]
	bl	ReadSect
	ldr	r3, [r5]
	cmp	r0, r3
	bne	.L21
.L11:
	ldr	r0, [r4, #20]
	bl	strlen
	mov	r1, r0
	ldr	r0, .L29+24
	add	r1, r6, r1
	bl	strcpy
	pop	{r4, r5, r6, r7, r8, lr}
	ldr	r0, .L29+24
	b	FindPath
.L27:
	cmp	r0, #0
	beq	.L28
	mov	r2, #0
	ldr	r3, .L29+12
	ldr	r1, [r4, #12]
	ldr	r3, [r3]
	str	r1, [r4, #8]
	cmp	r1, r3
	movhi	r1, r3
	str	r2, [r4, #4]
	strhi	r3, [r4, #8]
	ldr	r2, [r4, #24]
	ldr	r3, .L29+16
	ldr	r0, [r4, #16]
	b	.L24
.L28:
	ldr	r0, [r5]
	str	r0, [r4]
	pop	{r4, r5, r6, r7, r8, pc}
.L14:
	mvn	r0, #0
	pop	{r4, r5, r6, r7, r8, pc}
.L30:
	.align	2
.L29:
	.word	CachedDirInfo
	.word	TRUE
	.word	CDVolDesc
	.word	MAX_DIR_CACHE_SECTORS
	.word	cdReadMode
	.word	FALSE
	.word	.LANCHOR0
	.word	MATCH
	.word	CACHE_START
	.word	SUBDIR
	.size	CDVD_Cache_Dir, .-CDVD_Cache_Dir
	.comm	cdReadMode,4,4
	.comm	TRUE,4,4
	.comm	SUBDIR,4,4
	.comm	MAX_DIR_CACHE_SECTORS,4,4
	.comm	MATCH,4,4
	.comm	FALSE,4,4
	.comm	CachedDirInfo,32,4
	.comm	CDVolDesc,8,4
	.comm	CACHE_START,4,4
	.bss
	.align	2
	.set	.LANCHOR0,. + 0
	.type	dirname.4252, %object
	.size	dirname.4252, 1024
dirname.4252:
	.space	1024
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
