// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
cmpq $0x0, 0x8(%rsi)
je 0x70f9
movq (%rsi), %rbx
movsbl (%rbx), %eax
addl $-0x30, %eax
cmpl $0xa, %eax
jae 0x70f9
movq %rcx, %r13
movq %rdx, %r14
movq %rdi, -0x38(%rbp)
callq 0x3050
movq %rax, %r15
movl (%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, (%r15)
leaq -0x248(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x3310
cmpq %rbx, (%r12)
je 0x71e3
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x71ef
movl (%r15), %ebx
cmpl $0x22, %ebx
je 0x71ef
testl %ebx, %ebx
jne 0x7000
movl -0x30(%rbp), %ebx
movl %ebx, (%r15)
cmpq $0x0, 0x8(%r13)
je 0x70f9
movq %rax, -0x30(%rbp)
movq (%r13), %r12
movl $0x0, (%r15)
leaq -0x248(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x3310
cmpq %r12, (%r13)
je 0x71fb
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rcx
cmpq %rdx, %rcx
jb 0x7207
movq %rax, %r12
movl (%r15), %eax
cmpl $0x22, %eax
je 0x7207
testl %eax, %eax
jne 0x706b
movl %ebx, (%r15)
testl %r12d, %r12d
js 0x70f9
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movq %r13, %rdi
callq 0x3030
movq %rax, %r15
movq %r12, %rbx
leaq -0x248(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
movl $0xc, %edx
callq 0x33b0
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x228(%rbp,%rax)
je 0x7122
movq 0x5f0c(%rip), %rdi      # 0xcfc8
leaq 0x2068(%rip), %rsi      # 0x912b
movl $0xe, %edx
callq 0x3260
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x5eed(%rip), %rdi      # 0xcfc8
callq 0x3260
leaq 0x2053(%rip), %rsi      # 0x913a
movl $0x8, %edx
movq %rax, %rdi
callq 0x3260
jmp 0x71c5
movq 0x5ec8(%rip), %rdi      # 0xcfc8
leaq 0x2013(%rip), %rsi      # 0x911a
movl $0x10, %edx
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3260
movq %rbx, %r14
leaq -0x248(%rbp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x32b0
movq -0x38(%rbp), %rbx
leaq -0x248(%rbp), %rdi
callq 0x3070
movq -0x30(%rbp), %rax
movl %eax, 0x1020(%rbx)
movl %r15d, 0x1024(%rbx)
movl %r14d, 0x1028(%rbx)
movq 0x1400(%rbx), %rdi
callq 0x4bec
movq %rbx, %rdi
callq 0x6398
testb %al, %al
jne 0x71c5
movq 0x5e4a(%rip), %rdi      # 0xcfc8
leaq 0x1fbe(%rip), %rsi      # 0x9143
movl $0xb, %edx
callq 0x3260
movl 0x20(%rbx), %esi
movq 0x5e2f(%rip), %rdi      # 0xcfc8
callq 0x3160
movq %rax, %rbx
leaq 0x1fa7(%rip), %rsi      # 0x914f
movl $0xa, %edx
movq %rax, %rdi
callq 0x3260
movq %rbx, %rdi
callq 0x3110
movq %r15, %rdi
callq 0x32d0
leaq -0x248(%rbp), %rdi
callq 0x3090
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20cd(%rip), %rdi      # 0x92b7
callq 0x3150
leaq 0x20c1(%rip), %rdi      # 0x92b7
callq 0x3320
leaq 0x20b5(%rip), %rdi      # 0x92b7
callq 0x3150
leaq 0x20a9(%rip), %rdi      # 0x92b7
callq 0x3320
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x7241
movl %ebx, (%r15)
jmp 0x7241
movq %rax, %r14
leaq -0x248(%rbp), %rdi
callq 0x3090
jmp 0x7241
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x7241
movl -0x30(%rbp), %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x33e0
nop