// File: /workspace/github_cpp_makefile_star2_O1/yahoo[P]UDPing/src/clientsession.cc
// Function: ClientSessionList::ClientSessionList(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>>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int)
ClientSessionList::ClientSessionList (
                string srcHost, string srcPorts, string dstHost, int dstPort,
                string dstMacList, int interval, int maxPacketSize )
{
    this->numPorts = 0;
    this->maxPacketSize = maxPacketSize;
    this->srcAddr = getSockAddr(srcHost.c_str(), dstPort);
    this->dstAddr = getSockAddr(dstHost.c_str(), dstPort);
    this->interval = interval;
    this->dstPort = dstPort;
    memset (srcMac, 0, 6);
    if (getIfInfo(srcHost.c_str(), &ifIndex, srcMac) < 0) {
        cerr << "getIfInfo failed" << endl;
        exit (-1);
    }
    socketFD = socket (PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
    if (socketFD < 0) {
        cerr << "socket() failed" << endl;
        exit (-1);
    }
    if (string::npos != srcPorts.find_first_not_of("1234567890,-")) {
        cerr << "Invalid source port descriptor " << srcPorts << endl;
        exit (-1);
    }
    char ports [1000];
    strncpy(ports, srcPorts.c_str(), 1000);
    char* curRange;
    char* curRangePtr = 0 ;
    char* pports = ports;
    while (curRange = strtok_r(pports, ",", &curRangePtr)) {
        pports = 0;
        char* startString = curRange;
        char* endString = 0;
        if (endString = strchr(curRange, '-')) {
            *endString = 0;
            endString++;
        }
        int start = atoi(startString);
        int end = start;
        if (endString) {
            end = atoi(endString);
        }
        if (isValidPort(start) && isValidPort(end) && (start <= end)) {
            for (int ix = start; ix <= end; ix++) {
                if (getOptions()->getFlagOption('v')) {
                    cout << "Adding port " << ix << endl;
                }
                sessions.push_back(new ClientSession(ix, dstMacList, this));
                this->numPorts ++;
            }
        } else {
            cerr << "Invalid port range " << start << "-" << end << endl;
            exit(-1);
        }
        if (sessions.size() > MAX_SOCKETS) {
            cerr << "Too many ports defined"<< endl;
            exit (-1);
        }
        if (sessions.size() == 0) {
            cerr << "No ports defined"<< endl;
            exit (-1);
        }
    }
    this->curSession = this->sessions.begin();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %r9, 0x10(%rsp)
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
movl 0x4c8(%rsp), %eax
leaq 0x8(%rdi), %rbx
movq %rbx, 0x10(%rdi)
movq %rbx, 0x8(%rdi)
movl $0x0, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movl %eax, 0x4(%rdi)
movq (%rsi), %rsi
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x2130
leaq 0x80(%rsp), %rdi
movl %ebp, %esi
callq 0x3cb9
movq %rax, 0x28(%r15)
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x412b
callq 0x2280
movq (%r12), %rsi
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x2130
movq %r14, %r12
leaq 0x60(%rsp), %rdi
movl %ebp, %esi
callq 0x3cb9
movl 0x4c0(%rsp), %r14d
movq %rax, 0x30(%r15)
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x416f
callq 0x2280
movl %r14d, 0x48(%r15)
movl %ebp, 0x4c(%r15)
movl $0x0, 0x3c(%r15)
movw $0x0, 0x40(%r15)
movq (%r13), %rsi
leaq 0x40(%rsp), %rdi
leaq 0xa0(%rsp), %r13
movq %r13, %rdx
callq 0x2130
leaq 0x3c(%r15), %rdx
leaq 0x38(%r15), %rsi
leaq 0x40(%rsp), %rdi
callq 0x4b64
movl %eax, %ebp
movq %r12, %r14
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41c9
callq 0x2280
testl %ebp, %ebp
js 0x449c
movl $0x11, %edi
movl $0x3, %esi
movl $0x300, %edx            # imm = 0x300
callq 0x20d0
movl %eax, 0x44(%r15)
testl %eax, %eax
js 0x44c2
leaq 0x1558(%rip), %rsi      # 0x5750
movl $0xc, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x23d0
cmpq $-0x1, %rax
jne 0x44e8
leaq 0x18(%r15), %rax
movq %rax, 0x8(%rsp)
movq (%r14), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
movq %r13, %rdi
callq 0x2180
leaq 0x18(%rsp), %rax
movq $0x0, (%rax)
leaq 0x30(%rsp), %r14
movq %r13, %rdi
leaq 0x1538(%rip), %rsi      # 0x577d
leaq 0x18(%rsp), %rdx
callq 0x2430
testq %rax, %rax
je 0x4400
movq %rax, %r12
movq %rax, %rdi
movl $0x2d, %esi
callq 0x2120
testq %rax, %rax
je 0x4278
movq %rax, %rbp
movb $0x0, (%rax)
incq %rbp
jmp 0x427a
xorl %ebp, %ebp
leaq 0x20(%rsp), %r13
movq %r12, %rdi
callq 0x23a0
movl %eax, %r12d
movl %eax, 0x4(%rsp)
testq %rbp, %rbp
je 0x429f
movq %rbp, %rdi
callq 0x23a0
movl %eax, 0x4(%rsp)
movl %r12d, %edi
callq 0x4048
movl 0x4(%rsp), %ebp
movl %ebp, %edi
callq 0x4048
cmpl %ebp, %r12d
jg 0x441a
incl %ebp
movl %ebp, 0x4(%rsp)
callq 0x3974
movq %rax, %rdi
movl $0x76, %esi
callq 0x3942
testl %eax, %eax
je 0x4328
movl $0xc, %edx
movq 0x3ced(%rip), %rdi      # 0x7fd0
leaq 0x1495(%rip), %rsi      # 0x577f
callq 0x22e0
movq 0x3cda(%rip), %rdi      # 0x7fd0
movl %r12d, %esi
callq 0x23e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x22a0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x21a0
movl $0x840, %edi            # imm = 0x840
callq 0x22d0
movq %rax, %rbp
movq %r14, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x36ea
movq %r15, %rcx
movq %r13, %rdx
movq %r14, %r13
movb $0x1, %r14b
movq %rbp, %rdi
movl %r12d, %esi
callq 0x4692
xorl %r14d, %r14d
movl $0x18, %edi
callq 0x22d0
movq %rbp, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2080
movq 0x8(%rsp), %rax
incq (%rax)
movq 0x20(%rsp), %rdi
movq %r13, %r14
cmpq %r13, %rdi
je 0x439e
callq 0x2280
incl (%r15)
incl %r12d
cmpl %r12d, 0x4(%rsp)
leaq 0x20(%rsp), %r13
jne 0x42c1
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq $0x1388, %rax           # imm = 0x1388
ja 0x446e
movl $0x0, %r13d
testq %rax, %rax
jne 0x423b
movq 0x3c12(%rip), %rdi      # 0x7ff0
leaq 0x13d2(%rip), %rsi      # 0x57b7
movl $0x10, %edx
callq 0x22e0
movq 0x3bfa(%rip), %rdi      # 0x7ff0
callq 0x2160
jmp 0x4492
movq 0x8(%r15), %rax
movq %rax, 0x20(%r15)
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3bcf(%rip), %rdi      # 0x7ff0
leaq 0x1364(%rip), %rsi      # 0x578c
movl $0x13, %edx
callq 0x22e0
movq 0x3bb7(%rip), %rdi      # 0x7ff0
movl %r12d, %esi
callq 0x23e0
movq %rax, %r14
leaq 0x1310(%rip), %rsi      # 0x575b
movl $0x1, %edx
movq %rax, %rdi
callq 0x22e0
movq %r14, %rdi
movl 0x4(%rsp), %esi
callq 0x23e0
movq %rax, %rdi
callq 0x2160
jmp 0x4492
movq 0x3b7b(%rip), %rdi      # 0x7ff0
leaq 0x1324(%rip), %rsi      # 0x57a0
movl $0x16, %edx
callq 0x22e0
movq 0x3b63(%rip), %rdi      # 0x7ff0
callq 0x2160
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2310
movq 0x3b4d(%rip), %rdi      # 0x7ff0
leaq 0x1285(%rip), %rsi      # 0x572f
movl $0x10, %edx
callq 0x22e0
movq 0x3b35(%rip), %rdi      # 0x7ff0
callq 0x2160
jmp 0x4492
movq 0x3b27(%rip), %rdi      # 0x7ff0
leaq 0x1270(%rip), %rsi      # 0x5740
movl $0xf, %edx
callq 0x22e0
movq 0x3b0f(%rip), %rdi      # 0x7ff0
callq 0x2160
jmp 0x4492
movq 0x3b01(%rip), %rdi      # 0x7ff0
leaq 0x1267(%rip), %rsi      # 0x575d
movl $0x1f, %edx
callq 0x22e0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq 0x3ae0(%rip), %rdi      # 0x7ff0
callq 0x22e0
movq %rax, %rdi
callq 0x2160
jmp 0x4492
movq %rax, %r12
leaq 0x50(%rsp), %rax
jmp 0x4545
jmp 0x4583
movq %rax, %r12
leaq 0x70(%rsp), %rax
jmp 0x4545
jmp 0x4583
movq %rax, %r12
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x457c
jmp 0x4586
jmp 0x4583
jmp 0x4583
jmp 0x4583
jmp 0x4583
jmp 0x4583
movq %rax, %r12
movb $0x1, %r14b
jmp 0x4574
movq %rax, %r12
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x4574
callq 0x2280
testb %r14b, %r14b
je 0x4586
movq %rbp, %rdi
callq 0x2280
jmp 0x4586
movq %rax, %r12
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x459e
movq (%rdi), %r14
callq 0x2280
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x458e
movq %r12, %rdi
callq 0x2400