LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_load_file(unsigned char**, unsigned long*, char const*)
unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename)
{
  FILE* file;
  long size;

  /*provide some proper output values if error will happen*/
  *out = 0;
  *outsize = 0;

  file = fopen(filename, "rb");
  if(!file) return 78;

  /*get filesize:*/
  fseek(file , 0 , SEEK_END);
  size = ftell(file);
  rewind(file);

  /*read contents of the file into the vector*/
  *outsize = 0;
  *out = (unsigned char*)lodepng_malloc((size_t)size);
  if(size && (*out)) (*outsize) = fread(*out, 1, (size_t)size, file);

  fclose(file);
  if(!(*out) && size) return 83; /*the above malloc failed*/
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, (%rdi)
movq %rsi, %r14
andq $0x0, (%rsi)
leaq 0xa783(%rip), %rsi      # 0x13f60
movq %rdx, %rdi
callq 0x3240
testq %rax, %rax
je 0x985f
movq %rax, %r15
xorl %r13d, %r13d
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x3230
movq %r15, %rdi
callq 0x3030
movq %rax, %r12
movq %r15, %rdi
callq 0x3050
andq $0x0, (%r14)
movq %r12, %rdi
callq 0x32b0
movq %rax, (%rbx)
testq %r12, %r12
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x9843
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x3320
movq %rax, (%r14)
movq %r15, %rdi
callq 0x31e0
cmpq $0x0, (%rbx)
pushq $0x53
popq %rax
cmovnel %r13d, %eax
testq %r12, %r12
cmovel %r13d, %eax
jmp 0x9862
pushq $0x4e
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: append_symbol_coins(Coin*, unsigned int const*, unsigned int, unsigned long)
static unsigned append_symbol_coins(Coin* coins, const unsigned* frequencies, unsigned numcodes, size_t sum)
{
  unsigned i;
  unsigned j = 0; /*index of present symbols*/
  for(i = 0; i != numcodes; ++i)
  {
    if(frequencies[i] != 0) /*only include symbols that are present*/
    {
      coins[j].weight = frequencies[i] / (float)sum;
      uivector_push_back(&coins[j].symbols, i);
      ++j;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rcx, %rcx
js 0x9c0a
cvtsi2ss %rcx, %xmm0
jmp 0x9c1f
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movl %edx, %r12d
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpq %r15, %r12
je 0x9c68
movl (%rbx,%r15,4), %eax
testl %eax, %eax
je 0x9c63
movl %eax, %eax
cvtsi2ss %rax, %xmm0
divss -0x2c(%rbp), %xmm0
movl %r13d, %eax
shlq $0x5, %rax
leaq (%r14,%rax), %rdi
movss %xmm0, 0x18(%r14,%rax)
movl %r15d, %esi
callq 0x10ca3
incl %r13d
incq %r15
jmp 0x9c2d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_crc32(unsigned char const*, unsigned long)
unsigned lodepng_crc32(const unsigned char* buf, size_t len)
{
  unsigned c = 0xffffffffL;
  size_t n;

  for(n = 0; n < len; ++n)
  {
    c = lodepng_crc32_table[(c ^ buf[n]) & 0xff] ^ (c >> 8);
  }
  return c ^ 0xffffffffL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
leaq 0x80c3(%rip), %rdx      # 0x136a0
cmpq %rcx, %rsi
je 0xb5f9
movb (%rdi,%rcx), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rdx,%r8,4), %eax
incq %rcx
jmp 0xb5dd
notl %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_info_init(LodePNGInfo*)
void lodepng_info_init(LodePNGInfo* info)
{
  lodepng_color_mode_init(&info->color);
  info->interlace_method = 0;
  info->compression_method = 0;
  info->filter_method = 0;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  info->background_defined = 0;
  info->background_r = info->background_g = info->background_b = 0;

  LodePNGText_init(info);
  LodePNGIText_init(info);

  info->time_defined = 0;
  info->phys_defined = 0;

  LodePNGUnknownChunks_init(info);
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movabsq $0x800000006, %rax      # imm = 0x800000006
movq %rax, 0x10(%rdi)
movups %xmm0, 0x18(%rdi)
andl $0x0, 0x8(%rdi)
andq $0x0, (%rdi)
andl $0x0, 0xa4(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x68(%rdi)
movups %xmm0, 0x78(%rdi)
andl $0x0, 0x88(%rdi)
popq %rbp
jmp 0xbf2a
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_color_mode_equal(LodePNGColorMode const*, LodePNGColorMode const*)
static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b)
{
  size_t i;
  if(a->colortype != b->colortype) return 0;
  if(a->bitdepth != b->bitdepth) return 0;
  if(a->key_defined != b->key_defined) return 0;
  if(a->key_defined)
  {
    if(a->key_r != b->key_r) return 0;
    if(a->key_g != b->key_g) return 0;
    if(a->key_b != b->key_b) return 0;
  }
  if(a->palettesize != b->palettesize) return 0;
  for(i = 0; i != a->palettesize * 4; ++i)
  {
    if(a->palette[i] != b->palette[i]) return 0;
  }
  return 1;
}

// Assembly:
movl (%rdi), %ecx
xorl %eax, %eax
cmpl (%rsi), %ecx
jne 0xc600
movl 0x4(%rdi), %ecx
cmpl 0x4(%rsi), %ecx
jne 0xc600
movl 0x18(%rdi), %ecx
cmpl 0x18(%rsi), %ecx
jne 0xc600
testl %ecx, %ecx
je 0xc5c1
movl 0x1c(%rdi), %ecx
cmpl 0x1c(%rsi), %ecx
jne 0xc600
movl 0x20(%rdi), %ecx
cmpl 0x20(%rsi), %ecx
jne 0xc600
movl 0x24(%rdi), %ecx
cmpl 0x24(%rsi), %ecx
jne 0xc600
movq 0x10(%rdi), %rcx
cmpq 0x10(%rsi), %rcx
jne 0xc600
pushq %rbp
movq %rsp, %rbp
shlq $0x2, %rcx
xorl %r8d, %r8d
movl $0x1, %edx
cmpq %r8, %rcx
je 0xc5fd
movq 0x8(%rdi), %rax
movb (%rax,%r8), %r9b
movq 0x8(%rsi), %r10
leaq 0x1(%r8), %r11
xorl %eax, %eax
cmpb (%r10,%r8), %r9b
movq %r11, %r8
je 0xc5db
jmp 0xc5ff
movl %edx, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_decoder_settings_init(LodePNGDecoderSettings*)
void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings)
{
  settings->color_convert = 1;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  settings->read_text_chunks = 1;
  settings->remember_unknown_chunks = 0;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
  settings->ignore_crc = 0;
  lodepng_decompress_settings_init(&settings->zlibsettings);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x24(%rdi)
andl $0x0, 0x2c(%rdi)
andl $0x0, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x14(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng_encoder_settings_init(LodePNGEncoderSettings*)
void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings)
{
  lodepng_compress_settings_init(&settings->zlibsettings);
  settings->filter_palette_zero = 1;
  settings->filter_strategy = LFS_MINSUM;
  settings->auto_convert = 1;
  settings->force_palette = 0;
  settings->predefined_filters = 0;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  settings->add_id = 0;
  settings->text_compression = 1;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movaps 0x4541(%rip), %xmm0     # 0x13520
movups %xmm0, (%rdi)
movabsq $0x100000080, %rax      # imm = 0x100000080
movq %rax, 0x10(%rdi)
andq $0x0, 0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movl $0x1, %eax
movl %eax, 0x38(%rdi)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movl %eax, 0x50(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: lodepng::load_file(std::vector<unsigned char, std::allocator<unsigned char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void load_file(std::vector<unsigned char>& buffer, const std::string& filename)
{
  std::ifstream file(filename.c_str(), std::ios::in|std::ios::binary|std::ios::ate);

  /*get filesize*/
  std::streamsize size = 0;
  if(file.seekg(0, std::ios::end).good()) size = file.tellg();
  if(file.seekg(0, std::ios::beg).good()) size -= file.tellg();

  /*read contents of the file into the vector*/
  buffer.resize(size_t(size));
  if(size > 0) file.read((char*)(&buffer[0]), size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
movq (%rsi), %rsi
leaq -0x218(%rbp), %r14
pushq $0xe
popq %rdx
movq %r14, %rdi
callq 0x3420
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x32c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
cmpl $0x0, 0x20(%rax,%rcx)
je 0x1052a
xorl %r14d, %r14d
jmp 0x10539
leaq -0x218(%rbp), %rdi
callq 0x33d0
movq %rax, %r14
leaq -0x218(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
cmpl $0x0, 0x20(%rax,%rcx)
jne 0x10566
leaq -0x218(%rbp), %rdi
callq 0x33d0
subq %rax, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12b1e
testq %r14, %r14
jle 0x10588
movq (%rbx), %rsi
leaq -0x218(%rbp), %rdi
movq %r14, %rdx
callq 0x3280
leaq -0x218(%rbp), %rdi
callq 0x30b0
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x105a4
jmp 0x105a4
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x30b0
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: searchCodeIndex(unsigned int const*, unsigned long, unsigned long)
static size_t searchCodeIndex(const unsigned* array, size_t array_size, size_t value)
{
  /*linear search implementation*/
  /*for(size_t i = 1; i < array_size; ++i) if(array[i] > value) return i - 1;
  return array_size - 1;*/

  /*binary search implementation (not that much faster) (precondition: array_size > 0)*/
  size_t left  = 1;
  size_t right = array_size - 1;
  while(left <= right)
  {
    size_t mid = (left + right) / 2;
    if(array[mid] <= value) left = mid + 1; /*the value to find is more to the right*/
    else if(array[mid - 1] > value) right = mid - 1; /*the value to find is more to the left*/
    else return mid - 1;
  }
  return array_size - 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
decq %rsi
movabsq $0x1, %rcx
movq %rsi, %r8
cmpq %r8, %rcx
ja 0x11921
leaq (%r8,%rcx), %rax
shrq %rax
movl (%rdi,%rax,4), %r9d
cmpq %rdx, %r9
jbe 0x11919
movl -0x4(%rdi,%rax,4), %r9d
decq %rax
movq %rax, %r8
cmpq %rdx, %r9
ja 0x118f2
jmp 0x11924
incq %rax
movq %rax, %rcx
jmp 0x118f2
movq %rsi, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/logicx24[P]RayTracer/lodepng.cpp
// Function: readBitsFromReversedStream(unsigned long*, unsigned char const*, unsigned long)
static unsigned readBitsFromReversedStream(size_t* bitpointer, const unsigned char* bitstream, size_t nbits)
{
  unsigned result = 0;
  size_t i;
  for(i = nbits - 1; i < nbits; --i)
  {
    result += (unsigned)readBitFromReversedStream(bitpointer, bitstream) << i;
  }
  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
xorl %r15d, %r15d
movq %rdx, %r13
decq %r13
cmpq %rbx, %r13
jae 0x11ad0
movq %r12, %rdi
movq %r14, %rsi
callq 0x11ae2
movzbl %al, %eax
movl %r13d, %ecx
shll %cl, %eax
addl %eax, %r15d
jmp 0x11ab0
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH06_Functions/examples/mk_plural.cc
// Function: main
int main()
{
	size_t cnt = 1;
	cout << make_plural(cnt, "success", "es") << endl;

	cnt = 2;
	cout << make_plural(cnt, "failure", "s") << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x68, %rsp
leaq 0xdf8(%rip), %rsi       # 0x2004
leaq -0x30(%rbp), %rdi
leaq -0xa(%rbp), %rdx
callq 0x1030
leaq 0xdec(%rip), %rsi       # 0x200c
leaq -0x70(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x1030
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1080
movq 0x2d97(%rip), %rdi      # 0x3fd8
leaq -0x50(%rbp), %rsi
callq 0x1070
movq %rax, %rdi
callq 0x1050
leaq -0x50(%rbp), %rdi
callq 0x1040
leaq -0x70(%rbp), %rdi
callq 0x1040
leaq -0x30(%rbp), %rdi
callq 0x1040
leaq 0xd9b(%rip), %rsi       # 0x200f
leaq -0x30(%rbp), %rdi
leaq -0xa(%rbp), %rdx
callq 0x1030
leaq 0xd85(%rip), %rsi       # 0x200d
leaq -0x70(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x1030
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x131f
movq 0x2d2b(%rip), %rdi      # 0x3fd8
leaq -0x50(%rbp), %rsi
callq 0x1070
movq %rax, %rdi
callq 0x1050
leaq -0x50(%rbp), %rdi
callq 0x1040
leaq -0x70(%rbp), %rdi
callq 0x1040
leaq -0x30(%rbp), %rdi
callq 0x1040
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
jmp 0x12e8
jmp 0x12ed
jmp 0x12f2
movq %rax, %rbx
jmp 0x1305
movq %rax, %rbx
jmp 0x130e
movq %rax, %rbx
jmp 0x1317
jmp 0x12f9
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1040
leaq -0x70(%rbp), %rdi
callq 0x1040
leaq -0x30(%rbp), %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x10a0
// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/set-spt.cpp
// Function: Superblocks::init()
void Superblocks::init() {

	coin = "SPT"; 
	coin_name = "Spots";

	hash_length = 64;

	// normal (step 0)
	reward[0] = 49;

	// superblock (step 1)
	reward[1] = 10045; // superblock reward (step 1)
	seed_type[1] = SEED_WITH_PREVIOUS_BLOCK_HASH;
	cutout_start[1] = 8;
	cutout_length[1] = 7;
	rnd_range_low[1] = 1;
	rnd_range_high[1] = 100000;
	luck_type[1] = LUCK_WITH_MORE_THAN_X_AND_LESS_THAN_Y;
	luck_x[1] = 50000;
	luck_y[1] = 50011;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x18, %rdi
leaq 0xe08(%rip), %rsi       # 0x2b00
callq 0x1160
leaq 0x38(%rbx), %rdi
leaq 0xdfc(%rip), %rsi       # 0x2b04
callq 0x1160
movl $0x40, 0x58(%rbx)
movl $0x273d, 0xd8(%rbx)     # imm = 0x273D
movl $0x2, 0x60(%rbx)
movl $0x8, 0x68(%rbx)
movl $0x7, 0x70(%rbx)
movl $0x1, 0x78(%rbx)
movl $0x186a0, 0x80(%rbx)    # imm = 0x186A0
movl $0x3, 0xc0(%rbx)
movl $0xc350, 0xc8(%rbx)     # imm = 0xC350
movabsq $0x310000c35b, %rax     # imm = 0x310000C35B
movq %rax, 0xd0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/HQarroum[P]thread-pool/examples/working-with-tokens/main.cpp
// Function: main
int main() {
 thread::pool::pool_t pool(std::thread::hardware_concurrency() + 1);
 
 // Creating a producer token.
 auto producer_token = pool.create_token_of<thread::pool::producer_token_t>();

 // Filling our array with `iterations` amount of functions,
 // bound to the number `42`.
 std::fill_n(callables, iterations, std::bind(static_void_function, 42));
 // Scheduling the execution in bulk.
 auto result = pool.schedule_bulk(producer_token, callables, iterations);
 // Log whether the insertion was successful.
 std::cout << "The insertion has " << (result ? "succeeded." : "failed.") << std::endl;
 assert(result == true);
 return (0);
}

// Assembly:
pushq %rbx
subq $0x2b0, %rsp            # imm = 0x2B0
callq 0x21b0
leal 0x1(%rax), %esi
leaq 0x18(%rsp), %rdi
callq 0x2586
leaq 0x30(%rsp), %rsi
movq %rsp, %rdi
callq 0x385e
leaq -0x50(%rip), %rax       # 0x23dc
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movl $0x2a, 0x8(%rdx)
leaq 0x6d2e(%rip), %rdi      # 0x9170
leaq 0x79a7(%rip), %rsi      # 0x9df0
callq 0x3f71
leaq 0x6d1b(%rip), %rdx      # 0x9170
leaq 0x18(%rsp), %rdi
movq %rsp, %rsi
pushq $0x64
popq %rcx
callq 0x2648
movl %eax, %ebx
movq 0x6b62(%rip), %rdi      # 0x8fd0
leaq 0x2b9f(%rip), %rsi      # 0x5014
callq 0x2160
leaq 0x2ba6(%rip), %rcx      # 0x5027
leaq 0x2baa(%rip), %rsi      # 0x5032
testb %bl, %bl
cmovneq %rcx, %rsi
movq %rax, %rdi
callq 0x2160
movq %rax, %rdi
callq 0x20b0
testb %bl, %bl
je 0x24c9
movq (%rsp), %rax
testq %rax, %rax
je 0x24b4
andq $0x0, 0x10(%rax)
movb $0x1, 0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x265c
xorl %eax, %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbx
retq
leaq 0x2b6a(%rip), %rdi      # 0x503a
leaq 0x2b72(%rip), %rsi      # 0x5049
leaq 0x2b74(%rip), %rcx      # 0x5052
pushq $0x25
popq %rdx
callq 0x2100
jmp 0x24ed
movq %rax, %rbx
jmp 0x2502
movq %rax, %rbx
movq (%rsp), %rax
testq %rax, %rax
je 0x2502
andq $0x0, 0x10(%rax)
movb $0x1, 0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x265c
movq %rbx, %rdi
callq 0x2230
// File: /workspace/github_cpp_makefile_star2_O2/HQarroum[P]thread-pool/examples/working-with-tokens/./../../includes/blocking_concurrent_queue.hpp
// Function: bool moodycamel::BlockingConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::enqueue_bulk<std::function<void ()> const*>(moodycamel::ProducerToken const&, std::function<void ()> const*, unsigned long)
inline bool enqueue_bulk(producer_token_t const& token, It itemFirst, size_t count)
	{
		if ((details::likely)(inner.enqueue_bulk(token, std::forward<It>(itemFirst), count))) {
			sema->signal((LightweightSemaphore::ssize_t)(ssize_t)count);
			return true;
		}
		return false;
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdi, %r14
movq (%rsi), %rdi
addq $-0x8, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x414c
movl %eax, %ebp
testb %al, %al
je 0x40ff
movq 0x270(%r14), %rdi
movq %rbx, %rsi
callq 0x4106
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ipatix[P]wav2agb/converter.cpp
// Function: agb_out(std::basic_ofstream<char, std::char_traits<char>>&, char const*, ...)
static void agb_out(std::ofstream& ofs, const char *msg, ...) {
    char buf[256];
    va_list args;
    va_start(args, msg);
    vsnprintf(buf, sizeof(buf), msg, args);
    va_end(args);
    ofs << buf;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %r10
movq %rdi, %rbx
leaq 0x20(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x2cbd
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, %rcx
movq %rsi, 0x10(%rcx)
leaq 0x1f0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
leaq 0xd0(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movq %r10, %rdx
callq 0x2150
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21f0
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movl %r8d, (%rsp)
testq %rcx, %rcx
je 0x2e51
movq %rdi, 0x10(%rsp)
movl $0x7fffffff, (%rdi)     # imm = 0x7FFFFFFF
movq 0x74cd(%rip), %r12      # 0xa248
movq 0x74be(%rip), %rax      # 0xa240
movq %rax, 0x28(%rsp)
subq %rax, %r12
movq %rsi, 0x8(%rsp)
movq %r12, (%rsi)
leaq 0x8(%rdx), %rax
movq %rax, 0x18(%rsp)
decq %rcx
movq %rcx, 0x20(%rsp)
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x2e54
movq 0x28(%rsp), %rax
movsbl (%rax,%r14), %r13d
addl (%rsp), %r13d
movq %rdx, %rbp
movsd (%rdx), %xmm0
mulsd 0x3246(%rip), %xmm0     # 0x6018
callq 0x2370
movsd 0x3241(%rip), %xmm1     # 0x6020
maxsd %xmm0, %xmm1
movsd 0x323d(%rip), %xmm0     # 0x6028
minsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movsbl %al, %ebx
subl %r13d, %ebx
imull %ebx, %ebx
cmpl %r15d, %ebx
jge 0x2e46
leaq 0x4(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movl %r13d, %r8d
callq 0x2d4e
movsbl %r13b, %eax
cmpl %r13d, %eax
jne 0x2e46
addl 0x4(%rsp), %ebx
cmpl %r15d, %ebx
movq %rbp, %rdx
jge 0x2e49
movq 0x10(%rsp), %rax
movl %ebx, (%rax)
movq 0x8(%rsp), %rax
movq %r14, (%rax)
movl %ebx, %r15d
jmp 0x2e49
movq %rbp, %rdx
incq %r14
jmp 0x2dac
andl $0x0, (%rdi)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3746
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 0x6863(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
movq %r10, %rsi
callq 0x22a0
pushq $0x1
popq %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x2ddc(%rip), %r13      # 0x65d7
pushq $-0x1
popq %r15
xorl %ebp, %ebp
cmpq $0x1, %rbp
je 0x382f
movsbl (%rbp,%r13), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x2410
cmpq %r12, %rax
movq %r12, %rcx
cmovaq %rax, %rcx
cmpq $-0x1, %rax
cmovneq %rcx, %r12
incq %rbp
jmp 0x3801
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x2410
cmpq $-0x1, %rax
je 0x385c
cmpq %r12, %rax
je 0x3879
jbe 0x385c
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x2220
jmp 0x3867
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22c0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2d59(%rip), %rdi      # 0x65d9
leaq 0x2d7a(%rip), %rsi      # 0x6601
leaq 0x2d7f(%rip), %rcx      # 0x660d
pushq $0x4a
popq %rdx
callq 0x2160
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl %esi, %r15d
leaq 0x49f3(%rip), %r14      # 0x8004
pushq $0xa
popq %rbp
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x3648
movzbl (%rbx,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
testb $0x1f, %r12b
setne %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x3643
movl %ebp, %edi
callq 0x3310
incq %r12
jmp 0x3617
pushq $0xa
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3310
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x9be5(%rip)      # 0xd250
jne 0x3699
xorl %edi, %edi
callq 0x3220
leaq 0x9be5(%rip), %r14      # 0xd260
movl $0x800, %edx            # imm = 0x800
movl %eax, %edi
movq %r14, %rsi
callq 0x31a0
movq %r14, %rdi
callq 0x32c0
movb $0x1, 0x9bb7(%rip)      # 0xd250
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x36b0
callq 0x3110
movl %eax, (%rsp,%r14,4)
incq %r14
jmp 0x369c
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 0x492e(%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 0x3080
addq $0x50, %rsp
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3723
movl %esi, %ecx
addq %rax, %rcx
cmpq %rcx, %rax
ja 0x3723
cmpb $0x20, (%rax)
jne 0x3723
incq %rax
jmp 0x3714
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3744
movl %esi, %edx
leaq -0x1(%rdi), %rcx
movq %rdx, %rax
leaq (%rcx,%rdx), %rsi
cmpq %rdi, %rsi
jb 0x3743
leaq -0x1(%rax), %rdx
cmpb $0x20, (%rsi)
je 0x372e
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x37b5
pushq %rbx
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %esi
movl $0x1, %r8d
cmpq %rcx, %rsi
je 0x37ad
movzbl (%rdi,%rcx), %r9d
movl %r9d, %r10d
andb $-0x21, %r10b
addb $-0x41, %r10b
cmpb $0x19, %r10b
ja 0x379a
movb (%rdx,%rcx), %r10b
cmpb %r10b, %r9b
je 0x37a8
movzbl %r10b, %r11d
leal 0x20(%r9), %ebx
cmpl %r11d, %ebx
je 0x37a8
leal -0x20(%r9), %ebx
cmpl %r11d, %ebx
jne 0x379e
jmp 0x37a8
movb (%rdx,%rcx), %r10b
cmpb %r10b, %r9b
ja 0x37b1
cmpb %r10b, %r9b
jb 0x37b4
incq %rcx
jmp 0x375e
xorl %eax, %eax
jmp 0x37b4
movl %r8d, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %ebp
movq (%rdi), %r15
movq %r15, %rdi
movl %ebp, %esi
callq 0x3708
movq %rax, %r12
subl %r12d, %r15d
addl %ebp, %r15d
movq %rax, %rdi
movl %r15d, %esi
callq 0x3724
movq %r12, (%r14)
movl %eax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %esi
pushq $-0x1
popq %rax
cmpq %rcx, %rsi
je 0x3815
movzbl (%rdi,%rcx), %r8d
cmpl %edx, %r8d
je 0x3813
incq %rcx
jmp 0x37ff
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
xorl %r8d, %r8d
testl %esi, %esi
cmovlel %r8d, %esi
pushq $-0x1
popq %rax
xorl %r9d, %r9d
cmpq %r8, %rsi
je 0x3844
movzbl (%rdi,%r8), %r10d
cmpl %edx, %r10d
jne 0x383c
incl %r9d
cmpl %ecx, %r9d
je 0x3841
incq %r8
jmp 0x3825
movl %r8d, %eax
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8fb8(%rip), %rax      # 0xc910
movq %rax, (%rdi)
callq 0x39ee
movq 0x240(%rbx), %r14
testq %r14, %r14
je 0x3974
movq %r14, %rdi
callq 0x6278
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x3280
andq $0x0, 0x240(%rbx)
movq 0x248(%rbx), %rdi
callq 0x4b7e
movq 0x248(%rbx), %r14
testq %r14, %r14
je 0x39a7
movq %r14, %rdi
callq 0x4a96
pushq $0x70
popq %rsi
movq %r14, %rdi
callq 0x3280
andq $0x0, 0x248(%rbx)
leaq 0x220(%rbx), %rdi
callq 0x3448
leaq 0x200(%rbx), %rdi
callq 0x3448
addq $0x50, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4832
movq %rax, %rdi
callq 0x4739
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
movb $0x0, 0x68(%rdi)
movl 0x8(%rdi), %edi
testl %edi, %edi
jle 0x3a12
callq 0x3420
orl $-0x1, 0x8(%rbx)
movl 0xc(%rbx), %edi
callq 0x3420
orl $-0x1, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4026(%rip), %rsi      # 0x80f5
movq %rsp, %rdi
xorl %eax, %eax
callq 0x3080
movl 0x8(%rbx), %ebp
cmpl $-0x1, %ebp
je 0x4108
movq %rsp, %r14
movq %r14, %rdi
callq 0x30e0
addq $0x20, %rbx
pushq $0x10
popq %r9
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x3060
jmp 0x4114
leaq 0x42a6(%rip), %rdi      # 0x83b5
callq 0x3370
xorl %eax, %eax
addq $0x4e50, %rsp           # imm = 0x4E50
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4062(%rip), %rsi      # 0x81a7
movq %rsp, %rdi
xorl %eax, %eax
callq 0x3080
movl 0x8(%rbx), %ebp
cmpl $-0x1, %ebp
je 0x417e
movq %rsp, %r14
movq %r14, %rdi
callq 0x30e0
addq $0x20, %rbx
pushq $0x10
popq %r9
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x3060
jmp 0x418a
leaq 0x4230(%rip), %rdi      # 0x83b5
callq 0x3370
xorl %eax, %eax
addq $0x4e50, %rsp           # imm = 0x4E50
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/brunokeymolen[P]ssdp/src/ssdp.cpp
// Function: SSDP::SendSearchRequest(char const*)
int SSDP::SendSearchRequest(const char *target) {
    std::stringstream str;
    str << "M-SEARCH * HTTP/1.1\r\n";
    str << "Mx: " << 5 << "\r\n";
    str << "St: " << target << "\r\n";
    str << "Man: \"ssdp:discover\"\r\n";
    str << "User-Agent: UPnP/1.1 " << mOS << " " << mProduct << "\r\n";
    str << "Connection: close\r\n";
    str << "Host: 239.255.255.250:1900\r\n\r\n";

    str.seekp(0, ios::end);
    stringstream::pos_type length = str.tellp();
    str.seekp(0, ios::beg);

    if(mMulticastSocket != INVALID_SOCKET)
        sendto(mMulticastSocket, str.str().c_str(), (unsigned long)length, 0, (struct sockaddr*)&mDstaddr , sizeof(struct sockaddr));
    else
        printf("invalid socket\n");

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3160
leaq 0x30(%rsp), %r14
leaq 0x410f(%rip), %rsi      # 0x82e2
movq %r14, %rdi
callq 0x3240
leaq 0x4116(%rip), %rsi      # 0x82f8
movq %r14, %rdi
callq 0x3240
pushq $0x5
popq %rsi
movq %rax, %rdi
callq 0x33c0
leaq 0x4163(%rip), %rsi      # 0x835f
movq %rax, %rdi
callq 0x3240
leaq 0x40f2(%rip), %rsi      # 0x82fd
movq %r14, %rdi
callq 0x3240
movq %rax, %rdi
movq %r15, %rsi
callq 0x3240
leaq 0x413a(%rip), %rsi      # 0x835f
movq %rax, %rdi
callq 0x3240
leaq 0x40ce(%rip), %rsi      # 0x8302
movq %r14, %rdi
callq 0x3240
leaq 0x40d6(%rip), %rsi      # 0x8319
movq %r14, %rdi
callq 0x3240
leaq 0x200(%rbx), %rsi
movq %rax, %rdi
callq 0x3210
leaq 0x40cc(%rip), %rsi      # 0x832d
movq %rax, %rdi
callq 0x3240
leaq 0x220(%rbx), %rsi
movq %rax, %rdi
callq 0x3210
leaq 0x40e0(%rip), %rsi      # 0x835f
movq %rax, %rdi
callq 0x3240
leaq 0x40a1(%rip), %rsi      # 0x832f
movq %r14, %rdi
callq 0x3240
leaq 0x40a6(%rip), %rsi      # 0x8343
movq %r14, %rdi
callq 0x3240
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3250
movq %r14, %rdi
callq 0x31f0
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
movl 0x8(%rbx), %ebp
cmpl $-0x1, %ebp
je 0x4303
leaq 0x38(%rsp), %rsi
movq %rsp, %rdi
callq 0x3390
movq (%rsp), %rsi
addq $0x20, %rbx
pushq $0x10
popq %r9
movl %ebp, %edi
movq %r15, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x3060
movq %rsp, %rdi
callq 0x3448
jmp 0x430f
leaq 0x40ab(%rip), %rdi      # 0x83b5
callq 0x3370
leaq 0x20(%rsp), %rdi
callq 0x3180
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3448
jmp 0x433d
jmp 0x433a
jmp 0x433a
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3180
movq %rbx, %rdi
callq 0x33d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rax
movq %rsi, %rax
movq %rdi, %rcx
addq $0x50, %rdi
movq 0x50(%rcx), %rsi
movq 0x58(%rcx), %rcx
cmpq %rcx, %rsi
jae 0x43da
cmpq %rax, (%rsi)
je 0x43d5
addq $0x8, %rsi
jmp 0x43c5
callq 0x4762
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x62fc
movq 0x240(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x6366
movq 0x50(%rbx), %r14
cmpq 0x58(%rbx), %r14
jae 0x46e9
movq (%r14), %rdi
movq 0x240(%rbx), %rsi
movq (%rdi), %rax
callq *(%rax)
addq $0x8, %r14
jmp 0x46ce
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3050
testl %eax, %eax
je 0x49fb
movl %eax, %ebp
callq 0x3030
movl (%rax), %ecx
leaq 0x3a61(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x36ba(%rip), %rdi      # 0x80aa
leaq 0x3a40(%rip), %r9       # 0x8437
pushq $0x2a
jmp 0x4a2e
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3330
testl %eax, %eax
je 0x4a4f
movl %eax, %ebp
callq 0x3030
movl (%rax), %ecx
leaq 0x3a2c(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x3685(%rip), %rdi      # 0x80aa
leaq 0x3a0b(%rip), %r9       # 0x8437
pushq $0x2c
popq %r8
movl %ebp, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3040
leaq 0x3a0b(%rip), %rdi      # 0x844d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3370
addq $0x38, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3350
testl %eax, %eax
je 0x4a8c
movl %eax, %ebx
callq 0x3030
movl (%rax), %ecx
leaq 0x39d4(%rip), %rax      # 0x8446
movq %rax, (%rsp)
leaq 0x362d(%rip), %rdi      # 0x80aa
leaq 0x39b3(%rip), %r9       # 0x8437
pushq $0x2e
popq %r8
movl %ebx, %esi
jmp 0x4a32
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x32d0
testl %eax, %eax
je 0x4afe
movl %eax, %ebx
callq 0x3030
movl (%rax), %ecx
leaq 0x35bc(%rip), %rax      # 0x80a4
movq %rax, (%rsp)
leaq 0x35b7(%rip), %rdi      # 0x80aa
leaq 0x393d(%rip), %r9       # 0x8437
pushq $0x44
jmp 0x4b33
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x32e0
testl %eax, %eax
je 0x4b4c
movl %eax, %ebx
callq 0x3030
movl (%rax), %ecx
leaq 0x3585(%rip), %rax      # 0x80a4
movq %rax, (%rsp)
leaq 0x3580(%rip), %rdi      # 0x80aa
leaq 0x3906(%rip), %r9       # 0x8437
pushq $0x46
popq %r8
movl %ebx, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3040
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x60(%r14), %rdi
leaq 0x1d(%rip), %rdx        # 0x4b74
leaq 0x8(%rsp), %r15
movq %r15, %rsi
movq %r14, %rcx
callq 0x3400
movl %eax, %ebx
movq %r15, %rdi
callq 0x33b0
jmp 0x4b40
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x150, %edi            # imm = 0x150
callq 0x3260
movq %rax, %r15
movq %rax, %rdi
callq 0x54dc
leaq 0x8(%rsp), %r12
movq %r15, (%r12)
addq $0x48, %r15
movl %ebp, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3300
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x3320
movq %rbx, %rdi
movq %r12, %rsi
callq 0x50c6
movq %r14, %rdi
callq 0x31b0
movq (%r12), %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x150, %esi            # imm = 0x150
movq %r15, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0x33d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
addq $0x38, %rdi
movq %rdi, 0x18(%rsp)
callq 0x3320
movl %ebp, %r12d
movl $0x0, 0xc(%rsp)
xorl %r14d, %r14d
movq %rbx, 0x10(%rsp)
movq (%rbx), %rbp
movq 0x8(%rbx), %rbx
subq %rbp, %rbx
sarq $0x3, %rbx
movl %r14d, %r15d
cmpq %r15, %rbx
jbe 0x4ccd
movq (%rbp,%r15,8), %r13
cmpq %r12, 0x50(%r13)
jne 0x4c95
movq 0x48(%r13), %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x3290
testl %eax, %eax
je 0x4c9a
incl %r14d
jmp 0x4c6d
leaq (,%r15,8), %rsi
addq %rbp, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x50e4
movq %r13, %rdi
callq 0x56c2
movl $0x150, %esi            # imm = 0x150
movq %r13, %rdi
callq 0x3280
incl 0xc(%rsp)
jmp 0x4c5f
movq 0x18(%rsp), %rdi
callq 0x31b0
cmpl $0x0, 0xc(%rsp)
je 0x4ce8
movq 0x10(%rsp), %rdi
callq 0x4cfa
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movl $0x1, (%r14)
movq 0x18(%rdi), %r15
cmpq 0x20(%rbx), %r15
jae 0x4d2d
movq (%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
addq $0x8, %r15
jmp 0x4d16
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop