// File: /workspace/github_cpp_makefile_star2_O2/ljl0222[P]SecondFileSystem/User.cpp
// Function: User::Read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void User::Read(string sfd, string outFile, string size) {
    if (sfd.empty() || !isdigit(sfd.front())) {
        cout << "read���������� \n";
        return;
    }
    int fd = stoi(sfd);

    int usize;
    if (size.empty() || !isdigit(size.front()) || (usize = stoi(size)) < 0) {
        cout << "read���������� \n";
        return;
    }
    char* buffer = new char[usize];
    //cout << "fd = " << fd << " outFile = " << outFile << " size = " << size << "\n";
    u_arg[0] = fd;
    u_arg[1] = (long)buffer;
    u_arg[2] = usize;
    u_FileManager->Read();
    if (IsError())
        return;

    cout << "read " << u_ar0[User::EAX] << " bytes success : \n";
    if (outFile.empty()) {
        for (unsigned int i = 0; i < u_ar0[User::EAX]; ++i) {
            cout << (char)buffer[i];
        }
        cout << " \n";
        return;
    }
    fstream fout(outFile, ios::out | ios::binary);
    if (!fout) {
        cout << "���������ļ� " << outFile << " ʧ�ܣ� \n";
        return;
    }
    fout.write(buffer, u_ar0[User::EAX]);
    fout.close();
    cout << "�������ļ� " << outFile << " �ɹ��� \n";
    delete[]buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
cmpq $0x0, 0x8(%rsi)
je 0x6c62
movq (%rsi), %rax
movsbl (%rax), %eax
addl $-0x30, %eax
cmpl $0xa, %eax
jae 0x6c62
movq %rcx, %r15
movq %rdx, %rbx
movq %rdi, %r14
pushq $0xa
popq %rdx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x6e1c
cmpq $0x0, 0x8(%r15)
je 0x6c62
movl %eax, %r12d
movq (%r15), %rax
movsbl (%rax), %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x6c62
pushq $0xa
popq %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x6e1c
testl %eax, %eax
js 0x6c62
movl %eax, %r13d
movl %eax, %edi
callq 0x3030
movq %rax, %r15
movl %r12d, 0x1020(%r14)
movl %r15d, 0x1024(%r14)
movl %r13d, 0x1028(%r14)
movq 0x1400(%r14), %rdi
callq 0x4b76
movq %r14, %rdi
callq 0x61e8
testb %al, %al
jne 0x6d1b
movq 0x53ed(%rip), %rdi      # 0xbfc0
leaq 0x1591(%rip), %rsi      # 0x816b
callq 0x31e0
movl 0x20(%r14), %esi
movq %rax, %rdi
callq 0x3150
leaq 0x157f(%rip), %rsi      # 0x8171
movq %rax, %rdi
callq 0x31e0
cmpq $0x0, 0x8(%rbx)
je 0x6c86
leaq -0x238(%rbp), %r12
pushq $0x14
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x33a0
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x218(%rbp,%rax)
je 0x6cbb
movq 0x5389(%rip), %rdi      # 0xbfc0
leaq 0x1546(%rip), %rsi      # 0x8184
callq 0x31e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x31c0
leaq 0x153d(%rip), %rsi      # 0x8192
movq %rax, %rdi
callq 0x31e0
jmp 0x6d0f
movq 0x5357(%rip), %rdi      # 0xbfc0
leaq 0x14ea(%rip), %rsi      # 0x815a
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
xorl %r12d, %r12d
movq 0x5330(%rip), %rbx      # 0xbfc0
movl 0x20(%r14), %eax
cmpq %rax, %r12
jae 0x6cab
movsbl (%r15,%r12), %esi
movq %rbx, %rdi
callq 0x3250
incq %r12
jmp 0x6c90
movq 0x530e(%rip), %rdi      # 0xbfc0
leaq 0x140e(%rip), %rsi      # 0x80c7
jmp 0x6c70
leaq -0x228(%rbp), %rdi
movl 0x20(%r14), %edx
movq %r15, %rsi
callq 0x32f0
leaq -0x238(%rbp), %rdi
callq 0x3060
movq 0x52df(%rip), %rdi      # 0xbfc0
leaq 0x14b4(%rip), %rsi      # 0x819c
callq 0x31e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x31c0
leaq 0x14a9(%rip), %rsi      # 0x81a8
movq %rax, %rdi
callq 0x31e0
movq %r15, %rdi
callq 0x32c0
leaq -0x238(%rbp), %rdi
callq 0x3090
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x33c0