// File: /workspace/github_cpp_makefile_star2_O1/dcdolson[P]nsh-sf-devkit/examples/count/main.cpp
// Function: main
int main(int argc, char** argv)
{
    try
    {
        auto interface = nshdev::NetInterfaceFactory::CreateInterfaceFromArgs(argc, argv);
        if(interface == nullptr)
        {
            std::cerr << "Failed to create interface" << std::endl;
            return 2;
        }

        nshdev::Demux demux;
        interface->SetConsumer(&demux);

        PacketCounter packetCounter;
        demux.SetConsumer(&packetCounter);

        nshdev::Scheduler scheduler(*interface);

        scheduler.SchedulePackets();

	}
    catch(const std::exception& e)
    {
        std::cerr << "Caught exception (aborting)" << std::endl << e.what() << std::endl;
    }

    return 1;  // can only get here by exception
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
leaq 0x2c(%rsp), %rax
movl %edi, (%rax)
leaq 0x40(%rsp), %rdx
movq %rsi, (%rdx)
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x29c0
movq 0x8(%rsp), %r14
testq %r14, %r14
je 0x2625
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x35e8
movq 0x8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2694
movq %rbx, 0x8(%rax)
leaq 0x45cb(%rip), %rax      # 0x6b90
addq $0x10, %rax
leaq 0x48(%rsp), %rbx
movq %rax, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
xorl %edi, %edi
callq 0x21d0
movq %rax, 0x18(%rbx)
movq %rbx, 0x20(%rsp)
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x36f4
leaq 0x30(%rsp), %rdi
callq 0x3706
leaq 0x4700(%rip), %rax      # 0x6d08
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2621
movq (%rdi), %rax
callq *0x8(%rax)
xorl %ebx, %ebx
jmp 0x2670
movq 0x49bc(%rip), %rbx      # 0x6fe8
leaq 0x19d1(%rip), %rsi      # 0x4004
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0x498a(%rip), %rdi      # 0x6fe8
callq 0x2030
movl $0x2, %ebx
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2680
movq (%rdi), %rax
callq *0x8(%rax)
testq %r14, %r14
je 0x268a
movl $0x1, %ebx
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
leaq 0x19a0(%rip), %rdi      # 0x403b
leaq 0x19a5(%rip), %rsi      # 0x4047
leaq 0x19c6(%rip), %rcx      # 0x406f
movl $0x1b, %edx
callq 0x2130
jmp 0x26ee
movq %rdx, %r14
movq %rax, %rbx
jmp 0x270d
movq %rdx, %r14
movq %rax, %rbx
leaq 0x463e(%rip), %rax      # 0x6d08
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x26e3
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x18(%rsp)
jmp 0x26f4
movq %rdx, %r14
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2704
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x8(%rsp)
cmpl $0x1, %r14d
jne 0x2773
movq %rbx, %rdi
callq 0x20f0
movq %rax, %rbx
movq 0x48c3(%rip), %rdi      # 0x6fe8
leaq 0x18f3(%rip), %rsi      # 0x401f
movl $0x1b, %edx
callq 0x2220
movq 0x48ab(%rip), %rdi      # 0x6fe8
callq 0x2110
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
callq 0x2110
callq 0x22a0
jmp 0x2685
movq %rax, %rbx
callq 0x22a0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0x2783