// File: ljl0222[P]SecondFileSystem/User.cpp
// Function: User::Write(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::Write(string sfd, string inFile, string size) {
    if (sfd.empty() || !isdigit(sfd.front())) {
        cout << "write����������\n";
        return;
    }
    int fd = stoi(sfd);

    int usize;
    if (size.empty() || (usize = stoi(size)) < 0) {
        cout << "write����������\n";
        return;
    }

    char* buffer = new char[usize];
    fstream fin(inFile, ios::in | ios::binary);
    if (!fin) {
        cout << "���������ļ�  " << inFile << " ʧ�ܣ�\n";
        return;
    }
    fin.read(buffer, usize);
    fin.close();
    u_arg[0] = fd;
    u_arg[1] = (long)buffer;
    u_arg[2] = usize;
    u_FileManager->Write();

    if (IsError())
        return;
    cout << "������д�� " << u_ar0[User::EAX] << "�ֽڳɹ���" << endl;
    delete[]buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rsi, -0x278(%rbp)
movq %rdi, %rax
movq -0x278(%rbp), %rdi
movq %rdi, -0x270(%rbp)
movq %rdx, -0x268(%rbp)
movq %rcx, -0x260(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x258(%rbp)
callq 0x3550
testb $0x1, %al
jne 0xa1ae
movq -0x270(%rbp), %rdi
callq 0x30d0
movsbl (%rax), %edi
callq 0x32b0
cmpl $0x0, %eax
jne 0xa1c6
movq 0x9e13(%rip), %rdi      # 0x13fc8
leaq 0x3f96(%rip), %rsi      # 0xe152
callq 0x32e0
jmp 0xa421
movq -0x270(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0xa920
movq -0x260(%rbp), %rdi
movl %eax, -0x24(%rbp)
callq 0x3550
testb $0x1, %al
jne 0xa20b
movq -0x260(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0xa920
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
jge 0xa223
movq 0x9db6(%rip), %rdi      # 0x13fc8
leaq 0x3f39(%rip), %rsi      # 0xe152
callq 0x32e0
jmp 0xa421
movslq -0x28(%rbp), %rdi
callq 0x3030
movq %rax, -0x30(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0xa960
movq -0x268(%rbp), %rsi
movl %eax, %edx
leaq -0x240(%rbp), %rdi
callq 0x3540
movq -0x240(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x240(%rbp,%rax), %rdi
callq 0x3170
movb %al, -0x279(%rbp)
jmp 0xa274
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0xa280
jmp 0xa2ff
movq 0x9d41(%rip), %rdi      # 0x13fc8
leaq 0x3ed5(%rip), %rsi      # 0xe163
callq 0x32e0
movq %rax, -0x288(%rbp)
jmp 0xa29c
movq -0x268(%rbp), %rsi
movq -0x288(%rbp), %rdi
callq 0x32a0
movq %rax, -0x290(%rbp)
jmp 0xa2b8
movq -0x290(%rbp), %rdi
leaq 0x3eac(%rip), %rsi      # 0xe172
callq 0x32e0
jmp 0xa2cd
movl $0x1, -0x250(%rbp)
jmp 0xa415
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x30b0
jmp 0xa42a
movq -0x30(%rbp), %rsi
movslq -0x28(%rbp), %rdx
leaq -0x240(%rbp), %rdi
callq 0x3400
jmp 0xa315
leaq -0x240(%rbp), %rdi
callq 0x3070
jmp 0xa323
movq -0x258(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, 0x1020(%rax)
movl -0x30(%rbp), %ecx
movl %ecx, 0x1024(%rax)
movl -0x28(%rbp), %ecx
movl %ecx, 0x1028(%rax)
movq 0x1400(%rax), %rdi
callq 0x7040
jmp 0xa353
movq -0x258(%rbp), %rdi
callq 0x9450
movb %al, -0x291(%rbp)
jmp 0xa367
movb -0x291(%rbp), %al
testb $0x1, %al
jne 0xa373
jmp 0xa382
movl $0x1, -0x250(%rbp)
jmp 0xa415
movq 0x9c3f(%rip), %rdi      # 0x13fc8
leaq 0x3deb(%rip), %rsi      # 0xe17b
callq 0x32e0
movq %rax, -0x2a0(%rbp)
jmp 0xa39e
movq -0x2a0(%rbp), %rdi
movq -0x258(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x3480
movq %rax, -0x2a8(%rbp)
jmp 0xa3bd
movq -0x2a8(%rbp), %rdi
leaq 0x3dbc(%rip), %rsi      # 0xe187
callq 0x32e0
movq %rax, -0x2b0(%rbp)
jmp 0xa3d9
movq -0x2b0(%rbp), %rdi
movq 0x9bc9(%rip), %rsi      # 0x13fb0
callq 0x3330
jmp 0xa3ee
movq -0x30(%rbp), %rax
movq %rax, -0x2b8(%rbp)
cmpq $0x0, %rax
je 0xa40b
movq -0x2b8(%rbp), %rdi
callq 0x3430
movl $0x0, -0x250(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x30b0
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0x248(%rbp), %rdi
callq 0x3580
nopw %cs:(%rax,%rax)