// File: ljl0222[P]SecondFileSystem/User.cpp
// Function: User::checkPathName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool User::checkPathName(string path) {
    // FileManager �к������жϲ����ĺϷ��ԣ�������User�й��ˣ�
    // �ݲ����ǹ����Ĳ������Ϸ�����
    if (path.empty()) {
        cout << "parameter path can't be empty ! \n";
        return false;
    }

    if (path.substr(0, 2) != "..") {
        u_dirp = path;
    }
    else {
        string pre = u_curdir;
        unsigned int p = 0;
        //���Զ�������·�� .. ../ ../.. ../../
        for (; pre.length() > 3 && p < path.length() && path.substr(p, 2) == ".."; ) {
            pre.pop_back();
            pre.erase(pre.find_last_of('/') + 1);
            p += 2;
            p += p < path.length() && path[p] == '/';
        }
        u_dirp = pre + path.substr(p);
    }

    if (u_dirp.length() > 1 && u_dirp.back() == '/') {
        u_dirp.pop_back();
    }

    for (unsigned int p = 0, q = 0; p < u_dirp.length(); p = q + 1) {
        q = u_dirp.find('/', p);
        q = min(q, (unsigned int)u_dirp.length());
        if (q - p > DirectoryEntry::DIRSIZ) {
            cout << "�ļ�·�����ȹ����� \n";
            return false;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rsi, -0x100(%rbp)
movq %rdi, %rax
movq -0x100(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
callq 0x3550
testb $0x1, %al
jne 0x95b1
jmp 0x95cd
movq 0xaa10(%rip), %rdi      # 0x13fc8
leaq 0x4c35(%rip), %rsi      # 0xe1f4
callq 0x32e0
movb $0x0, -0x1(%rbp)
jmp 0x9a0b
movq -0xf8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x38(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movl $0x2, %ecx
callq 0x3320
movq -0x110(%rbp), %rdi
leaq 0x4c1b(%rip), %rsi      # 0xe216
callq 0xa980
movb %al, -0x101(%rbp)
jmp 0x9608
leaq -0x38(%rbp), %rdi
callq 0x3628
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x961d
jmp 0x9656
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
callq 0x3040
jmp 0x98df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3628
jmp 0x9a19
movq -0xf0(%rbp), %rsi
addq $0x10a8, %rsi           # imm = 0x10A8
leaq -0x68(%rbp), %rdi
callq 0x3140
movl $0x0, -0x6c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x34e0
movq %rax, %rcx
movb $0x0, -0x91(%rbp)
xorl %eax, %eax
cmpq $0x3, %rcx
movb %al, -0x111(%rbp)
jbe 0x9711
movq -0xf8(%rbp), %rdi
movl -0x6c(%rbp), %eax
movq %rax, -0x120(%rbp)
callq 0x34e0
movq -0x120(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x111(%rbp)
jae 0x9711
movq -0xf8(%rbp), %rsi
movl -0x6c(%rbp), %eax
movl %eax, %edx
leaq -0x90(%rbp), %rdi
movl $0x2, %ecx
callq 0x3320
jmp 0x96e1
movb $0x1, -0x91(%rbp)
leaq 0x4b27(%rip), %rsi      # 0xe216
leaq -0x90(%rbp), %rdi
callq 0xa9b0
movb %al, -0x121(%rbp)
jmp 0x9703
movb -0x121(%rbp), %al
movb %al, -0x111(%rbp)
jmp 0x9711
movb -0x111(%rbp), %al
movb %al, -0x122(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x9728
jmp 0x9734
leaq -0x90(%rbp), %rdi
callq 0x3628
movb -0x122(%rbp), %al
testb $0x1, %al
jne 0x9743
jmp 0x9842
leaq -0x68(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x33c0
movq -0x138(%rbp), %rdi
movl $0x2f, %esi
movq $-0x1, %rdx
movq %rdx, -0x130(%rbp)
callq 0x35c0
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rdx
movq %rax, %rsi
incq %rsi
callq 0x30c0
jmp 0x978d
movq -0xf8(%rbp), %rdi
movl -0x6c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq %rax, -0x148(%rbp)
callq 0x34e0
movq -0x148(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x139(%rbp)
jae 0x97f3
movq -0xf8(%rbp), %rdi
movl -0x6c(%rbp), %eax
movl %eax, %esi
callq 0x3610
movq %rax, -0x150(%rbp)
jmp 0x97dd
movq -0x150(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
sete %al
movb %al, -0x139(%rbp)
movb -0x139(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x9674
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x98d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x9831
jmp 0x983d
leaq -0x90(%rbp), %rdi
callq 0x3628
jmp 0x98d1
movq -0xf8(%rbp), %rsi
movl -0x6c(%rbp), %eax
movl %eax, %edx
leaq -0xd8(%rbp), %rdi
movq $-0x1, %rcx
callq 0x3320
jmp 0x9863
leaq -0xb8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0xa9e0
jmp 0x987c
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
leaq -0xb8(%rbp), %rsi
callq 0x33d0
leaq -0xb8(%rbp), %rdi
callq 0x3628
leaq -0xd8(%rbp), %rdi
callq 0x3628
leaq -0x68(%rbp), %rdi
callq 0x3628
jmp 0x98df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3628
leaq -0x68(%rbp), %rdi
callq 0x3628
jmp 0x9a19
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
callq 0x34e0
cmpq $0x1, %rax
jbe 0x9926
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
callq 0x3220
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x9926
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
callq 0x33c0
movl $0x0, -0xdc(%rbp)
movl $0x0, -0xe0(%rbp)
movq -0xf0(%rbp), %rdi
movl -0xdc(%rbp), %eax
movq %rax, -0x158(%rbp)
addq $0x1038, %rdi           # imm = 0x1038
callq 0x34e0
movq %rax, %rcx
movq -0x158(%rbp), %rax
cmpq %rcx, %rax
jae 0x9a07
movq -0xf0(%rbp), %rdi
addq $0x1038, %rdi           # imm = 0x1038
movl -0xdc(%rbp), %eax
movl %eax, %edx
movl $0x2f, %esi
callq 0x3440
movq -0xf0(%rbp), %rdi
movl %eax, -0xe0(%rbp)
addq $0x1038, %rdi           # imm = 0x1038
callq 0x34e0
movl %eax, -0xe4(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0xaa30
movl (%rax), %eax
movl %eax, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
subl -0xdc(%rbp), %eax
cmpl $0x1c, %eax
jbe 0x99f1
movq 0xa5e9(%rip), %rdi      # 0x13fc8
leaq 0x4833(%rip), %rsi      # 0xe219
callq 0x32e0
movb $0x0, -0x1(%rbp)
jmp 0x9a0b
jmp 0x99f3
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x993a
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3580
nopw %cs:(%rax,%rax)