// File: /workspace/github_cpp_makefile_star2_O3/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::myJoinFinished()
bool FileSystem::myJoinFinished( ){
    
    virtualRingLock.lock();

    int minKey, maxKey;
    bool success;

    VirtualNode target = nNodeLater(3, myPosition);
    if(target != myself ){
        minKey = nNodeBefore(1, myPosition).key;
        maxKey = nNodeBefore(0, myPosition).key;
        success = pullFileFromRange(  target.ip_str, minKey, maxKey, true);
        // cout<<success<<" pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
        logFile<<success<<" myJoinFinished pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
    }
    
    target = nNodeLater(2, myPosition);
    if(target != myself ){
        minKey = nNodeBefore(2, myPosition).key;
        maxKey = nNodeBefore(1, myPosition).key;
        success = pullFileFromRange(  target.ip_str, minKey, maxKey, true);
        // cout<<success<<" pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
        logFile<<success<<" myJoinFinished pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
    }

    target = nNodeLater(1, myPosition);
    if(target != myself ){
        minKey = nNodeBefore(3, myPosition).key;
        maxKey = nNodeBefore(2, myPosition).key;
        success = pullFileFromRange(  target.ip_str, minKey, maxKey, true);
        // cout<<success<<" pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
        logFile<<success<<" myJoinFinished pull key from "<<minKey<<" to "<<maxKey<<" from "<<target.ip_str<<" "<<target.key<<endl;
    }

    virtualRingLock.unlock();

    return success;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
addq $0x268, %rdi            # imm = 0x268
movq %rdi, -0x80(%rbp)
callq 0x44d0
testl %eax, %eax
jne 0xf391
movl 0x290(%r14), %ecx
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0xf3f4
movl 0x20(%rbx), %eax
cmpl 0x2b8(%r14), %eax
je 0xefd3
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xf492
leaq -0x40(%rbp), %rbx
movl 0x10(%rbx), %r12d
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0xee98
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf492
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xeebf
callq 0x4360
leaq -0xd0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x56fa
leaq -0xe0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe678
movl %eax, %r15d
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xef10
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4dee(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x486c(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r12
leaq 0x4dc2(%rip), %rsi      # 0x13d2c
movl $0x6, %edx
movq %rax, %rdi
callq 0x43f0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %r12
leaq 0x4391(%rip), %rsi      # 0x13322
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movl -0x58(%rbp), %esi
movq %r12, %rdi
callq 0x45f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0xf3f4
leaq -0x78(%rbp), %rbx
leaq -0x50(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4410
movl 0x20(%r12), %eax
movl %eax, 0x20(%rbx)
movq (%r12), %rdi
leaq -0x40(%rbp), %rcx
cmpq %rcx, %rdi
je 0xf01b
callq 0x4360
movl -0x58(%rbp), %eax
cmpl 0x2b8(%r14), %eax
je 0xf198
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0xf492
movl -0x30(%rbp), %r12d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf056
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xf492
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf084
callq 0x4360
leaq -0xb0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x56fa
leaq -0xc0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe678
movl %eax, %r15d
movq -0xc0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf0d5
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4c29(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x46a7(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r12
leaq 0x4bfd(%rip), %rsi      # 0x13d2c
movl $0x6, %edx
movq %rax, %rdi
callq 0x43f0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %r12
leaq 0x41cc(%rip), %rsi      # 0x13322
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movl -0x58(%rbp), %esi
movq %r12, %rdi
callq 0x45f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xf3f4
leaq -0x78(%rbp), %rbx
leaq -0x50(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4410
movl 0x20(%r12), %eax
movl %eax, 0x20(%rbx)
movq (%r12), %rdi
leaq -0x40(%rbp), %rcx
cmpq %rcx, %rdi
je 0xf1e0
callq 0x4360
movl -0x58(%rbp), %eax
cmpl 0x2b8(%r14), %eax
je 0xf35d
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0xf492
movl -0x30(%rbp), %r12d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf21b
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0xf492
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf249
callq 0x4360
leaq -0x90(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x56fa
leaq -0xa0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe678
movl %eax, %r15d
movq -0xa0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf29a
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4a64(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x44e2(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r14
leaq 0x4a38(%rip), %rsi      # 0x13d2c
movl $0x6, %edx
movq %rax, %rdi
callq 0x43f0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %r14
leaq 0x4007(%rip), %rsi      # 0x13322
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movl -0x58(%rbp), %esi
movq %r14, %rdi
callq 0x45f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq -0x80(%rbp), %rdi
callq 0x42a0
leaq -0x68(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf378
callq 0x4360
andb $0x1, %r15b
movl %r15d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
movq %rax, %r14
movq -0xa0(%rbp), %rdi
jmp 0xf3c2
jmp 0xf3d6
jmp 0xf3d6
movq %rax, %r14
movq -0xc0(%rbp), %rdi
jmp 0xf3c2
jmp 0xf3d6
jmp 0xf3d6
movq %rax, %r14
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf3d9
callq 0x4360
jmp 0xf3d9
jmp 0xf3d6
jmp 0xf3d6
jmp 0xf3d6
jmp 0xf3d6
movq %rax, %r14
leaq -0x68(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf3eb
callq 0x4360
movq %r14, %rdi
callq 0x4630
nop