// File: brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::Start()
int SSDP::Start(){
    int ret = 0;
    u32 optval = 0;

    if(mMulticastSocket != INVALID_SOCKET || mUnicastSocket != INVALID_SOCKET){
        ret = -9;
        goto EXIT;
    }

    //
    //Setup the Multicast Socket
    //
    mMulticastSocket = socket(PF_INET, SOCK_DGRAM, 0);
    STATNVAL(mMulticastSocket, INVALID_SOCKET, EXIT);

    //Set nonblocking
    optval = fcntl( mMulticastSocket, F_GETFL, 0 );
    STATNVAL(optval, -1,  CLEAN_AND_EXIT);
    ret = fcntl(mMulticastSocket, F_SETFL, optval | O_NONBLOCK);
    STATNVAL(ret, -1,  CLEAN_AND_EXIT);

    //Source address
    mSrcaddr.sin_family = PF_INET;
    mSrcaddr.sin_port = 0;//Let the IP stack decide
    mSrcaddr.sin_addr.s_addr = INADDR_ANY;//Default multicast nic

    //Reuse port
    optval = 1;
    ret = setsockopt(mMulticastSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, 4);
    STATVAL(ret, 0, CLEAN_AND_EXIT);
    optval = 1;
    ret = setsockopt(mMulticastSocket, SOL_SOCKET, SO_REUSEPORT, (char*)&optval, 4);
    STATVAL(ret, 0, CLEAN_AND_EXIT);

    #ifdef SO_NOSIGPIPE
    //Never generate SIGPIPE on broken write
    optval = 1;
    ret = setsockopt(mMulticastSocket, SOL_SOCKET, SO_NOSIGPIPE, (void *)&optval, sizeof(int));
    STATVAL(ret, 0, CLEAN_AND_EXIT);
    #endif

    //Disable loopback
    optval = 0;
    ret = setsockopt(mMulticastSocket, IPPROTO_IP, IP_MULTICAST_LOOP, (char*)&optval, sizeof(int));
    STATNVAL(ret, SOCKET_ERROR, CLEAN_AND_EXIT);

    //TTL
    optval = mTTL;
    ret = setsockopt(mMulticastSocket, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&optval, sizeof(int));
    STATNVAL(ret, SOCKET_ERROR, CLEAN_AND_EXIT);

    //buffer size
    optval = 5000;
    ret = setsockopt(mMulticastSocket, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(int));
    STATNVAL(ret, SOCKET_ERROR, CLEAN_AND_EXIT);

    //Add membership
    mMreq.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDRESS);
    mMreq.imr_interface.s_addr = INADDR_ANY;
    ret = setsockopt(mMulticastSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mMreq, sizeof(struct ip_mreq));
    STATNVAL(ret, SOCKET_ERROR, CLEAN_AND_EXIT);


    //Bind to all interface(s)
    ret = ::bind(mMulticastSocket, (struct sockaddr*)&mSrcaddr, sizeof(struct sockaddr));
    if(ret < 0 && (errno == EACCES || errno == EADDRINUSE))
        printf("address in use\n");
    STATVAL(ret, 0, CLEAN_AND_EXIT);


    //Destination address
    mDstaddr.sin_family = PF_INET;
    mDstaddr.sin_addr.s_addr = inet_addr(SSDP_MCAST_ADDRESS);
    mDstaddr.sin_port = htons(SSDP_MCAST_PORT);


    //
    // Setup the Unicast Socket (We listen for Advertisements)
    //
    mUnicastSocket = socket(PF_INET, SOCK_DGRAM, 0);
    STATNVAL(mUnicastSocket, INVALID_SOCKET, EXIT);

    //Set nonblocking
    optval = fcntl( mUnicastSocket, F_GETFL, 0 );
    STATNVAL(optval, -1,  CLEAN_AND_EXIT);
    ret = fcntl(mUnicastSocket, F_SETFL, optval | O_NONBLOCK);
    STATNVAL(ret, -1,  CLEAN_AND_EXIT);

    //Source address
    mUnicastSrcaddr.sin_family = PF_INET;
    mUnicastSrcaddr.sin_port = htons(SSDP_MCAST_PORT);
    mUnicastSrcaddr.sin_addr.s_addr = INADDR_ANY;//Default nic 

    //Reuse port
    optval = 1;
    ret = setsockopt(mUnicastSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, 4);
    STATVAL(ret, 0, CLEAN_AND_EXIT);
    optval = 1;
    ret = setsockopt(mUnicastSocket, SOL_SOCKET, SO_REUSEPORT, (char*)&optval, 4);
    STATVAL(ret, 0, CLEAN_AND_EXIT);

    //Join Multicast group
    mMreqU.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDRESS);
    mMreqU.imr_interface.s_addr = INADDR_ANY;
    ret = setsockopt(mUnicastSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mMreqU, sizeof(struct ip_mreq));
    STATNVAL(ret, SOCKET_ERROR, CLEAN_AND_EXIT);



    //Bind to all interface(s)
    ret = ::bind(mUnicastSocket, (struct sockaddr*)&mUnicastSrcaddr, sizeof(struct sockaddr));
    if(ret < 0 && (errno == EACCES || errno == EADDRINUSE))
        printf("address in use\n");
    STATVAL(ret, 0, CLEAN_AND_EXIT);



    //Start the read thread
    pthread_attr_t  attr;
    ret = pthread_attr_init(&attr);
    if(ret != 0){
        goto CLEAN_AND_EXIT;
    }
    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    if(ret != 0){
        pthread_attr_destroy(&attr);
        goto CLEAN_AND_EXIT;
    }

    ret = pthread_create(&mReadThread, &attr, SSDP::sReadLoop, (void*)this);

    pthread_attr_destroy(&attr);


    goto EXIT;


