// File: /workspace/github_cpp_makefile_star2_O1/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 $0x228, %rsp            # imm = 0x228
cmpq $0x0, 0x8(%rsi)
je 0x74dd
movq (%rsi), %rbx
movsbl (%rbx), %eax
addl $-0x30, %eax
cmpl $0xa, %eax
jae 0x74dd
movq %rcx, %r13
movq %rdi, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
callq 0x3050
movq %rax, %r15
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, (%r15)
leaq -0x250(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x3310
cmpq %rbx, (%r14)
je 0x75e7
movq %rax, %r12
movslq %r12d, %rax
cmpq %r12, %rax
jne 0x75f3
movl (%r15), %eax
cmpl $0x22, %eax
je 0x75f3
testl %eax, %eax
jne 0x7359
movl -0x2c(%rbp), %eax
movl %eax, (%r15)
cmpq $0x0, 0x8(%r13)
je 0x74dd
movq (%r13), %rbx
movsbl (%rbx), %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x74dd
movl (%r15), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, (%r15)
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x3310
cmpq %rbx, (%r14)
je 0x75ff
movq %rax, %r13
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%r13), %rcx
cmpq %rax, %rcx
jb 0x760b
movl (%r15), %eax
cmpl $0x22, %eax
je 0x760b
testl %eax, %eax
jne 0x73d0
movl -0x2c(%rbp), %eax
movl %eax, (%r15)
testl %r13d, %r13d
js 0x74dd
movl %r13d, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
callq 0x3030
movq %rax, %r15
movq -0x40(%rbp), %rax
movl %r12d, 0x1020(%rax)
movq %rax, %r12
movl %r15d, 0x1024(%rax)
movl %r13d, 0x1028(%rax)
movq 0x1400(%rax), %rdi
callq 0x4b3e
movq %r12, %rdi
callq 0x63e4
testb %al, %al
jne 0x75d5
movq 0x5b9f(%rip), %rbx      # 0xcfc8
leaq 0x1d3b(%rip), %rsi      # 0x916b
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3260
movl 0x20(%r12), %esi
movq %rbx, %rdi
callq 0x3160
leaq 0x1d20(%rip), %rsi      # 0x9171
movl $0x12, %edx
movq %rax, %rdi
callq 0x3260
movq -0x38(%rbp), %r14
cmpq $0x0, 0x8(%r14)
je 0x7506
leaq -0x250(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x14, %edx
callq 0x33b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x230(%rbp,%rax)
je 0x7562
movq 0x5b28(%rip), %rdi      # 0xcfc8
leaq 0x1cdd(%rip), %rsi      # 0x9184
movl $0xd, %edx
callq 0x3260
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x5b09(%rip), %rdi      # 0xcfc8
callq 0x3260
leaq 0x1cc7(%rip), %rsi      # 0x9192
movl $0x9, %edx
movq %rax, %rdi
callq 0x3260
jmp 0x75c9
movq 0x5ae4(%rip), %rdi      # 0xcfc8
leaq 0x1c6f(%rip), %rsi      # 0x915a
movl $0x10, %edx
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3260
cmpl $0x0, 0x20(%r12)
je 0x7548
movq %r12, %r13
xorl %r14d, %r14d
movq 0x5aad(%rip), %rbx      # 0xcfc8
leaq -0x250(%rbp), %r12
movb (%r15,%r14), %al
movb %al, -0x250(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3260
incq %r14
movl 0x20(%r13), %eax
cmpq %rax, %r14
jb 0x7522
movq 0x5a79(%rip), %rdi      # 0xcfc8
leaq 0x1b71(%rip), %rsi      # 0x90c7
movl $0x2, %edx
callq 0x3260
jmp 0x75d5
leaq -0x240(%rbp), %rdi
movl 0x20(%r12), %edx
movq %r15, %rsi
callq 0x32f0
leaq -0x250(%rbp), %rdi
callq 0x3070
movq 0x5a3f(%rip), %rdi      # 0xcfc8
leaq 0x1c0c(%rip), %rsi      # 0x919c
movl $0xb, %edx
callq 0x3260
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x5a20(%rip), %rdi      # 0xcfc8
callq 0x3260
leaq 0x1bf4(%rip), %rsi      # 0x91a8
movl $0x9, %edx
movq %rax, %rdi
callq 0x3260
movq %r15, %rdi
callq 0x32d0
leaq -0x250(%rbp), %rdi
callq 0x3090
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cc9(%rip), %rdi      # 0x92b7
callq 0x3150
leaq 0x1cbd(%rip), %rdi      # 0x92b7
callq 0x3320
leaq 0x1cb1(%rip), %rdi      # 0x92b7
callq 0x3150
leaq 0x1ca5(%rip), %rdi      # 0x92b7
callq 0x3320
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3090
jmp 0x7639
jmp 0x762a
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x7639
movl -0x2c(%rbp), %eax
movl %eax, (%r15)
movq %rbx, %rdi
callq 0x33e0
nop