// File: /workspace/github_cpp_makefile_star2_O1/sun98[P]Mini-DFS/datanode.cpp
// Function: DataServer::read()
void DataServer::read()
{
    int start = 0;
    buf = new char[bufSize];
    while (start < bufSize)
    {
        int offset = start / chunkSize;
        std::string filePath = name_ + "/" + std::to_string(fid) + " " + std::to_string(offset);
        std::ifstream is(filePath);
        // file not found in this server.
        if (!is)
        {
            delete[] buf;
            bufSize = 0;
            break;
        }
        is.read(&buf[start], std::min(chunkSize, bufSize - start));
        start += chunkSize;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, %r14
movl 0xa4(%rdi), %eax
testl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovnsl %eax, %ecx
movslq %ecx, %rdi
callq 0x3030
movq %rax, 0xb0(%r14)
leaq -0xa8(%rbp), %r13
leaq -0x2d0(%rbp), %r15
xorl %eax, %eax
movq %r14, -0x30(%rbp)
cmpl 0xa4(%r14), %eax
jge 0x43db
movq %r15, %rbx
movq %rax, -0x38(%rbp)
cltd
idivl 0x82ef(%rip)            # 0xc288
movl %eax, %r12d
movq %r13, -0xb8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %r15
movq %r15, %rdi
callq 0x4fce
movq %r15, %rdi
leaq 0x5068(%rip), %rsi      # 0x902e
callq 0x34e0
movl 0xa0(%r14), %r15d
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
movl $0x1, %r14d
cmpl $0xa, %r13d
jb 0x402f
movl $0x4, %r14d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4026
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x402c
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x402f
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x3ff6
addl $-0x3, %r14d
jmp 0x402f
addl $-0x2, %r14d
jmp 0x402f
decl %r14d
shrl $0x1f, %r15d
leal (%r14,%r15), %esi
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
movl $0x2d, %edx
callq 0x32f0
addq -0x78(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x4f4d
movq -0xb8(%rbp), %rcx
movl $0xf, %esi
leaq -0xa8(%rbp), %r13
cmpq %r13, %rcx
je 0x407e
movq -0xa8(%rbp), %rsi
movq -0xb0(%rbp), %r8
movq -0x70(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq -0x88(%rbp), %r14
jbe 0x40b1
movl $0xf, %esi
leaq -0x68(%rbp), %rdi
cmpq %rdi, -0x78(%rbp)
je 0x40ac
movq -0x68(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x40c3
movq -0x78(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x3100
jmp 0x40d0
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq %r14, -0x98(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x40f6
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x40fd
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x90(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0x98(%rbp), %rdi
leaq 0x5147(%rip), %rsi      # 0x9271
callq 0x34e0
movq %rbx, -0x2e0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4158
movq %rdx, -0x2e0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x2d0(%rbp)
jmp 0x415e
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, -0x2d8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl %r12d, %r15d
negl %r15d
cmovsl %r12d, %r15d
movl $0x1, %r14d
cmpl $0xa, %r15d
jb 0x41d5
movl $0x4, %r14d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x41cc
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x41d2
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x41d5
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x419c
addl $-0x3, %r14d
jmp 0x41d5
addl $-0x2, %r14d
jmp 0x41d5
decl %r14d
shrl $0x1f, %r12d
leal (%r14,%r12), %esi
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rdi
movl $0x2d, %edx
callq 0x32f0
movl %r12d, %edi
addq -0x58(%rbp), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x4f4d
movq -0x2e0(%rbp), %rcx
movl $0xf, %esi
movq %rbx, %r15
cmpq %rbx, %rcx
je 0x4220
movq -0x2d0(%rbp), %rsi
movq -0x2d8(%rbp), %r8
movq -0x50(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq -0x88(%rbp), %r14
leaq -0xc8(%rbp), %r12
jbe 0x425a
movl $0xf, %esi
leaq -0x48(%rbp), %rdi
cmpq %rdi, -0x58(%rbp)
je 0x4255
movq -0x48(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x426c
movq -0x58(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x3100
jmp 0x4279
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq %r12, -0xd8(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x429f
movq %rdx, -0xd8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc8(%rbp)
jmp 0x42a7
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xd0(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x42d8
callq 0x3270
movq -0x2e0(%rbp), %rdi
cmpq %r15, %rdi
je 0x42e9
callq 0x3270
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x42fa
callq 0x3270
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x430c
callq 0x3270
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x431d
callq 0x3270
leaq -0x2e0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
movl $0x8, %edx
callq 0x3420
movq -0x2e0(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x2c0(%rbp,%rax), %r14d
movq -0x30(%rbp), %rcx
movq 0xb0(%rcx), %rsi
testb $0x5, %r14b
je 0x4376
testq %rsi, %rsi
je 0x4366
movq %rsi, %rdi
callq 0x3340
movq -0x30(%rbp), %rax
movl $0x0, 0xa4(%rax)
jmp 0x43ac
movq -0x38(%rbp), %rbx
movslq %ebx, %rax
addq %rax, %rsi
movl 0xa4(%rcx), %eax
subl %ebx, %eax
movl 0x7efa(%rip), %ecx      # 0xc288
cmpl %ecx, %eax
cmovgel %ecx, %eax
movslq %eax, %rdx
leaq -0x2e0(%rbp), %rdi
callq 0x3320
addl 0x7ee0(%rip), %ebx      # 0xc288
movq %rbx, -0x38(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x30c0
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x43c9
callq 0x3270
testb $0x5, %r14b
movq -0x30(%rbp), %r14
movq -0x38(%rbp), %rax
je 0x3f7e
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x2e0(%rbp), %rdi
callq 0x30c0
jmp 0x440d
jmp 0x441d
movq %rax, %r14
jmp 0x4465
movq %rax, %r14
jmp 0x443c
movq %rax, %r14
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
jmp 0x4485
movq %rax, %r14
jmp 0x4477
movq %rax, %r14
jmp 0x444d
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x443c
callq 0x3270
movq -0x2e0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x444d
callq 0x3270
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x4465
callq 0x3270
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x4477
callq 0x3270
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x448f
callq 0x3270
movq %r14, %rdi
callq 0x34a0
nop