LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/ipatix[P]wav2agb/converter.cpp
// Function: dpcm_lookahead(int&, unsigned long&, double const*, unsigned long, int)
static void dpcm_lookahead(
        int& minimumError, size_t& minimumErrorIndex,
        const double *sampleBuf, const size_t lookahead, const int prevLevel)
{
    if (lookahead == 0) {
        minimumError = 0;
        return;
    }

    minimumError = std::numeric_limits<int>::max();
    minimumErrorIndex = dpcmLookupTable.size();

    for (size_t i = 0; i < dpcmLookupTable.size(); i++) {
        int newLevel = prevLevel + dpcmLookupTable[i];

        int recMinimumError;
        size_t recMinimumErrorIndex;

        // TODO apply dither noise
        int s = clamp(static_cast<int>(floor(sampleBuf[0] * 128.0)), -128, 127);
        int errorEstimation = squared(s - newLevel);
        if (errorEstimation >= minimumError)
            continue;

        dpcm_lookahead(recMinimumError, recMinimumErrorIndex,
                sampleBuf + 1, lookahead - 1, newLevel);

        // TODO weigh the error squared
        int error = squared(s - newLevel) + recMinimumError;
        if (error < minimumError) {
            if (newLevel <= 127 && newLevel >= -128) {
                minimumError = error;
                minimumErrorIndex = i;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x10(%rsp)
testq %rcx, %rcx
je 0x3051
movq %rdi, 0x8(%rsp)
movl $0x7fffffff, (%rdi)     # imm = 0x7FFFFFFF
movq 0x62dc(%rip), %r13      # 0x9248
movq 0x62cd(%rip), %rax      # 0x9240
movq %rax, 0x28(%rsp)
subq %rax, %r13
movq %rsi, 0x18(%rsp)
movq %r13, (%rsi)
je 0x3057
movq 0x8(%rsp), %rax
movl (%rax), %r15d
movq %rdx, %rbx
movsd (%rdx), %xmm0
mulsd 0x3088(%rip), %xmm0     # 0x6028
movl %r8d, (%rsp)
callq 0x2380
movl (%rsp), %ecx
movsd 0x307c(%rip), %xmm1     # 0x6030
maxsd %xmm0, %xmm1
movsd 0x3078(%rip), %xmm0     # 0x6038
minsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addq $0x8, %rbx
movq %rbx, 0x20(%rsp)
decq 0x10(%rsp)
cmpq $0x1, %r13
adcq $0x0, %r13
movsbl %al, %r12d
xorl %ebx, %ebx
movq 0x28(%rsp), %rax
movsbl (%rax,%rbx), %ebp
addl %ecx, %ebp
movl %r12d, %r14d
subl %ebp, %r14d
imull %r14d, %r14d
cmpl %r15d, %r14d
jge 0x3047
leaq 0x4(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rcx
movl %ebp, %r8d
callq 0x2f3e
movsbl %bpl, %eax
cmpl %ebp, %eax
jne 0x3044
addl 0x4(%rsp), %r14d
cmpl %r15d, %r14d
movl (%rsp), %ecx
jge 0x3047
movq 0x8(%rsp), %rax
movl %r14d, (%rax)
movq 0x18(%rsp), %rax
movq %rbx, (%rax)
movl %r14d, %r15d
jmp 0x3047
movl (%rsp), %ecx
incq %rbx
cmpq %rbx, %r13
jne 0x2fe4
jmp 0x3057
movl $0x0, (%rdi)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ipatix[P]wav2agb/wav2agb.cpp
// Function: die(char const*, ...)
static void die(const char *msg, ...) {
    va_list args;
    va_start(args, msg);
    vfprintf(stderr, msg, args);
    va_end(args);
    exit(1);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x3ae3
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rdx
movq %rdi, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x54ce(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movq %r10, %rsi
callq 0x22c0
movl $0x1, %edi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/ipatix[P]wav2agb/wav2agb.cpp
// Function: fix_str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
static void fix_str(std::string& str) {
    // replaces all characters that are not alphanumerical
    for (size_t i = 0; i < str.size(); i++) {
        if (str[i] >= 'a' && str[i] <= 'z')
            continue;
        if (str[i] >= 'A' && str[i] <= 'Z')
            continue;
        if (str[i] >= '0' && str[i] <= '9' && i > 0)
            continue;
        str[i] = '_';
    }
}

// Assembly:
cmpq $0x0, 0x5761(%rip)      # 0x9288
je 0x3b6c
xorl %eax, %eax
movq 0x574e(%rip), %rcx      # 0x9280
movb (%rcx,%rax), %dl
movl %edx, %esi
andb $-0x21, %sil
addb $-0x41, %sil
cmpb $0x1a, %sil
jb 0x3b60
cmpb $0x30, %dl
jl 0x3b5c
cmpb $0x3a, %dl
setl %dl
testq %rax, %rax
setne %sil
testb %dl, %sil
jne 0x3b60
movb $0x5f, (%rcx,%rax)
incq %rax
cmpq 0x571e(%rip), %rax      # 0x9288
jb 0x3b2b
retq
// File: /workspace/github_cpp_makefile_star2_O1/ipatix[P]wav2agb/wav2agb.cpp
// Function: filename_without_ext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static std::string filename_without_ext(const std::string& str) {
    size_t last_path_seperator = 0;
    char *sep = path_seperators;
    while (*sep) {
        size_t pos = str.find_last_of(*sep);
        if (pos != std::string::npos)
            last_path_seperator = std::max(pos, last_path_seperator);
        sep += 1;
    }
    size_t file_ext_dot_pos = str.find_last_of('.');
    if (file_ext_dot_pos == std::string::npos)
        return std::string(str);
    assert(file_ext_dot_pos != last_path_seperator);
    if (file_ext_dot_pos > last_path_seperator)
        return str.substr(0, file_ext_dot_pos);
    return std::string(str);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x2f, %esi
movq $-0x1, %rdx
callq 0x2410
xorl %r15d, %r15d
cmpq $-0x1, %rax
cmovneq %rax, %r15
movq %r14, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x2410
cmpq $-0x1, %rax
je 0x3bca
cmpq %r15, %rax
je 0x3bec
jbe 0x3bca
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x2230
jmp 0x3be3
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3d66
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x29e4(%rip), %rdi      # 0x65d7
leaq 0x2a05(%rip), %rsi      # 0x65ff
leaq 0x2a0a(%rip), %rcx      # 0x660b
movl $0x4a, %edx
callq 0x2170
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: hexdump(unsigned char*, unsigned int)
void hexdump(u8* buf, u32 len){
    for(u32 pos=0;pos<len;pos++){
        printf("%02x ", buf[pos]);
        if(pos%32 == 0 && pos !=0){
            printf("\n");
        }
    }
   printf("\n");
}

// Assembly:
testl %esi, %esi
je 0x3715
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r15d
leaq 0x492f(%rip), %r14      # 0x8004
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3050
testb $0x1f, %r12b
setne %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x3702
movl $0xa, %edi
callq 0x3320
incq %r12
cmpq %r12, %r15
jne 0x36d8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
movl $0xa, %edi
jmp 0x3320
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: createUUID(char*)
int createUUID(char uuid[UUID_LEN]){
    static u8 _rand_init = 0;
    static char randstate[2048];
    if(_rand_init == 0){
        initstate((unsigned int)time(NULL), randstate, 2048);
        setstate(randstate);
        _rand_init = 1;
    }

    u32 r[8];
    for(int x=0;x<8;x++){
        r[x] = (unsigned int)random();
    }
    //Make repres
    //Fix this
    /* IcY: there are 14 arguments specified in the printf format string
     * but 16 arguments?
     */
    sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[0], r[1], r[2], r[3], r[4], r[5]/*, r[6], r[7]*/);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x8b2e(%rip)      # 0xc260
jne 0x3760
xorl %edi, %edi
callq 0x3220
leaq 0x8b2e(%rip), %r14      # 0xc270
movl $0x800, %edx            # imm = 0x800
movl %eax, %edi
movq %r14, %rsi
callq 0x31b0
movq %r14, %rdi
callq 0x32e0
movb $0x1, 0x8b00(%rip)      # 0xc260
xorl %r14d, %r14d
callq 0x3120
movl %eax, (%rsp,%r14,4)
incq %r14
cmpq $0x8, %r14
jne 0x3763
movl (%rsp), %edx
movl 0x4(%rsp), %ecx
movl 0x8(%rsp), %r8d
movl 0xc(%rsp), %r9d
movl 0x10(%rsp), %r10d
movl 0x14(%rsp), %r11d
movl 0x18(%rsp), %r14d
movl 0x1c(%rsp), %r15d
leaq 0x4869(%rip), %rsi      # 0x800a
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %r9
pushq %r8
pushq %rcx
pushq %rdx
pushq %r15
pushq %r14
pushq %r11
pushq %r10
callq 0x3090
addq $0x50, %rsp
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: lefttrim(unsigned char*, unsigned int)
u8* lefttrim(u8* buf, u32 len){
    if(len==0){
        return buf;
    }
    u8* pos = buf;
    while(pos<=(buf+len) && *pos==' '){
        pos++;
    }
    return pos;
}

// Assembly:
movq %rdi, %rax
testl %esi, %esi
je 0x37e6
movl %esi, %ecx
addq %rax, %rcx
cmpb $0x20, (%rax)
jne 0x37e6
incq %rax
cmpq %rcx, %rax
jbe 0x37d9
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: righttrim(unsigned char*, unsigned int)
u32 righttrim(u8* buf, u32 len){
    if(len==0){
        return len;
    }
    u8* pos = buf+len-1;
    while(pos>=buf && *pos==' '){
        pos--;
    }
    return (unsigned int)((pos-buf)+1);
}

// Assembly:
testl %esi, %esi
je 0x3807
movl %esi, %edx
leaq -0x1(%rdi), %rcx
movq %rdx, %rax
leaq (%rcx,%rdx), %rsi
cmpq %rdi, %rsi
jb 0x3806
leaq -0x1(%rax), %rdx
cmpb $0x20, (%rsi)
je 0x37f1
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: caseinstringcmp(unsigned char*, unsigned int, unsigned char*, unsigned int)
int caseinstringcmp(u8* string1, u32 len1, u8* string2, u32 len2){
    u8 ret = 0;

    if(len1 == len2){
        for(int tel=0;tel<(int)len1;tel++){
            if( (string1[tel] >= 'A' && string1[tel]<='Z') || (string1[tel] >= 'a' && string1[tel]<='z') ){
                if( (string1[tel] == string2[tel]) || (string1[tel]+32 == string2[tel]) || (string1[tel]-32 == string2[tel]) ){
                    //equal
                }else{
                    if(string1[tel] > string2[tel]){
                        ret = 1;
                    }else if(string1[tel] < string2[tel]){
                        ret = -1;
                    }
                }
            }else{
                if(string1[tel] > string2[tel]){
                    ret = 1;
                }else if(string1[tel] < string2[tel]){
                    ret = -1;
                }
            }
            if(ret != 0){
                break;
            }
        }
    }else{
        ret = -1;
    }

    return ret;
}

// Assembly:
movl $0xff, %eax
cmpl %ecx, %esi
jne 0x3898
testl %esi, %esi
jle 0x3896
pushq %rbx
movl %esi, %eax
decq %rax
xorl %ecx, %ecx
movl $0xff, %esi
xorl %r8d, %r8d
movzbl (%rdi,%rcx), %r9d
movl %r9d, %r10d
andb $-0x21, %r10b
addb $-0x41, %r10b
cmpb $0x19, %r10b
ja 0x3865
movb (%rdx,%rcx), %r11b
cmpb %r11b, %r9b
je 0x3860
movzbl %r11b, %r10d
leal 0x20(%r9), %ebx
cmpl %r10d, %ebx
je 0x3860
leal -0x20(%r9), %ebx
cmpl %r10d, %ebx
jne 0x3869
movl %r8d, %r10d
jmp 0x387c
movb (%rdx,%rcx), %r11b
movb $0x1, %r10b
cmpb %r11b, %r9b
ja 0x387c
cmpb %r11b, %r9b
movzbl %r8b, %r10d
cmovbl %esi, %r10d
testb %r10b, %r10b
jne 0x3890
leaq 0x1(%rcx), %r9
movl %r10d, %r8d
cmpq %rcx, %rax
movq %r9, %rcx
jne 0x382b
movzbl %r10b, %eax
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: trimspaces(unsigned char**, unsigned int*)
void trimspaces(u8** buf, u32* len){
    u8 *b = *buf;
    u32 l = *len;
    //left
    b = lefttrim(*buf, *len);
    l = (int)(l - (b - *buf));
    //right
    l = righttrim(b, l);

    *buf = b;
    *len = l;
}

// Assembly:
movl (%rsi), %ecx
movq (%rdi), %rdx
movq %rdx, %rax
testq %rcx, %rcx
je 0x38ba
leaq (%rdx,%rcx), %r8
movq %rdx, %rax
cmpb $0x20, (%rax)
jne 0x38ba
incq %rax
cmpq %r8, %rax
jbe 0x38ad
subl %eax, %edx
addl %ecx, %edx
je 0x38df
movl %edx, %r8d
leaq -0x1(%rax), %rdx
movq %r8, %rcx
leaq (%rdx,%r8), %r9
cmpq %rax, %r9
jb 0x38e1
leaq -0x1(%rcx), %r8
cmpb $0x20, (%r9)
je 0x38c7
jmp 0x38e1
xorl %ecx, %ecx
movq %rax, (%rdi)
movl %ecx, (%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: getchar(unsigned char*, unsigned int, char)
int getchar(u8* buf, u32 len, char c){
    int ret = -1;
    for(int x=0;x<(int)len;x++){
        if(buf[x]==c){
            ret=x;
            break;
        }
    }
    return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %esi, %esi
jle 0x3909
movsbl %dl, %ecx
movl %esi, %esi
xorl %edx, %edx
movzbl (%rdi,%rdx), %r8d
cmpl %ecx, %r8d
je 0x390a
incq %rdx
cmpq %rdx, %rsi
jne 0x38f7
retq
movl %edx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/tools.cpp
// Function: getchar(unsigned char*, unsigned int, char, int)
int getchar(u8* buf, u32 len, char c, int seq){
    int ret = -1;
    int found=0;
    for(int x=0;x<(int)len;x++){
        if(buf[x]==c){
            found++;
            if(found==seq){
                ret=x;
                break;
            }
        }
    }
    return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %esi, %esi
jle 0x393b
movsbl %dl, %edx
movl %esi, %r8d
xorl %esi, %esi
xorl %r9d, %r9d
movzbl (%rdi,%rsi), %r10d
cmpl %edx, %r10d
jne 0x3933
incl %r9d
cmpl %ecx, %r9d
je 0x393c
incq %rsi
cmpq %rsi, %r8
jne 0x3921
retq
movl %esi, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::~SSDP()
SSDP::~SSDP(){
    Stop();
    delete(mParser);
    mParser = NULL;
    mDB->Stop();
    delete(mDB);
    mDB = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x7e32(%rip), %rax      # 0xb8d8
movq %rax, (%rdi)
callq 0x3b7a
movq 0x240(%rbx), %r14
testq %r14, %r14
je 0x3acf
movq %r14, %rdi
callq 0x6988
movl $0x40, %esi
movq %r14, %rdi
callq 0x3280
movq $0x0, 0x240(%rbx)
movq 0x248(%rbx), %rdi
callq 0x4f1c
movq 0x248(%rbx), %r14
testq %r14, %r14
je 0x3b07
movq %r14, %rdi
callq 0x4e0e
movl $0x70, %esi
movq %r14, %rdi
callq 0x3280
movq $0x0, 0x248(%rbx)
movq 0x220(%rbx), %rdi
leaq 0x230(%rbx), %rax
cmpq %rax, %rdi
je 0x3b30
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x200(%rbx), %rdi
leaq 0x210(%rbx), %rax
cmpq %rax, %rdi
je 0x3b4e
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x3b6a
movq 0x60(%rbx), %rsi
subq %rdi, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3280
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x4b3c
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::Stop()
int SSDP::Stop(){
    mReadLoop = 0;
    //@TODO: leave multicast groups
    if (mMulticastSocket > 0) {
        close(mMulticastSocket);
        mMulticastSocket = INVALID_SOCKET;
        close(mUnicastSocket);
        mUnicastSocket = INVALID_SOCKET;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x68(%rdi)
movl 0x8(%rdi), %edi
testl %edi, %edi
jle 0x3ba3
callq 0x3450
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, 0x8(%rbx)
movl 0xc(%rbx), %edi
callq 0x3450
movl %ebp, 0xc(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::NotifyAlive()
int SSDP::NotifyAlive(){
    const char *os=mOS.c_str();
    const char *product=mProduct.c_str();

    char buf[20048];

    sprintf(buf, "NOTIFY * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nCACHE-CONTROL: max-age=100\r\nNT: upnp:rootdevice\r\nNTS: ssdp:alive\r\nSERVER: %s/14.0.0, %s, UPnP/1.1\r\nX-User-Agent: fkuehne-upnpx\r\n\r\n", os, product);

    if(mMulticastSocket != INVALID_SOCKET)
        sendto(mMulticastSocket, buf, strlen(buf), 0, (struct sockaddr*)&mDstaddr , sizeof(struct sockaddr));
    else
        printf("invalid socket\n");

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x4e50, %rsp           # imm = 0x4E50
movq %rdi, %rbx
movq 0x200(%rdi), %rdx
movq 0x220(%rdi), %rcx
leaq 0x3dd0(%rip), %rsi      # 0x80f5
movq %rsp, %rdi
xorl %eax, %eax
callq 0x3090
movl 0x8(%rbx), %ebp
cmpl $-0x1, %ebp
je 0x4360
movq %rsp, %r14
movq %r14, %rdi
callq 0x3100
addq $0x20, %rbx
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
movl $0x10, %r9d
callq 0x3070
jmp 0x436c
leaq 0x404e(%rip), %rdi      # 0x83b5
callq 0x3380
xorl %eax, %eax
addq $0x4e50, %rsp           # imm = 0x4E50
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::NotifyByeBye()
int SSDP::NotifyByeBye(){
    const char *os=mOS.c_str();
    const char *product=mProduct.c_str();

    char buf[20048];

    sprintf(buf, "NOTIFY * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nCACHE-CONTROL: max-age=100\r\nNT: upnp:rootdevice\r\nNTS: ssdp:byebye\r\nSERVER: %s, %s, UPnP/1.1\r\nX-User-Agent: fkuehne-upnpx\r\n\r\n", os, product);

    if(mMulticastSocket != INVALID_SOCKET)
        sendto(mMulticastSocket, buf, strlen(buf), 0, (struct sockaddr*)&mDstaddr , sizeof(struct sockaddr));
    else
        printf("invalid socket\n");

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x4e50, %rsp           # imm = 0x4E50
movq %rdi, %rbx
movq 0x200(%rdi), %rdx
movq 0x220(%rdi), %rcx
leaq 0x3e0a(%rip), %rsi      # 0x81a7
movq %rsp, %rdi
xorl %eax, %eax
callq 0x3090
movl 0x8(%rbx), %ebp
cmpl $-0x1, %ebp
je 0x43d8
movq %rsp, %r14
movq %r14, %rdi
callq 0x3100
addq $0x20, %rbx
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
movl $0x10, %r9d
callq 0x3070
jmp 0x43e4
leaq 0x3fd6(%rip), %rdi      # 0x83b5
callq 0x3380
xorl %eax, %eax
addq $0x4e50, %rsp           # imm = 0x4E50
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::RemoveObserver(SSDPObserver*)
int SSDP::RemoveObserver(SSDPObserver* observer){
    u8 found = 0;
    int tel = 0;
    std::vector<SSDPObserver*>::iterator it;
    for(it=mObservers.begin();it<mObservers.end();it++){
        if(observer == *it){
            //Remove this one and stop
            found = 1;
            break;
        }
        tel++;
    }
    if(found){
        mObservers.erase(mObservers.begin()+tel);
    }
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
movq 0x58(%rbx), %rax
cmpq %rax, %rdi
jae 0x4766
movq %rax, %rdx
subq %rdi, %rdx
addq $-0x8, %rdx
cmpq %rsi, (%rdi)
je 0x4753
addq $0x8, %rdi
addq $-0x8, %rdx
cmpq %rax, %rdi
jb 0x473f
jmp 0x4766
leaq 0x8(%rdi), %rsi
cmpq %rax, %rsi
je 0x4761
callq 0x33c0
addq $-0x8, 0x58(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::IncommingMessage(sockaddr*, unsigned char*, unsigned int)
int SSDP::IncommingMessage(struct sockaddr* sender, u8* buf, u32 len){
//    u8 *address;
    u16 port;

//    address = (u8*)sender->sa_data+2;
    memcpy(&port, sender->sa_data, 2);
    port = ntohs(port);

//    printf("receive from: %d.%d.%d.%d, port %d\n", address[0], address[1], address[2], address[3] , port);

    mParser->ReInit();
    mParser->Parse(sender, buf, len);

    //We have the type and all headers, check the mandatory headers for Advertisement & Search

    //Inform the observer(s)
    std::vector<SSDPObserver*>::const_iterator it;
    for(it=mObservers.begin();it<mObservers.end();it++){
        ((SSDPObserver*)*it)->SSDPMessage(mParser);
    }

    //hexdump(buf, len);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x240(%rdi), %rdi
callq 0x6a1e
movq 0x240(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x6a7c
movq 0x50(%rbx), %r14
cmpq 0x58(%rbx), %r14
jae 0x4b27
movq (%r14), %rdi
movq 0x240(%rbx), %rsi
movq (%rdi), %rax
callq *(%rax)
addq $0x8, %r14
jmp 0x4b0c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::SSDPDB()
SSDPDB::SSDPDB(){
    int ret;

    ret = pthread_mutexattr_init(&mMutexAccessAttr);
    STAT(ret);
    ret = pthread_mutexattr_settype(&mMutexAccessAttr, PTHREAD_MUTEX_RECURSIVE);
    STAT(ret);
    ret = pthread_mutex_init(&mMutexAccess, &mMutexAccessAttr);
     STAT(ret);



EXIT:
    if(ret != 0){
        printf("SSDPDB Error\n");
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq %rbx, %rdi
callq 0x3060
testl %eax, %eax
je 0x4d6b
movl %eax, %ebp
callq 0x3040
movl (%rax), %ecx
leaq 0x36f9(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x3352(%rip), %rdi      # 0x80aa
leaq 0x36d8(%rip), %r9       # 0x8437
movl %ebp, %esi
xorl %edx, %edx
movl $0x2a, %r8d
jmp 0x4de9
movq %rbx, %rdi
movl $0x1, %esi
callq 0x3340
testl %eax, %eax
je 0x4daa
movl %eax, %ebp
callq 0x3040
movl (%rax), %ecx
leaq 0x36ba(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x3313(%rip), %rdi      # 0x80aa
leaq 0x3699(%rip), %r9       # 0x8437
movl %ebp, %esi
xorl %edx, %edx
movl $0x2c, %r8d
jmp 0x4de9
addq $0x38, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3360
testl %eax, %eax
je 0x4e04
movl %eax, %ebx
callq 0x3040
movl (%rax), %ecx
leaq 0x3679(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x32d2(%rip), %rdi      # 0x80aa
leaq 0x3658(%rip), %r9       # 0x8437
movl %ebx, %esi
xorl %edx, %edx
movl $0x2e, %r8d
xorl %eax, %eax
callq 0x3050
leaq 0x3656(%rip), %rdi      # 0x844d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3380
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::Start()
int SSDPDB::Start(){
    int ret = 0;
    pthread_attr_t  attr;

    //Start the cache control thread
    ret = pthread_attr_init(&attr);
    STAT(ret);
    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    STAT(ret);
    ret = pthread_create(&mCacheControlThread, &attr, SSDPDB::sCacheControlLoop, (void*)this);
    pthread_attr_destroy(&attr);
EXIT:
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %r14
leaq 0x8(%rsp), %rdi
callq 0x32f0
testl %eax, %eax
je 0x4e98
movl %eax, %ebx
callq 0x3040
movl (%rax), %ecx
leaq 0x322a(%rip), %rax      # 0x80a4
movq %rax, (%rsp)
leaq 0x3225(%rip), %rdi      # 0x80aa
leaq 0x35ab(%rip), %r9       # 0x8437
movl %ebx, %esi
xorl %edx, %edx
movl $0x44, %r8d
jmp 0x4ed7
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x3300
testl %eax, %eax
je 0x4eea
movl %eax, %ebx
callq 0x3040
movl (%rax), %ecx
leaq 0x31e9(%rip), %rax      # 0x80a4
movq %rax, (%rsp)
leaq 0x31e4(%rip), %rdi      # 0x80aa
leaq 0x356a(%rip), %r9       # 0x8437
movl %ebx, %esi
xorl %edx, %edx
movl $0x46, %r8d
xorl %eax, %eax
callq 0x3050
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x60(%r14), %rdi
leaq 0x1d(%rip), %rdx        # 0x4f12
leaq 0x8(%rsp), %r15
movq %r15, %rsi
movq %r14, %rcx
callq 0x3440
movl %eax, %ebx
movq %r15, %rdi
callq 0x33d0
jmp 0x4ede
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::InsertDevice(unsigned char*, unsigned int)
SSDPDBDevice* SSDPDB::InsertDevice(u8* usn, u32 usnlen){
    SSDPDBDevice* thisdevice = new SSDPDBDevice();
    thisdevice->usn.assign((const char*)usn, (size_t)usnlen);

    Lock();
    mDevices.push_back(thisdevice);
    Unlock();

    return thisdevice;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x150, %edi            # imm = 0x150
callq 0x3260
movq %rax, %r15
movq %rax, %rdi
callq 0x5914
movq %r15, (%rsp)
movq %r15, %rdi
addq $0x48, %rdi
movl %ebp, %r8d
movq 0x50(%r15), %rdx
xorl %esi, %esi
movq %r14, %rcx
callq 0x3390
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x3330
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x4f9c
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x4fa7
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x569a
movq %r14, %rdi
callq 0x31c0
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x150, %esi            # imm = 0x150
movq %r15, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0x3410
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::DeleteDevice(unsigned char*, unsigned int)
int SSDPDB::DeleteDevice(u8* usn, u32 usnlen){
    int tel = 0;
    SSDPDBDevice* thisdevice = NULL;
    int updated = 0;

    Lock();
    unsigned int i=0;
    while(i<mDevices.size()){
        thisdevice = mDevices[i];
        if( (thisdevice->usn.length() == usnlen &&  memcmp(thisdevice->usn.c_str(), usn, usnlen) == 0) ){
            mDevices.erase(mDevices.begin()+i);
            delete(thisdevice);
            updated++;
        }else{
            i++;
        }
    }
    Unlock();

    if(updated > 0){
        DeviceUpdate(NULL);
    }

    return tel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x3330
movq (%rbx), %r15
movq %rbx, 0x8(%rsp)
movq 0x8(%rbx), %r13
cmpq %r15, %r13
je 0x50f9
movq %r14, 0x18(%rsp)
movl %ebp, %ecx
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
movq (%r15,%r12,8), %rbp
cmpq %rcx, 0x50(%rbp)
jne 0x5049
movq 0x48(%rbp), %rdi
movq 0x20(%rsp), %rsi
movq %rcx, %rbx
movq %rcx, %rdx
callq 0x3290
movq %rbx, %rcx
testl %eax, %eax
je 0x506d
incl %r14d
movq 0x8(%rsp), %r13
movl %r14d, %r12d
movq (%r13), %r15
movq 0x8(%r13), %r13
movq %r13, %rax
subq %r15, %rax
sarq $0x3, %rax
cmpq %r12, %rax
ja 0x5024
jmp 0x50b5
leaq (%r15,%r12,8), %rdi
leaq 0x8(%rdi), %rsi
cmpq %r13, %rsi
je 0x5088
subq %rsi, %r13
movq %r13, %rdx
callq 0x33c0
movq %rbx, %rcx
movq 0x8(%rsp), %r13
addq $-0x8, 0x8(%r13)
testq %rbp, %rbp
je 0x50af
movq %rbp, %rdi
callq 0x5bde
movl $0x150, %esi            # imm = 0x150
movq %rbp, %rdi
callq 0x3280
movq %rbx, %rcx
incl 0x4(%rsp)
jmp 0x5051
movq 0x18(%rsp), %rdi
callq 0x31c0
cmpl $0x0, 0x4(%rsp)
jle 0x5101
movl $0x1, 0x14(%rsp)
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %r15
cmpq 0x20(%rbx), %r15
jae 0x5101
leaq 0x14(%rsp), %r14
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
cmpq 0x20(%rbx), %r15
jb 0x50e2
jmp 0x5101
movq %r14, %rdi
callq 0x31c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::DeviceUpdate(SSDPDBDevice*)
void SSDPDB::DeviceUpdate(SSDPDBDevice* device){
    SSDPDBMsg msg;
    std::vector<SSDPDBObserver*>::iterator it;
    msg.type = SSDPDBMsg_DeviceUpdate;
    for(it=mObservers.begin();it<mObservers.end();it++){
        ((SSDPDBObserver*)*it)->SSDPDBMessage(&msg);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl $0x1, 0xc(%rsp)
movq 0x18(%rdi), %r15
cmpq 0x20(%rdi), %r15
jae 0x514a
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
cmpq 0x20(%rbx), %r15
jb 0x5135
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::DeleteDevicesByUuid(unsigned char*, unsigned int)
int SSDPDB::DeleteDevicesByUuid(u8* uuid, u32 uuidlen){
    int tel = 0;
    SSDPDBDevice* thisdevice = NULL;
    int updated = 0;

    Lock();
    unsigned int i=0;
    while(i<mDevices.size()){
        thisdevice = mDevices[i];
        if( (thisdevice->uuid.length() == uuidlen &&  memcmp(thisdevice->uuid.c_str(), uuid, uuidlen) == 0) ){
            mDevices.erase(mDevices.begin()+i);
            delete(thisdevice);
            updated++;
        }else{
            i++;
        }
    }
    Unlock();

    if(updated > 0){
        DeviceUpdate(NULL);
    }

    return tel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x3330
movq (%rbx), %r15
movq %rbx, 0x8(%rsp)
movq 0x8(%rbx), %r13
cmpq %r15, %r13
je 0x5277
movq %r14, 0x18(%rsp)
movl %ebp, %ecx
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
movq (%r15,%r12,8), %rbp
cmpq %rcx, 0x10(%rbp)
jne 0x51c7
movq 0x8(%rbp), %rdi
movq 0x20(%rsp), %rsi
movq %rcx, %rbx
movq %rcx, %rdx
callq 0x3290
movq %rbx, %rcx
testl %eax, %eax
je 0x51eb
incl %r14d
movq 0x8(%rsp), %r13
movl %r14d, %r12d
movq (%r13), %r15
movq 0x8(%r13), %r13
movq %r13, %rax
subq %r15, %rax
sarq $0x3, %rax
cmpq %r12, %rax
ja 0x51a2
jmp 0x5233
leaq (%r15,%r12,8), %rdi
leaq 0x8(%rdi), %rsi
cmpq %r13, %rsi
je 0x5206
subq %rsi, %r13
movq %r13, %rdx
callq 0x33c0
movq %rbx, %rcx
movq 0x8(%rsp), %r13
addq $-0x8, 0x8(%r13)
testq %rbp, %rbp
je 0x522d
movq %rbp, %rdi
callq 0x5bde
movl $0x150, %esi            # imm = 0x150
movq %rbp, %rdi
callq 0x3280
movq %rbx, %rcx
incl 0x4(%rsp)
jmp 0x51cf
movq 0x18(%rsp), %rdi
callq 0x31c0
cmpl $0x0, 0x4(%rsp)
jle 0x527f
movl $0x1, 0x14(%rsp)
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %r15
cmpq 0x20(%rbx), %r15
jae 0x527f
leaq 0x14(%rsp), %r14
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
cmpq 0x20(%rbx), %r15
jb 0x5260
jmp 0x527f
movq %r14, %rdi
callq 0x31c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::RemoveAllDevices()
void SSDPDB::RemoveAllDevices() {
    printf("SSDPDB::RemoveAllDevices\n");
    Lock();
    mDevices.clear();
    Unlock();

    SSDPDBMsg msg;
    std::vector<SSDPDBObserver*>::iterator it;
    msg.type = SSDPDBMsg_DeviceUpdate;
    for(it=mObservers.begin();it<mObservers.end();it++){
        ((SSDPDBObserver*)*it)->SSDPDBMessage(&msg);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x3157(%rip), %rdi      # 0x845a
callq 0x3380
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x3330
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x5321
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x31c0
movl $0x1, 0xc(%rsp)
movq 0x18(%rbx), %r15
cmpq 0x20(%rbx), %r15
jae 0x5355
leaq 0xc(%rsp), %r14
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
cmpq 0x20(%rbx), %r15
jb 0x5340
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::RemoveObserver(SSDPDBObserver*)
int SSDPDB::RemoveObserver(SSDPDBObserver* observer){
    u8 found = 0;
    int tel = 0;
    std::vector<SSDPDBObserver*>::iterator it;
    for(it=mObservers.begin();it<mObservers.end();it++){
        if(observer == *it){
            //Remove this one and stop
            found = 1;
            break;
        }
        tel++;
    }
    if(found){
        mObservers.erase(mObservers.begin()+tel);
    }
    return 0;

}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rbx), %rax
cmpq %rax, %rdi
jae 0x5420
movq %rax, %rdx
subq %rdi, %rdx
addq $-0x8, %rdx
cmpq %rsi, (%rdi)
je 0x540d
addq $0x8, %rdi
addq $-0x8, %rdx
cmpq %rax, %rdi
jb 0x53f9
jmp 0x5420
leaq 0x8(%rdi), %rsi
cmpq %rax, %rsi
je 0x541b
callq 0x33c0
addq $-0x8, 0x20(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::ServiceUpdate(SSDPDBDevice*)
void SSDPDB::ServiceUpdate(SSDPDBDevice* service){
    SSDPDBMsg msg;
    std::vector<SSDPDBObserver*>::iterator it;
    msg.type = SSDPDBMsg_ServiceUpdate;
    for(it=mObservers.begin();it<mObservers.end();it++){
        ((SSDPDBObserver*)*it)->SSDPDBMessage(&msg);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl $0x2, 0xc(%rsp)
movq 0x18(%rdi), %r15
cmpq 0x20(%rdi), %r15
jae 0x545c
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
cmpq 0x20(%rbx), %r15
jb 0x5447
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::UpdateCacheControl(unsigned char*, unsigned int, int)
int SSDPDB::UpdateCacheControl(u8* uuid, u32 uuidlen, int cachecontrol){
    int tel = 0;
    SSDPDBDevice* thisdevice = NULL;

    Lock();
    vector<SSDPDBDevice*>::const_iterator it;
    it=mDevices.begin();
    while(it < mDevices.end()){
        thisdevice = *it;
        if( (thisdevice->uuid.length() == uuidlen &&  memcmp(thisdevice->uuid.c_str(), uuid, uuidlen) == 0) ){
            thisdevice->cachecontrol = cachecontrol;
            thisdevice->lastupdate = systimeinseconds;
            tel++;
        }
        it++;
    }
    Unlock();

    return tel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
addq $0x38, %rdi
movq %rdi, 0x10(%rsp)
callq 0x3330
movq (%r12), %r14
xorl %r13d, %r13d
cmpq 0x8(%r12), %r14
jae 0x54e3
movl %ebp, %ebp
xorl %r13d, %r13d
movq (%r14), %rbx
cmpq %rbp, 0x10(%rbx)
jne 0x54d8
movq 0x8(%rbx), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3290
testl %eax, %eax
jne 0x54d8
movl 0xc(%rsp), %eax
movl %eax, 0x140(%rbx)
xorl %edi, %edi
callq 0x3220
movq %rax, 0x148(%rbx)
incl %r13d
addq $0x8, %r14
cmpq 0x8(%r12), %r14
jb 0x54a1
movq 0x10(%rsp), %rdi
callq 0x31c0
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpdb.cpp
// Function: SSDPDB::CacheControlLoop()
int SSDPDB::CacheControlLoop(){
    mRun = 1;
    SSDPDBDevice* thisdevice = NULL;
    vector<SSDPDBDevice*>::iterator it;
    time_t nows;
    u8 updated;
    while(mRun){
        sleep(CACHE_CONTROL_TIMEOUT);

        Lock();
        updated = 0;
        nows = time(NULL);
        unsigned int i=0;
        while(i<mDevices.size()){
            thisdevice = mDevices[i];
            if((time_t)(thisdevice->lastupdate + thisdevice->cachecontrol) <= nows){
                mDevices.erase(mDevices.begin()+i);
                delete(thisdevice);
                updated++;
            }else{
                i++;
            }
        }
        Unlock();

        if(updated > 0){
            DeviceUpdate(NULL);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movb $0x1, 0x68(%rdi)
leaq 0x38(%rdi), %r13
leaq 0xc(%rsp), %r15
movq %r13, 0x10(%rsp)
movl $0x1e, %edi
callq 0x31a0
movq %r13, %rdi
callq 0x3330
xorl %edi, %edi
callq 0x3220
movq %rax, %r12
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
cmpq %rax, %rdx
je 0x55f7
xorl %ecx, %ecx
xorl %r14d, %r14d
xorl %ebp, %ebp
movq (%rax,%rcx,8), %r13
movl 0x140(%r13), %esi
addq 0x148(%r13), %rsi
cmpq %r12, %rsi
jle 0x5572
incl %r14d
jmp 0x55a9
leaq (%rax,%rcx,8), %rdi
leaq 0x8(%rdi), %rsi
cmpq %rdx, %rsi
je 0x5587
subq %rsi, %rdx
callq 0x33c0
addq $-0x8, 0x8(%rbx)
testq %r13, %r13
je 0x55a6
movq %r13, %rdi
callq 0x5bde
movl $0x150, %esi            # imm = 0x150
movq %r13, %rdi
callq 0x3280
incb %bpl
movl %r14d, %ecx
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
movq %rdx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
cmpq %rcx, %rsi
ja 0x5556
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x31c0
testb %bpl, %bpl
je 0x55ff
movl $0x1, 0xc(%rsp)
movq 0x18(%rbx), %r14
cmpq 0x20(%rbx), %r14
jae 0x55ff
movq (%r14), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *(%rax)
addq $0x8, %r14
jmp 0x55e0
movq %r13, %rdi
callq 0x31c0
cmpb $0x0, 0x68(%rbx)
jne 0x5523
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpmessage.cpp
// Function: SSDPMessage::~SSDPMessage()
SSDPMessage::~SSDPMessage(){
    std::vector<SSDP_HTTP_HEADER*>::iterator it;
    for(it=mHeaderSignature.begin();it<mHeaderSignature.end();it++){
        free(*it);
    }
    mHeaderSignature.clear();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x5ca4(%rip), %rax      # 0xb978
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
movq 0x10(%rdi), %rax
cmpq %rax, %r14
jae 0x5cf6
movq (%r14), %rdi
callq 0x32d0
addq $0x8, %r14
movq 0x10(%rbx), %rax
jmp 0x5cdf
movq 0x8(%rbx), %rdi
cmpq %rdi, %rax
je 0x5d03
movq %rdi, 0x10(%rbx)
testq %rdi, %rdi
je 0x5d1b
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3280
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpmessage.cpp
// Function: SSDPMessage::AddSignatureHeader(char*, char*)
int SSDPMessage::AddSignatureHeader(char* fieldname, char* fieldvalue){
    SSDP_HTTP_HEADER *thisHeader = (SSDP_HTTP_HEADER*)malloc(sizeof(SSDP_HTTP_HEADER));
    thisHeader->fieldname = (u8*)fieldname;
    thisHeader->fieldnamelen = (unsigned int)strlen(fieldname);
    thisHeader->fieldvalue = (u8*)fieldvalue;
    thisHeader->fieldvaluelen = (unsigned int)strlen(fieldvalue);
    mHeaderSignature.push_back(thisHeader);
    return (int)mHeaderSignature.size();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x28, %edi
callq 0x3310
movq %rax, %r14
movq %rax, (%rsp)
movq %r12, (%rax)
movq %r12, %rdi
callq 0x3100
movl %eax, 0x8(%r14)
movq %r15, 0x10(%r14)
movq %r15, %rdi
callq 0x3100
movl %eax, 0x18(%r14)
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x5e73
movq %r14, (%rsi)
addq $0x8, 0x10(%rbx)
jmp 0x5e7f
leaq 0x8(%rbx), %rdi
movq %rsp, %rdx
callq 0x5f40
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
shrq $0x3, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpnotifyalive.cpp
// Function: SSDPNotifyAlive::SSDPNotifyAlive()
SSDPNotifyAlive::SSDPNotifyAlive(){
    AddSignatureHeader((char*)"HOST", (char*)"");
    AddSignatureHeader((char*)"CACHE-CONTROL", (char*)"");
    AddSignatureHeader((char*)"LOCATION", (char*)"");
    AddSignatureHeader((char*)"NT", (char*)"");
    AddSignatureHeader((char*)"NTS", (char*)"ssdp:alive");
    AddSignatureHeader((char*)"SERVER", (char*)"");
    AddSignatureHeader((char*)"USN", (char*)"");
    /* Disabled because some devices don't send it
    AddSignatureHeader("BOOTID.UPNP.ORG", "");
    AddSignatureHeader("CONFIGID.UPNP.ORG", "");
    */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5cb0
leaq 0x5a3d(%rip), %rax      # 0xbac0
movq %rax, (%rbx)
leaq 0x2419(%rip), %rsi      # 0x84a6
leaq 0x22cd(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x2408(%rip), %rsi      # 0x84ab
leaq 0x22b7(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x2400(%rip), %rsi      # 0x84b9
leaq 0x22a1(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x23f3(%rip), %rsi      # 0x84c2
leaq 0x228b(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x23e0(%rip), %rsi      # 0x84c5
leaq 0x23dd(%rip), %rdx      # 0x84c9
movq %rbx, %rdi
callq 0x5e1e
leaq 0x23d9(%rip), %rsi      # 0x84d4
leaq 0x225f(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x23ca(%rip), %rsi      # 0x84db
leaq 0x2249(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5cc6
movq %r14, %rdi
callq 0x3410
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpnotifybye.cpp
// Function: SSDPNotifyBye::SSDPNotifyBye()
SSDPNotifyBye::SSDPNotifyBye(){
    AddSignatureHeader((char*)"HOST", (char*)"");
    AddSignatureHeader((char*)"NT", (char*)"");
    AddSignatureHeader((char*)"NTS", (char*)"ssdp:byebye");
    AddSignatureHeader((char*)"USN", (char*)"");
    /*
    AddSignatureHeader("BOOTID.UPNP.ORG", "");
    AddSignatureHeader("CONFIGID.UPNP.ORG", "");
    */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5cb0
leaq 0x55b5(%rip), %rax      # 0xbb30
movq %rax, (%rbx)
leaq 0x1f21(%rip), %rsi      # 0x84a6
leaq 0x1dd5(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1f27(%rip), %rsi      # 0x84c2
leaq 0x1dbf(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1f14(%rip), %rsi      # 0x84c5
leaq 0x1f96(%rip), %rdx      # 0x854e
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1f14(%rip), %rsi      # 0x84db
leaq 0x1d93(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5cc6
movq %r14, %rdi
callq 0x3410
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpnotifybye.cpp
// Function: SSDPNotifyBye::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*>>)
int SSDPNotifyBye::Process(struct sockaddr* sender, std::vector<SSDP_HTTP_HEADER*> msgheaders){
    int ret = 0;
    u8* usn;
    int usnlen;
    ssdpuuid uuid;

    //Get the Device USN (Unique Service Name)
    ret=GetHeaderValueFromCollection(msgheaders, (u8*)"USN", 3, &usn, &usnlen);
    if(ret != 0 || usnlen<=0){
        ret = -1;
        goto EXIT;
    }

    ret = ParseUSN(usn, usnlen, &uuid);
    if(ret < 0){
        goto EXIT;//Unknown format
    }

    //Delete the UUID
    //Specs : If a control point has received at least one ssdp:byebye message of a root device, any of its embedded devices or any of its
    //        services then the control point can assume that all are no longer available.
    mDB->DeleteDevicesByUuid(uuid.uuid, uuid.uuidlen);



EXIT:
    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x5ea4
leaq 0x1ec2(%rip), %rsi      # 0x84db
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %r14, %rdi
movl $0x3, %edx
callq 0x758c
movl %eax, %ebp
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x6649
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
testl %ebp, %ebp
setne %al
movl 0xc(%rsp), %esi
testl %esi, %esi
setle %cl
orb %al, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0x6687
movq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x7642
movl %eax, %ebp
testl %eax, %eax
js 0x6687
movq 0x20(%rbx), %rdi
movq 0x30(%rsp), %rsi
movl 0x38(%rsp), %edx
callq 0x5154
movl %ebp, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x66af
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3410
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpnotifyupdate.cpp
// Function: SSDPNotifyUpdate::SSDPNotifyUpdate()
SSDPNotifyUpdate::SSDPNotifyUpdate(){
    AddSignatureHeader((char*)"HOST", (char*)"");
    AddSignatureHeader((char*)"LOCATION", (char*)"");
    AddSignatureHeader((char*)"NT", (char*)"");
    AddSignatureHeader((char*)"NTS", (char*)"ssdp:update");
    AddSignatureHeader((char*)"USN", (char*)"");
    /*
    AddSignatureHeader("BOOTID.UPNP.ORG", "");
    AddSignatureHeader("CONFIGID.UPNP.ORG", "");
    AddSignatureHeader("NEXTBOOTID.UPNP.ORG", "");
    */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5cb0
leaq 0x54bd(%rip), %rax      # 0xbba0
movq %rax, (%rbx)
leaq 0x1db9(%rip), %rsi      # 0x84a6
leaq 0x1c6d(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1db6(%rip), %rsi      # 0x84b9
leaq 0x1c57(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1da9(%rip), %rsi      # 0x84c2
leaq 0x1c41(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1d96(%rip), %rsi      # 0x84c5
leaq 0x1e34(%rip), %rdx      # 0x856a
movq %rbx, %rdi
callq 0x5e1e
leaq 0x1d96(%rip), %rsi      # 0x84db
leaq 0x1c15(%rip), %rdx      # 0x8361
movq %rbx, %rdi
callq 0x5e1e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5cc6
movq %r14, %rdi
callq 0x3410
nop
// File: /workspace/github_cpp_makefile_star2_O1/brunokeymolen[P]ssdp/src/ssdpparser.cpp
// Function: SSDPParser::SSDPParser(SSDPDB*)
SSDPParser::SSDPParser(SSDPDB* db):mType(SSDP_TYPE_UNKNOWN){
    mDB = db;

    /*
     * Register all implemented message types
     */
    SSDPMessage* msg;
    msg = new SSDPNotifyAlive();
    msg->SetDB(mDB);
    mMessages.push_back(msg);

    msg = new SSDPNotifyBye();
    msg->SetDB(mDB);
    mMessages.push_back(msg);

    msg = new SSDPNotifyUpdate();
    msg->SetDB(mDB);
    mMessages.push_back(msg);

    msg = new SSDPSearchReq();
    msg->SetDB(mDB);
    mMessages.push_back(msg);

    msg = new SSDPSearchResp();
    msg->SetDB(mDB);
    mMessages.push_back(msg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, (%rdi)
leaq 0x20(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
movq %rsi, 0x38(%rdi)
movl $0x28, %edi
callq 0x3260
movq %rax, %r12
movq %rax, %rdi
callq 0x6070
movq %r12, (%rsp)
movq 0x38(%rbx), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x67f7
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rbx)
jmp 0x6802
movq %rsp, %rdx
movq %r14, %rdi
callq 0x6e5c
movl $0x28, %edi
callq 0x3260
movq %rax, %r12
movq %rax, %rdi
callq 0x6568
movq %r12, (%rsp)
movq 0x38(%rbx), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x6841
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rbx)
jmp 0x684c
movq %rsp, %rdx
movq %r14, %rdi
callq 0x6e5c
movl $0x28, %edi
callq 0x3260
movq %rax, %r12
movq %rax, %rdi
callq 0x66d0
movq %r12, (%rsp)
movq 0x38(%rbx), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x688b
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rbx)
jmp 0x6896
movq %rsp, %rdx
movq %r14, %rdi
callq 0x6e5c
movl $0x28, %edi
callq 0x3260
movq %rax, %r12
movq %rax, %rdi
callq 0x6f98
movq %r12, (%rsp)
movq 0x38(%rbx), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x68d5
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rbx)
jmp 0x68e0
movq %rsp, %rdx
movq %r14, %rdi
callq 0x6e5c
movl $0x28, %edi
callq 0x3260
movq %rax, %r12
movq %rax, %rdi
callq 0x702c
movq %r12, (%rsp)
movq 0x38(%rbx), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x691f
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rbx)
jmp 0x692a
movq %rsp, %rdx
movq %r14, %rdi
callq 0x6e5c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x693e
jmp 0x693e
jmp 0x693e
jmp 0x693e
movq %rax, %r15
movl $0x28, %esi
movq %r12, %rdi
callq 0x3280
jmp 0x6953
movq %rax, %r15
leaq 0x8(%rbx), %r12
movq (%r14), %rdi
testq %rdi, %rdi
je 0x696b
movq 0x30(%rbx), %rsi
subq %rdi, %rsi
callq 0x3280
movq (%r12), %rdi
testq %rdi, %rdi
je 0x6980
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3410