// File: /workspace/github_cpp_makefile_star2_O1/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 0xf4dd
movl 0x290(%r14), %ecx
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0xf540
movl 0x20(%rbx), %eax
cmpl 0x2b8(%r14), %eax
je 0xf11f
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xf5d2
leaq -0x40(%rbp), %rbx
movl 0x10(%rbx), %r12d
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0xefe4
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf5d2
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf00b
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 0x570a
leaq -0xe0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe7ca
movl %eax, %r15d
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf05c
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4ca2(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x4720(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r12
leaq 0x4c76(%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 0x4245(%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 0xf540
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), %rax
cmpq %rax, %rdi
je 0xf164
callq 0x4360
movl -0x58(%rbp), %eax
cmpl 0x2b8(%r14), %eax
je 0xf2e4
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0xf5d2
movl -0x30(%rbp), %r12d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf1a2
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xf5d2
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf1d0
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 0x570a
leaq -0xc0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe7ca
movl %eax, %r15d
movq -0xc0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf221
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4add(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x455b(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r12
leaq 0x4ab1(%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 0x4080(%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 0xf540
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), %rax
cmpq %rax, %rdi
je 0xf329
callq 0x4360
movl -0x58(%rbp), %eax
cmpl 0x2b8(%r14), %eax
je 0xf4a9
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0xf5d2
movl -0x30(%rbp), %r12d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf367
callq 0x4360
movl 0x290(%r14), %ecx
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0xf5d2
movl -0x30(%rbp), %r13d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf395
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 0x570a
leaq -0xa0(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl %r13d, %ecx
movl $0x1, %r8d
callq 0xe7ca
movl %eax, %r15d
movq -0xa0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf3e6
callq 0x4360
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x45a0
movq %rax, %rbx
leaq 0x4918(%rip), %rsi      # 0x13d14
movl $0x1e, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x45f0
movq %rax, %rbx
leaq 0x4396(%rip), %rsi      # 0x137b4
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %r14
leaq 0x48ec(%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 0x3ebb(%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 0xf4c4
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 0xf50e
jmp 0xf522
jmp 0xf522
movq %rax, %r14
movq -0xc0(%rbp), %rdi
jmp 0xf50e
jmp 0xf522
jmp 0xf522
movq %rax, %r14
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf525
callq 0x4360
jmp 0xf525
jmp 0xf522
jmp 0xf522
jmp 0xf522
jmp 0xf522
movq %rax, %r14
leaq -0x68(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf537
callq 0x4360
movq %r14, %rdi
callq 0x4630
nop