// File: /workspace/github_cpp_makefile_star2_O1/supragya[P]DirectorySync/DirectorySync.cpp
// Function: main
int main( int argc, char **argv)
{
    if(argc != 5){
        std::cout<<"[MAIN] Usage: <programexec> <FolderName> <droid_IP> <SendPORT> <RecvPORT>"<<std::endl;
        exit(-1);
    }
    std::cout<<"    __________________________________________"<<std::endl;
    std::cout<<"  /_________________________________________ |"<<std::endl;
    std::cout<<" /----------------------------------------+ ||"<<std::endl;
    std::cout<<"|                                         | ||"<<std::endl;
    std::cout<<"|              DIRECTORY SYNC             | |+"<<std::endl;
    std::cout<<"|                                         |-+"<<std::endl;
    std::cout<<"+-----------------------------------------+"<<std::endl;

    std::cout<<"[MAIN] Setting up connections "<<std::endl;
    std::thread RConnect(set_reader_connection, atoi(argv[4]), argv[2]);
    std::thread FConnect(set_filewatcher_connection, atoi(argv[3]), argv[2]);
    RConnect.join();
    FConnect.join();
    std::cout<<"[MAIN] Connections setup!"<<std::endl;
    char empty[] = "";
    std::thread listener(reader, argv[1], RCsock);
    std::thread watcher(filewatcher, argv[1], empty, FCsock);
    std::thread closer(closeallsystems);
    listener.join();
    watcher.join();
    closer.join();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
cmpl $0x5, %edi
jne 0x282f
movq %rsi, %rbx
movq 0x5ab6(%rip), %r14      # 0x7fd0
leaq 0x2b49(%rip), %rsi      # 0x506a
movl $0x2e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b3d(%rip), %rsi      # 0x5099
movl $0x2e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b31(%rip), %rsi      # 0x50c8
movl $0x2e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b25(%rip), %rsi      # 0x50f7
movl $0x2e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b19(%rip), %rsi      # 0x5126
movl $0x2e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b0d(%rip), %rsi      # 0x5155
movl $0x2d, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2b00(%rip), %rsi      # 0x5183
movl $0x2b, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x2af1(%rip), %rsi      # 0x51af
movl $0x1e, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x20(%rbx), %rdi
callq 0x2290
leaq -0x28(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x10(%rbx), %r14
leaq 0x182(%rip), %rsi       # 0x288e
leaq -0x40(%rbp), %rdi
movq %r14, %rcx
callq 0x3de6
movq 0x18(%rbx), %rdi
callq 0x2290
leaq -0x20(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x337(%rip), %rsi       # 0x2a65
leaq -0x28(%rbp), %rdi
movq %r14, %rcx
callq 0x3de6
leaq -0x40(%rbp), %rdi
callq 0x22b0
leaq -0x28(%rbp), %rdi
callq 0x22b0
movq 0x587d(%rip), %r14      # 0x7fd0
leaq 0x2a74(%rip), %rsi      # 0x51ce
movl $0x19, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq 0x584b(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movb $0x0, -0x11(%rbp)
addq $0x8, %rbx
leaq 0x3be(%rip), %rsi       # 0x2b5f
leaq 0x1eae4(%rip), %rcx     # 0x2128c
leaq -0x20(%rbp), %rdi
movq %rbx, %rdx
callq 0x3e84
leaq 0x5c6(%rip), %rsi       # 0x2d81
leaq 0x1eac6(%rip), %r8      # 0x21288
leaq -0x38(%rbp), %rdi
leaq -0x11(%rbp), %rcx
movq %rbx, %rdx
callq 0x3f22
leaq 0x12d1(%rip), %rsi      # 0x3aaa
leaq -0x30(%rbp), %rdi
callq 0x3fc8
leaq -0x20(%rbp), %rdi
callq 0x22b0
leaq -0x38(%rbp), %rdi
callq 0x22b0
leaq -0x30(%rbp), %rdi
callq 0x22b0
cmpq $0x0, -0x30(%rbp)
jne 0x2889
cmpq $0x0, -0x38(%rbp)
jne 0x2889
cmpq $0x0, -0x20(%rbp)
jne 0x2889
cmpq $0x0, -0x28(%rbp)
jne 0x2889
cmpq $0x0, -0x40(%rbp)
jne 0x2889
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x579a(%rip), %rdi      # 0x7fd0
leaq 0x27e3(%rip), %rsi      # 0x5020
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2200
jmp 0x2863
jmp 0x286a
jmp 0x2873
jmp 0x287a
cmpq $0x0, -0x30(%rbp)
jne 0x2889
cmpq $0x0, -0x38(%rbp)
jne 0x2889
cmpq $0x0, -0x20(%rbp)
je 0x2873
jmp 0x2889
cmpq $0x0, -0x28(%rbp)
jne 0x2889
cmpq $0x0, -0x40(%rbp)
jne 0x2889
movq %rax, %rdi
callq 0x22f0
callq 0x2080