CLEAN_AND_EXIT:
    close(mMulticastSocket);
    mMulticastSocket = INVALID_SOCKET;
    close(mUnicastSocket);
    mUnicastSocket = INVALID_SOCKET;

EXIT:
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $-0x1, 0x8(%rax)
jne 0x4015
movq -0x50(%rbp), %rax
cmpl $-0x1, 0xc(%rax)
je 0x4021
movl $0xfffffff7, -0xc(%rbp) # imm = 0xFFFFFFF7
jmp 0x4875
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x30c0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $-0x1, 0x8(%rax)
jne 0x4082
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x54(%rbp)
callq 0x3030
movl -0x54(%rbp), %esi
movl (%rax), %ecx
leaq 0xbfff(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x4c, %r8d
leaq 0xc02c(%rip), %r9       # 0x10097
leaq 0xc032(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x4875
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x3170
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x40e0
movl -0x10(%rbp), %eax
movl %eax, -0x58(%rbp)
callq 0x3030
movl -0x58(%rbp), %esi
movl (%rax), %ecx
leaq 0xbfa1(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x50, %r8d
leaq 0xbfce(%rip), %r9       # 0x10097
leaq 0xbfd4(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edi
movl -0x10(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x3170
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x4145
movl -0xc(%rbp), %eax
movl %eax, -0x5c(%rbp)
callq 0x3030
movl -0x5c(%rbp), %esi
movl (%rax), %ecx
leaq 0xbf3c(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x52, %r8d
leaq 0xbf69(%rip), %r9       # 0x10097
leaq 0xbf6f(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movw $0x2, 0x10(%rax)
movw $0x0, 0x12(%rax)
movl $0x0, 0x14(%rax)
movl $0x1, -0x10(%rbp)
movl 0x8(%rax), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x41c5
movl -0xc(%rbp), %eax
movl %eax, -0x60(%rbp)
callq 0x3030
movl -0x60(%rbp), %esi
movl (%rax), %ecx
leaq 0xbf0b(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0x5c, %r8d
leaq 0xbee9(%rip), %r9       # 0x10097
leaq 0xbeef(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl $0x1, -0x10(%rbp)
movl 0x8(%rax), %edi
movl $0x1, %esi
movl $0xf, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4232
movl -0xc(%rbp), %eax
movl %eax, -0x64(%rbp)
callq 0x3030
movl -0x64(%rbp), %esi
movl (%rax), %ecx
leaq 0xbe9e(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0x5f, %r8d
leaq 0xbe7c(%rip), %r9       # 0x10097
leaq 0xbe82(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl $0x0, -0x10(%rbp)
movl 0x8(%rax), %edi
xorl %esi, %esi
movl $0x22, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x429f
movl -0xc(%rbp), %eax
movl %eax, -0x68(%rbp)
callq 0x3030
movl -0x68(%rbp), %esi
movl (%rax), %ecx
leaq 0xbde2(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x6b, %r8d
leaq 0xbe0f(%rip), %r9       # 0x10097
leaq 0xbe15(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movzwl 0x1f8(%rax), %ecx
movl %ecx, -0x10(%rbp)
movl 0x8(%rax), %edi
xorl %esi, %esi
movl $0x21, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x430f
movl -0xc(%rbp), %eax
movl %eax, -0x6c(%rbp)
callq 0x3030
movl -0x6c(%rbp), %esi
movl (%rax), %ecx
leaq 0xbd72(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x70, %r8d
leaq 0xbd9f(%rip), %r9       # 0x10097
leaq 0xbda5(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl $0x1388, -0x10(%rbp)    # imm = 0x1388
movl 0x8(%rax), %edi
movl $0x1, %esi
movl $0x7, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x437f
movl -0xc(%rbp), %eax
movl %eax, -0x70(%rbp)
callq 0x3030
movl -0x70(%rbp), %esi
movl (%rax), %ecx
leaq 0xbd02(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x75, %r8d
leaq 0xbd2f(%rip), %r9       # 0x10097
leaq 0xbd35(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
leaq 0xbd5f(%rip), %rdi      # 0x100e5
callq 0x32e0
movq -0x50(%rbp), %rcx
movl %eax, 0x40(%rcx)
movl $0x0, 0x44(%rcx)
movl 0x8(%rcx), %edi
addq $0x40, %rcx
xorl %esi, %esi
movl $0x23, %edx
movl $0x8, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x43fb
movl -0xc(%rbp), %eax
movl %eax, -0x74(%rbp)
callq 0x3030
movl -0x74(%rbp), %esi
movl (%rax), %ecx
leaq 0xbc86(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x7b, %r8d
leaq 0xbcb3(%rip), %r9       # 0x10097
leaq 0xbcb9(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rsi
movl 0x8(%rsi), %edi
addq $0x10, %rsi
movl $0x10, %edx
callq 0x3080
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x443b
callq 0x3030
cmpl $0xd, (%rax)
je 0x442d
callq 0x3030
cmpl $0x62, (%rax)
jne 0x443b
leaq 0xbcc1(%rip), %rdi      # 0x100f5
movb $0x0, %al
callq 0x3040
cmpl $0x0, -0xc(%rbp)
je 0x447e
movl -0xc(%rbp), %eax
movl %eax, -0x78(%rbp)
callq 0x3030
movl -0x78(%rbp), %esi
movl (%rax), %ecx
leaq 0xbc52(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0x82, %r8d
leaq 0xbc30(%rip), %r9       # 0x10097
leaq 0xbc36(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movw $0x2, 0x20(%rax)
leaq 0xbc56(%rip), %rdi      # 0x100e5
callq 0x32e0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x24(%rax)
movl $0x76c, %edi            # imm = 0x76C
callq 0x3060
movw %ax, %cx
movq -0x50(%rbp), %rax
movw %cx, 0x22(%rax)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x30c0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xc(%rax)
cmpl $-0x1, 0xc(%rax)
jne 0x4513
movq -0x50(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x7c(%rbp)
callq 0x3030
movl -0x7c(%rbp), %esi
movl (%rax), %ecx
leaq 0xbb6e(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x8f, %r8d
leaq 0xbb9b(%rip), %r9       # 0x10097
leaq 0xbba1(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x4875
movq -0x50(%rbp), %rax
movl 0xc(%rax), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x3170
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x4571
movl -0x10(%rbp), %eax
movl %eax, -0x80(%rbp)
callq 0x3030
movl -0x80(%rbp), %esi
movl (%rax), %ecx
leaq 0xbb10(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x93, %r8d
leaq 0xbb3d(%rip), %r9       # 0x10097
leaq 0xbb43(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl 0xc(%rax), %edi
movl -0x10(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x3170
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x45dc
movl -0xc(%rbp), %eax
movl %eax, -0x84(%rbp)
callq 0x3030
movl -0x84(%rbp), %esi
movl (%rax), %ecx
leaq 0xbaa5(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x95, %r8d
leaq 0xbad2(%rip), %r9       # 0x10097
leaq 0xbad8(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movw $0x2, 0x30(%rax)
movl $0x76c, %edi            # imm = 0x76C
callq 0x3060
movw %ax, %cx
movq -0x50(%rbp), %rax
movw %cx, 0x32(%rax)
movl $0x0, 0x34(%rax)
movl $0x1, -0x10(%rbp)
movl 0xc(%rax), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4671
movl -0xc(%rbp), %eax
movl %eax, -0x88(%rbp)
callq 0x3030
movl -0x88(%rbp), %esi
movl (%rax), %ecx
leaq 0xba5f(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0x9f, %r8d
leaq 0xba3d(%rip), %r9       # 0x10097
leaq 0xba43(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rax
movl $0x1, -0x10(%rbp)
movl 0xc(%rax), %edi
movl $0x1, %esi
movl $0xf, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x46e4
movl -0xc(%rbp), %eax
movl %eax, -0x8c(%rbp)
callq 0x3030
movl -0x8c(%rbp), %esi
movl (%rax), %ecx
leaq 0xb9ec(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0xa2, %r8d
leaq 0xb9ca(%rip), %r9       # 0x10097
leaq 0xb9d0(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
leaq 0xb9fa(%rip), %rdi      # 0x100e5
callq 0x32e0
movq -0x50(%rbp), %rcx
movl %eax, 0x48(%rcx)
movl $0x0, 0x4c(%rcx)
movl 0xc(%rcx), %edi
addq $0x48, %rcx
xorl %esi, %esi
movl $0x23, %edx
movl $0x8, %r8d
callq 0x34d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x4766
movl -0xc(%rbp), %eax
movl %eax, -0x90(%rbp)
callq 0x3030
movl -0x90(%rbp), %esi
movl (%rax), %ecx
leaq 0xb91b(%rip), %rdi      # 0x10058
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xa8, %r8d
leaq 0xb948(%rip), %r9       # 0x10097
leaq 0xb94e(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
movq -0x50(%rbp), %rsi
movl 0xc(%rsi), %edi
addq $0x30, %rsi
movl $0x10, %edx
callq 0x3080
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x47a6
callq 0x3030
cmpl $0xd, (%rax)
je 0x4798
callq 0x3030
cmpl $0x62, (%rax)
jne 0x47a6
leaq 0xb956(%rip), %rdi      # 0x100f5
movb $0x0, %al
callq 0x3040
cmpl $0x0, -0xc(%rbp)
je 0x47ec
movl -0xc(%rbp), %eax
movl %eax, -0x94(%rbp)
callq 0x3030
movl -0x94(%rbp), %esi
movl (%rax), %ecx
leaq 0xb8e1(%rip), %rdi      # 0x100aa
xorl %edx, %edx
movl $0xb0, %r8d
leaq 0xb8bf(%rip), %r9       # 0x10097
leaq 0xb8c5(%rip), %rax      # 0x100a4
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3040
jmp 0x484b
leaq -0x48(%rbp), %rdi
callq 0x3380
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4800
jmp 0x484b
leaq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x33a0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4822
leaq -0x48(%rbp), %rdi
callq 0x3490
jmp 0x484b
movq -0x50(%rbp), %rcx
movq %rcx, %rdi
addq $0x70, %rdi
leaq -0x48(%rbp), %rsi
leaq 0x58(%rip), %rdx        # 0x4890
callq 0x34f0
movl %eax, -0xc(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3490
jmp 0x4875
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x3510
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movl 0xc(%rax), %edi
callq 0x3510
movq -0x50(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movl -0xc(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)