LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/unifi-motion.c
// Function: action_log_changes
int action_log_changes(FILE *fp, bool logMotion) {
  char *line = NULL;
  size_t len = 0;
  ssize_t read_size;
  size_t maxGroups = 3;
  regmatch_t groupArray[maxGroups];
  static char buf[LABEL_LEN];
  int lc = 0;

  while ((read_size = getline(&line, &len, fp)) != -1) {
    DLOG("Read from log:-\n  %s", line);
    lc++;
    if (regexec(&_config.regexCompiled, line, maxGroups, groupArray, 0) == 0) {
      if (groupArray[2].rm_so == (size_t)-1) {
        DLOG("No regexp from log file\n");
      } else {
        sprintf(buf, "%.*s:%.*s", (groupArray[1].rm_eo - groupArray[1].rm_so), (line + groupArray[1].rm_so), (groupArray[2].rm_eo - groupArray[2].rm_so),
                (line + groupArray[2].rm_so));
        LOG("regexp from log file '%s'\n", buf);
        int i;
        for (i = 0; i < _config.numMotions; i++) {
          if (strcmp(_config.motions[i]->name, buf) == 0) {
            DLOG("Motion match found\n");
            send_mqtt_msg(_mqtt_connection, _config.motions[i]->action);
            if (logMotion)
              fprintf(stderr, "Motion seen %s\n", buf);
            break;
          }
        }
      }
    }
  }

  return lc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, 0x14(%rsp)
movq %rdi, %rdx
movq %rsp, 0x18(%rsp)
xorl %r15d, %r15d
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x28(%rsp), %rsi
movq %r15, (%rsi)
movq %rdx, 0x20(%rsp)
callq 0x3590
cmpq $-0x1, %rax
je 0x4068
leaq 0x1a62b(%rip), %rbp     # 0x1e5b0
leaq 0x1a424(%rip), %rbx     # 0x1e3b0
xorl %r15d, %r15d
movq 0x8(%rsp), %rsi
movl $0x3, %edx
leaq 0x1a468(%rip), %rdi     # 0x1e408
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
callq 0x3460
testl %eax, %eax
je 0x3fd3
incl %r15d
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x3590
cmpq $-0x1, %rax
jne 0x3f8f
jmp 0x4068
movslq 0x40(%rsp), %rax
cmpq $-0x1, %rax
je 0x3fb1
movslq 0x38(%rsp), %rcx
movl 0x3c(%rsp), %edx
movl 0x44(%rsp), %r8d
subl %ecx, %edx
movq 0x8(%rsp), %r9
addq %r9, %rcx
subl %eax, %r8d
addq %rax, %r9
movq %rbp, %rdi
leaq 0x110d2(%rip), %rsi     # 0x150d8
xorl %eax, %eax
callq 0x35a0
movslq 0x1a574(%rip), %r12     # 0x1e588
testq %r12, %r12
jle 0x3fb1
xorl %r14d, %r14d
movq 0x98(%rbx,%r14,8), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3310
testl %eax, %eax
je 0x4040
incq %r14
cmpq %r14, %r12
jne 0x401c
jmp 0x3fb1
movq 0x1a361(%rip), %rdi     # 0x1e3a8
addq $0x28, %r13
movq %r13, %rsi
callq 0x3cd8
cmpb $0x0, 0x14(%rsp)
je 0x3fb1
callq 0x38fd
jmp 0x3fb1
movq 0x18(%rsp), %rsp
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_set_filter
void cs_log_set_filter(const char *str) {
  free(s_filter_pattern);
  if (str != NULL) {
    s_filter_pattern = strdup(str);
    s_filter_pattern_len = strlen(str);
  } else {
    s_filter_pattern = NULL;
    s_filter_pattern_len = 0;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x1a1da(%rip), %rdi     # 0x1e5e8
callq 0x3060
testq %r14, %r14
je 0x442d
movq %r14, %rdi
callq 0x35f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x3180
jmp 0x4431
xorl %ebx, %ebx
xorl %eax, %eax
movq %rbx, 0x1a1b0(%rip)     # 0x1e5e8
movq %rax, 0x1a1b1(%rip)     # 0x1e5f0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_print_prefix
int cs_log_print_prefix(enum cs_log_level level, const char *func,
                        const char *filename) {
  char prefix[21];

  if (level > cs_log_threshold) return 0;
  if (s_filter_pattern != NULL &&
      mg_match_prefix(s_filter_pattern, s_filter_pattern_len, func) < 0 &&
      mg_match_prefix(s_filter_pattern, s_filter_pattern_len, filename) < 0) {
    return 0;
  }

  strncpy(prefix, func, 20);
  prefix[20] = '\0';
  if (cs_log_file == NULL) cs_log_file = stderr;
  cs_log_cur_msg_level = level;
  fprintf(cs_log_file, "%-20s ", prefix);
#if CS_LOG_ENABLE_TS_DIFF
  {
    double now = cs_time();
    fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
    cs_log_ts = now;
  }
#endif
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorl %ebp, %ebp
cmpl %edi, 0x1a17f(%rip)     # 0x1e5d8
jl 0x44ef
movq %rsi, %r14
movl %edi, %ebx
movq 0x1a17d(%rip), %rdi     # 0x1e5e8
testq %rdi, %rdi
je 0x449e
movq %rdx, %r15
movl 0x1a177(%rip), %esi     # 0x1e5f0
movq %r14, %rdx
callq 0x44fc
testl %eax, %eax
jns 0x449e
movq 0x1a15c(%rip), %rdi     # 0x1e5e8
movl 0x1a15e(%rip), %esi     # 0x1e5f0
movq %r15, %rdx
callq 0x44fc
testl %eax, %eax
js 0x44ef
movq %rsp, %r15
movl $0x14, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x30b0
movb $0x0, 0x14(%r15)
movq 0x1a123(%rip), %rdi     # 0x1e5e0
testq %rdi, %rdi
jne 0x44d3
movq 0x19b27(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
movq %rdi, 0x1a10d(%rip)     # 0x1e5e0
movl %ebx, 0x19e87(%rip)     # 0x1e360
leaq 0x1109c(%rip), %rsi     # 0x1557c
movq %rsp, %rdx
xorl %eax, %eax
callq 0x3340
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_match_prefix
int mg_match_prefix(const char *pattern, int pattern_len, const char *str) {
  const struct mg_str pstr = {pattern, (size_t) pattern_len};
  struct mg_str s = {str, 0};
  if (str != NULL) s.len = strlen(str);
  return mg_match_prefix_n(pstr, s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r15
movslq %esi, %rbx
testq %rdx, %rdx
je 0x4525
movq %rdx, %r14
movq %rdx, %rdi
callq 0x3180
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
jmp 0x452f
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0x77c3
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_printf
void cs_log_printf(const char *fmt, ...) {
  va_list ap;
  va_start(ap, fmt);
  vfprintf(cs_log_file, fmt, ap);
  va_end(ap);
  fputc('\n', cs_log_file);
  fflush(cs_log_file);
  cs_log_cur_msg_level = LL_NONE;
}

// 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 0x4597
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 0x1a022(%rip), %rdi     # 0x1e5e0
movq %r10, %rsi
callq 0x3540
movq 0x1a013(%rip), %rsi     # 0x1e5e0
movl $0xa, %edi
callq 0x32b0
movq 0x1a002(%rip), %rdi     # 0x1e5e0
callq 0x3400
movl $0xffffffff, 0x19d73(%rip) # imm = 0xFFFFFFFF
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_update
void cs_base64_update(struct cs_base64_ctx *ctx, const char *str, size_t len) {
  const unsigned char *src = (const unsigned char *) str;
  size_t i;
  for (i = 0; i < len; i++) {
    ctx->chunk[ctx->chunk_size++] = src[i];
    if (ctx->chunk_size == 3) {
      cs_base64_emit_chunk(ctx);
      ctx->chunk_size = 0;
    }
  }
}

// Assembly:
testq %rdx, %rdx
je 0x466f
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0xc(%rdi), %eax
xorl %r12d, %r12d
movb (%r14,%r12), %cl
leal 0x1(%rax), %edx
movl %edx, 0xc(%r15)
cltq
movb %cl, 0x8(%r15,%rax)
movl 0xc(%r15), %eax
cmpl $0x3, %eax
jne 0x465c
movq %r15, %rdi
callq 0x4670
movl $0x0, 0xc(%r15)
xorl %eax, %eax
incq %r12
cmpq %r12, %rbx
jne 0x462f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_emit_chunk
static void cs_base64_emit_chunk(struct cs_base64_ctx *ctx) {
  int a, b, c;

  a = ctx->chunk[0];
  b = ctx->chunk[1];
  c = ctx->chunk[2];

  cs_base64_emit_code(ctx, a >> 2);
  cs_base64_emit_code(ctx, ((a & 3) << 4) | (b >> 4));
  if (ctx->chunk_size > 1) {
    cs_base64_emit_code(ctx, (b & 15) << 2 | (c >> 6));
  }
  if (ctx->chunk_size > 2) {
    cs_base64_emit_code(ctx, c & 63);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl 0x8(%rdi), %r15d
movzbl 0x9(%rdi), %r14d
movzbl 0xa(%rdi), %ebp
movl %r15d, %esi
shrl $0x2, %esi
callq 0x130b7
shll $0x4, %r15d
andl $0x30, %r15d
movl %r14d, %esi
shrl $0x4, %esi
orl %r15d, %esi
movq %rbx, %rdi
callq 0x130b7
cmpl $0x2, 0xc(%rbx)
jl 0x46e4
andl $0xf, %r14d
movl %ebp, %eax
shrl $0x6, %eax
leal (%rax,%r14,4), %esi
movq %rbx, %rdi
callq 0x130b7
cmpl $0x3, 0xc(%rbx)
jl 0x46e4
andl $0x3f, %ebp
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x130b7
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_finish
void cs_base64_finish(struct cs_base64_ctx *ctx) {
  if (ctx->chunk_size > 0) {
    int i;
    memset(&ctx->chunk[ctx->chunk_size], 0, 3 - ctx->chunk_size);
    cs_base64_emit_chunk(ctx);
    for (i = 0; i < (3 - ctx->chunk_size); i++) {
      ctx->b64_putc('=', ctx->user_data);
    }
  }
}

// Assembly:
movslq 0xc(%rdi), %rax
testq %rax, %rax
jle 0x4745
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq %rax, %rdi
addq $0x8, %rdi
movl $0x3, %ecx
subl %eax, %ecx
movslq %ecx, %rdx
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x3240
movq %rbx, %rdi
callq 0x4670
cmpl $0x2, 0xc(%rbx)
jg 0x473f
movq 0x10(%rbx), %rsi
movl $0x3d, %edi
callq *(%rbx)
incl %ebp
movl $0x3, %eax
subl 0xc(%rbx), %eax
cmpl %eax, %ebp
jl 0x4726
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_decode
int cs_base64_decode(const unsigned char *s, int len, char *dst, int *dec_len) {
  unsigned char a, b, c, d;
  int orig_len = len;
  char *orig_dst = dst;
  while (len >= 4 && (a = from_b64(s[0])) != 255 &&
         (b = from_b64(s[1])) != 255 && (c = from_b64(s[2])) != 255 &&
         (d = from_b64(s[3])) != 255) {
    s += 4;
    len -= 4;
    if (a == 200 || b == 200) break; /* '=' can't be there */
    *dst++ = a << 2 | b >> 4;
    if (c == 200) break;
    *dst++ = b << 4 | c >> 2;
    if (d == 200) break;
    *dst++ = c << 6 | d;
  }
  *dst = 0;
  if (dec_len != NULL) *dec_len = (dst - orig_dst);
  return orig_len - len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %eax
movq %rdx, %r8
cmpl $0x4, %esi
jl 0x4a8f
movq %rcx, -0x8(%rsp)
leaq 0x2(%rdx), %r9
leaq 0x10ab8(%rip), %rcx     # 0x15470
movl %eax, %esi
movq %rdx, %r8
movzbl (%rdi), %r14d
andl $0x7f, %r14d
movb (%r14,%rcx), %bl
cmpb $-0x1, %bl
je 0x4a8a
movzbl 0x1(%rdi), %r10d
andl $0x7f, %r10d
movb (%r10,%rcx), %r11b
cmpb $-0x1, %r11b
je 0x4a8a
movzbl 0x2(%rdi), %r13d
andl $0x7f, %r13d
movb (%r13,%rcx), %bpl
cmpb $-0x1, %bpl
je 0x4a8a
movzbl 0x3(%rdi), %r12d
andl $0x7f, %r12d
movb (%r12,%rcx), %r15b
cmpb $-0x1, %r15b
je 0x4a78
addl $-0x4, %esi
cmpb $0x3d, %r14b
je 0x4a8a
cmpb $0x3d, %r10b
je 0x4a8a
shlb $0x2, %bl
movl %r11d, %r10d
shrb $0x4, %r10b
orb %bl, %r10b
movb %r10b, -0x2(%r9)
cmpb $0x3d, %r13b
je 0x4a81
shlb $0x4, %r11b
movl %ebp, %r10d
shrb $0x2, %r10b
orb %r11b, %r10b
movb %r10b, -0x1(%r9)
cmpb $0x3d, %r12b
je 0x4a86
shlb $0x6, %bpl
orb %bpl, %r15b
addq $0x3, %r8
movb %r15b, (%r9)
leal 0x4(%rsi), %r10d
addq $0x3, %r9
addq $0x4, %rdi
cmpl $0x7, %r10d
ja 0x49bd
jmp 0x4a8a
addq $-0x2, %r9
movq %r9, %r8
jmp 0x4a8a
incq %r8
jmp 0x4a8a
addq $0x2, %r8
movq -0x8(%rsp), %rcx
movb $0x0, (%r8)
testq %rcx, %rcx
je 0x4a9e
subl %edx, %r8d
movl %r8d, (%rcx)
subl %esi, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_md5_update
void cs_md5_update(cs_md5_ctx *ctx, const unsigned char *buf, size_t len) {
  uint32_t t;

  t = ctx->bits[0];
  if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) ctx->bits[1]++;
  ctx->bits[1] += (uint32_t) len >> 29;

  t = (t >> 3) & 0x3f;

  if (t) {
    unsigned char *p = (unsigned char *) ctx->in + t;

    t = 64 - t;
    if (len < t) {
      memcpy(p, buf, len);
      return;
    }
    memcpy(p, buf, t);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    buf += t;
    len -= t;
  }

  while (len >= 64) {
    memcpy(ctx->in, buf, 64);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    buf += 64;
    len -= 64;
  }

  memcpy(ctx->in, buf, len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %eax
leal (,%rdx,8), %ecx
movl %edx, %edi
shrl $0x1d, %edi
addl %eax, %ecx
movl %ecx, 0x10(%rbx)
adcl %edi, 0x14(%rbx)
movq %rsi, %r14
shrl $0x3, %eax
andl $0x3f, %eax
je 0x4c27
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
movl $0x40, %r12d
subl %eax, %r12d
movq %rdx, %r15
subq %r12, %r15
jae 0x4c2c
movq %r14, %rsi
jmp 0x4ca3
movq %rdx, %r15
jmp 0x4c49
leaq 0x18(%rbx), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x3380
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4cb1
addq %r12, %r14
cmpq $0x40, %r15
jb 0x4c96
leaq 0x18(%rbx), %r12
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm3, 0x30(%r12)
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4cb1
addq $0x40, %r14
addq $-0x40, %r15
cmpq $0x3f, %r15
ja 0x4c53
addq $0x18, %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3380
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_md5_final
void cs_md5_final(unsigned char digest[16], cs_md5_ctx *ctx) {
  unsigned count;
  unsigned char *p;
  uint32_t *a;

  count = (ctx->bits[0] >> 3) & 0x3F;

  p = ctx->in + count;
  *p++ = 0x80;
  count = 64 - 1 - count;
  if (count < 8) {
    memset(p, 0, count);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    memset(ctx->in, 0, 56);
  } else {
    memset(p, 0, count - 8);
  }
  byteReverse(ctx->in, 14);

  a = (uint32_t *) ctx->in;
  a[14] = ctx->bits[0];
  a[15] = ctx->bits[1];

  cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
  byteReverse((unsigned char *) ctx->buf, 4);
  memcpy(digest, ctx->buf, 16);
  memset((char *) ctx, 0, sizeof(*ctx));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x10(%rsi), %eax
shrl $0x3, %eax
andl $0x3f, %eax
leaq 0x18(%rsi), %r15
leaq (%rsi,%rax), %rdi
addq $0x19, %rdi
movb $-0x80, -0x1(%rdi)
movl %eax, %ecx
xorl $0x3f, %ecx
cmpl $0x7, %ecx
ja 0x5461
movl %ecx, %edx
xorl %esi, %esi
callq 0x3240
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4cb1
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq $0x0, 0x30(%r15)
jmp 0x546f
movl $0x37, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x3240
movq 0x10(%rbx), %rax
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4cb1
movups (%rbx), %xmm0
movups %xmm0, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, (%rbx)
movq $0x0, 0x50(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_sha1_update
void cs_sha1_update(cs_sha1_ctx *context, const unsigned char *data,
                    uint32_t len) {
  uint32_t i, j;

  j = context->count[0];
  if ((context->count[0] += len << 3) < j) context->count[1]++;
  context->count[1] += (len >> 29);
  j = (j >> 3) & 63;
  if ((j + len) > 63) {
    memcpy(&context->buffer[j], data, (i = 64 - j));
    cs_sha1_transform(context->state, context->buffer);
    for (; i + 63 < len; i += 64) {
      cs_sha1_transform(context->state, &data[i]);
    }
    j = 0;
  } else
    i = 0;
  memcpy(&context->buffer[j], &data[i], len - i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl 0x14(%rdi), %ebp
leal (,%rbx,8), %eax
movl %edx, %ecx
shrl $0x1d, %ecx
addl %ebp, %eax
movl %eax, 0x14(%rdi)
adcl %ecx, 0x18(%rdi)
shrl $0x3, %ebp
andl $0x3f, %ebp
leal (%rbx,%rbp), %eax
cmpl $0x40, %eax
jb 0x663e
leaq 0x1c(%r15), %r13
leaq (%r15,%rbp), %rdi
addq $0x1c, %rdi
movl $0x40, %r12d
subl %ebp, %r12d
movq %r14, %rsi
movq %r12, %rdx
callq 0x3380
movq %r15, %rdi
movq %r13, %rsi
callq 0x54ad
xorl $0x7f, %ebp
cmpl %ebx, %ebp
jae 0x6645
leal -0x3f(%rbp), %esi
addq %r14, %rsi
movq %r15, %rdi
callq 0x54ad
addl $0x40, %ebp
cmpl %ebx, %ebp
jb 0x661f
addl $-0x3f, %ebp
xorl %eax, %eax
movl %ebp, %r12d
jmp 0x6647
movl %ebp, %eax
xorl %r12d, %r12d
jmp 0x6647
xorl %eax, %eax
leaq (%r15,%rax), %rdi
addq $0x1c, %rdi
movl %r12d, %eax
addq %rax, %r14
subl %r12d, %ebx
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3380
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_sha1_final
void cs_sha1_final(unsigned char digest[20], cs_sha1_ctx *context) {
  unsigned i;
  unsigned char finalcount[8], c;

  for (i = 0; i < 8; i++) {
    finalcount[i] = (unsigned char) ((context->count[(i >= 4 ? 0 : 1)] >>
                                      ((3 - (i & 3)) * 8)) &
                                     255);
  }
  c = 0200;
  cs_sha1_update(context, &c, 1);
  while ((context->count[0] & 504) != 448) {
    c = 0000;
    cs_sha1_update(context, &c, 1);
  }
  cs_sha1_update(context, finalcount, 8);
  for (i = 0; i < 20; i++) {
    digest[i] =
        (unsigned char) ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
  }
  memset(context, '\0', sizeof(*context));
  memset(&finalcount, '\0', sizeof(finalcount));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
cmpq $0x4, %rdx
setb %cl
movl 0x14(%rbx,%rcx,4), %esi
movl %eax, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %esi
movb %sil, 0x10(%rsp,%rdx)
incq %rdx
addl $0x8, %eax
cmpq $0x8, %rdx
jne 0x6685
leaq 0xf(%rsp), %rsi
movb $-0x80, (%rsi)
movq %rbx, %rdi
movl $0x1, %edx
callq 0x65b5
movl $0x1f8, %ebp            # imm = 0x1F8
movl 0x14(%rbx), %eax
andl %ebp, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
je 0x66f8
leaq 0xf(%rsp), %r15
movb $0x0, 0xf(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x65b5
movl 0x14(%rbx), %eax
andl %ebp, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x66d7
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x65b5
xorl %eax, %eax
xorl %edx, %edx
movl %edx, %ecx
andl $-0x4, %ecx
movl (%rbx,%rcx), %esi
movl %eax, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %esi
movb %sil, (%r14,%rdx)
incq %rdx
addl $0x8, %eax
cmpq $0x14, %rdx
jne 0x670e
xorps %xmm0, %xmm0
movups %xmm0, 0x4c(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_hmac_sha1
void cs_hmac_sha1(const unsigned char *key, size_t keylen,
                  const unsigned char *data, size_t datalen,
                  unsigned char out[20]) {
  cs_sha1_ctx ctx;
  unsigned char buf1[64], buf2[64], tmp_key[20], i;

  if (keylen > sizeof(buf1)) {
    cs_sha1_init(&ctx);
    cs_sha1_update(&ctx, key, keylen);
    cs_sha1_final(tmp_key, &ctx);
    key = tmp_key;
    keylen = sizeof(tmp_key);
  }

  memset(buf1, 0, sizeof(buf1));
  memset(buf2, 0, sizeof(buf2));
  memcpy(buf1, key, keylen);
  memcpy(buf2, key, keylen);

  for (i = 0; i < sizeof(buf1); i++) {
    buf1[i] ^= 0x36;
    buf2[i] ^= 0x5c;
  }

  cs_sha1_init(&ctx);
  cs_sha1_update(&ctx, buf1, sizeof(buf1));
  cs_sha1_update(&ctx, data, datalen);
  cs_sha1_final(out, &ctx);

  cs_sha1_init(&ctx);
  cs_sha1_update(&ctx, buf2, sizeof(buf2));
  cs_sha1_update(&ctx, out, 20);
  cs_sha1_final(out, &ctx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
cmpq $0x41, %rsi
jb 0x67c4
movaps 0xebbf(%rip), %xmm0     # 0x15340
leaq 0xa0(%rsp), %rbp
movaps %xmm0, (%rbp)
movl $0xc3d2e1f0, %eax       # imm = 0xC3D2E1F0
movq %rax, 0x10(%rbp)
movl $0x0, 0x18(%rbp)
movq %rbp, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x65b5
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6671
movl $0x14, %r13d
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq %rsp, %rbp
movaps %xmm0, (%rbp)
movaps %xmm0, 0x10(%rbp)
movaps %xmm0, 0x20(%rbp)
movaps %xmm0, 0x30(%rbp)
movq %r12, %rsi
movq %r13, %rdx
callq 0x3380
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3380
xorl %eax, %eax
movaps 0xeb40(%rip), %xmm0     # 0x15350
movaps 0xeb49(%rip), %xmm1     # 0x15360
movaps 0x40(%rsp,%rax), %xmm2
xorps %xmm0, %xmm2
movaps %xmm2, 0x40(%rsp,%rax)
movaps (%rsp,%rax), %xmm2
xorps %xmm1, %xmm2
movaps %xmm2, (%rsp,%rax)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x6817
movaps 0xeb00(%rip), %xmm0     # 0x15340
leaq 0xa0(%rsp), %r12
movaps %xmm0, (%r12)
movl $0xc3d2e1f0, %r13d      # imm = 0xC3D2E1F0
movq %r13, 0x10(%r12)
xorl %ebp, %ebp
movl %ebp, 0x18(%r12)
leaq 0x40(%rsp), %rsi
movq %r12, %rdi
movl $0x40, %edx
callq 0x65b5
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x65b5
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6671
movaps 0xeaaf(%rip), %xmm0     # 0x15340
movaps %xmm0, (%r12)
movq %r13, 0x10(%r12)
movl %ebp, 0x18(%r12)
movq %rsp, %rsi
movq %r12, %rdi
movl $0x40, %edx
callq 0x65b5
movq %r12, %rdi
movq %rbx, %rsi
movl $0x14, %edx
callq 0x65b5
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6671
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mbuf_resize
void mbuf_resize(struct mbuf *a, size_t new_size) {
  if (new_size > a->size || (new_size < a->size && new_size >= a->len)) {
    char *buf = (char *) MBUF_REALLOC(a->buf, new_size);
    /*
     * In case realloc fails, there's not much we can do, except keep things as
     * they are. Note that NULL is a valid return value from realloc when
     * size == 0, but that is covered too.
     */
    if (buf == NULL && new_size != 0) return;
    a->buf = buf;
    a->size = new_size;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpq %rsi, 0x10(%rdi)
jae 0x6924
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x34a0
testq %rax, %rax
sete %cl
testq %rbx, %rbx
setne %dl
testb %cl, %dl
jne 0x692c
movq %rax, (%r14)
movq %rbx, 0x10(%r14)
jmp 0x692c
jbe 0x692c
cmpq %rbx, 0x8(%r14)
jbe 0x6900
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mbuf_insert
size_t mbuf_insert(struct mbuf *a, size_t off, const void *buf, size_t len) {
  char *p = NULL;

  assert(a != NULL);
  assert(a->len <= a->size);
  assert(off <= a->len);

  /* check overflow */
  if (~(size_t) 0 - (size_t) a->buf < len) return 0;

  if (a->len + len <= a->size) {
    memmove(a->buf + off + len, a->buf + off, a->len - off);
    if (buf != NULL) {
      memcpy(a->buf + off, buf, len);
    }
    a->len += len;
  } else {
    size_t new_size = (size_t)((a->len + len) * MBUF_SIZE_MULTIPLIER);
    if ((p = (char *) MBUF_REALLOC(a->buf, new_size)) != NULL) {
      a->buf = p;
      memmove(a->buf + off + len, a->buf + off, a->len - off);
      if (buf != NULL) memcpy(a->buf + off, buf, len);
      a->len += len;
      a->size = new_size;
    } else {
      len = 0;
    }
  }

  return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x6a8a
movq %rcx, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rcx, %rax
ja 0x6aa9
movq %rdx, %r15
movq %rsi, %r12
movq %rax, %rdx
subq %rsi, %rdx
jb 0x6ac8
movq (%r14), %rsi
movq %rsi, %rdi
addq %rbx, %rdi
jae 0x69aa
xorl %ebx, %ebx
jmp 0x6a78
addq %rbx, %rax
cmpq %rcx, %rax
jbe 0x6a52
movq %rax, %xmm0
punpckldq 0xe9ad(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xe9b5(%rip), %xmm0     # 0x15380
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xe921(%rip), %xmm1     # 0x15300
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xe915(%rip), %xmm1     # 0x15308
cvttsd2si %xmm1, %r13
andq %rcx, %r13
orq %rax, %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x34a0
testq %rax, %rax
je 0x69a3
movq %rax, %rbp
movq %rax, (%r14)
addq %r12, %rbp
leaq (%rbx,%rbp), %rdi
movq %r15, (%rsp)
movq 0x8(%r14), %r15
movq %r15, %rdx
subq %r12, %rdx
movq %rbp, %rsi
callq 0x3500
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x6a45
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x3380
addq %rbx, %r15
movq %r15, 0x8(%r14)
movq %r13, 0x10(%r14)
jmp 0x6a78
addq %r12, %rsi
leaq (%rsi,%rbx), %rdi
callq 0x3500
testq %r15, %r15
je 0x6a74
addq (%r14), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3380
addq %rbx, 0x8(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xeb33(%rip), %rdi      # 0x155c4
leaq 0xeb36(%rip), %rsi      # 0x155ce
leaq 0xeb3a(%rip), %rcx      # 0x155d9
movl $0x568, %edx            # imm = 0x568
callq 0x3220
leaq 0xeb69(%rip), %rdi      # 0x15619
leaq 0xeb17(%rip), %rsi      # 0x155ce
leaq 0xeb1b(%rip), %rcx      # 0x155d9
movl $0x569, %edx            # imm = 0x569
callq 0x3220
leaq 0xeb5c(%rip), %rdi      # 0x1562b
leaq 0xeaf8(%rip), %rsi      # 0x155ce
leaq 0xeafc(%rip), %rcx      # 0x155d9
movl $0x56a, %edx            # imm = 0x56A
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_ncasecmp
int mg_ncasecmp(const char *s1, const char *s2, size_t len) {
  int diff = 0;

  if (len > 0) do {
      diff = str_util_lowercase(s1++) - str_util_lowercase(s2++);
    } while (diff == 0 && s1[-1] != '\0' && --len > 0);

  return diff;
}

// Assembly:
testq %rdx, %rdx
je 0x6c11
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x3650
movq (%rax), %rcx
decq %rbx
xorl %edx, %edx
movzbl (%r15,%rdx), %esi
movl (%rcx,%rsi,4), %eax
movzbl (%r14,%rdx), %edi
subl (%rcx,%rdi,4), %eax
jne 0x6c0b
xorl %eax, %eax
testb %sil, %sil
je 0x6c0b
leaq 0x1(%rdx), %rsi
cmpq %rdx, %rbx
movq %rsi, %rdx
jne 0x6be6
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_strdup_nul
static struct mg_str mg_strdup_common(const struct mg_str s,
                                      int nul_terminate) {
  struct mg_str r = {NULL, 0};
  if (s.len > 0 && s.p != NULL) {
    char *sc = (char *) MG_MALLOC(s.len + (nul_terminate ? 1 : 0));
    if (sc != NULL) {
      memcpy(sc, s.p, s.len);
      if (nul_terminate) sc[s.len] = '\0';
      r.p = sc;
      r.len = s.len;
    }
  }
  return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
setne %al
testq %rdi, %rdi
setne %cl
andb %al, %cl
xorl %edx, %edx
movl $0x0, %r15d
cmpb $0x1, %cl
jne 0x6cbf
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1(%rsi), %rdi
callq 0x33e0
testq %rax, %rax
je 0x6cba
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3380
movb $0x0, (%r15,%rbx)
movq %rbx, %rdx
jmp 0x6cbf
xorl %edx, %edx
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_strcmp
int mg_strcmp(const struct mg_str str1, const struct mg_str str2) {
  size_t i = 0;
  while (i < str1.len && i < str2.len) {
    if (str1.p[i] < str2.p[i]) return -1;
    if (str1.p[i] > str2.p[i]) return 1;
    i++;
  }
  if (i < str1.len) return 1;
  if (i < str2.len) return -1;
  return 0;
}

// Assembly:
testq %rsi, %rsi
setne %al
testq %rcx, %rcx
setne %r8b
movl %eax, %r9d
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x6d2a
movl $0x1, %r9d
movb -0x1(%rdx,%r9), %al
cmpb %al, -0x1(%rdi,%r9)
jl 0x6d3b
jg 0x6d41
cmpq %rcx, %r9
setb %r8b
cmpq %rsi, %r9
setb %al
jae 0x6d2a
leaq 0x1(%r9), %r10
cmpq %rcx, %r9
movq %r10, %r9
jb 0x6d01
movzbl %r8b, %ecx
negl %ecx
testb %al, %al
movl $0x1, %eax
cmovel %ecx, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_strstr
const char *mg_strstr(const struct mg_str haystack,
                      const struct mg_str needle) {
  size_t i;
  if (needle.len > haystack.len) return NULL;
  for (i = 0; i <= haystack.len - needle.len; i++) {
    if (memcmp(haystack.p + i, needle.p, needle.len) == 0) {
      return haystack.p + i;
    }
  }
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
subq %rcx, %r15
jb 0x6d96
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r12
xorl %ebp, %ebp
leaq (%r12,%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3470
testl %eax, %eax
je 0x6d99
incq %rbp
cmpq %r15, %rbp
jbe 0x6d78
xorl %r13d, %r13d
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: c_itoa
static int c_itoa(char *buf, size_t buf_size, int64_t num, int base, int flags,
                  int field_width) {
  char tmp[40];
  int i = 0, k = 0, neg = 0;

  if (num < 0) {
    neg++;
    num = -num;
  }

  /* Print into temporary buffer - in reverse order */
  do {
    int rem = num % base;
    if (rem < 10) {
      tmp[k++] = '0' + rem;
    } else {
      tmp[k++] = 'a' + (rem - 10);
    }
    num /= base;
  } while (num > 0);

  /* Zero padding */
  if (flags && C_SNPRINTF_FLAG_ZERO) {
    while (k < field_width && k < (int) sizeof(tmp) - 1) {
      tmp[k++] = '0';
    }
  }

  /* And sign */
  if (neg) {
    tmp[k++] = '-';
  }

  /* Now output */
  while (--k >= 0) {
    C_SNPRINTF_APPEND_CHAR(tmp[k]);
  }

  return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %r9d, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, %rsi
negq %rsi
cmovsq %rdx, %rsi
movl %ecx, %ecx
xorl %r12d, %r12d
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movl %edx, %edi
orb $0x30, %dil
leal 0x57(%rdx), %r9d
cmpq $0xa, %rdx
movzbl %dil, %edx
movzbl %r9b, %edi
cmovbl %edx, %edi
movb %dil, (%rsp,%r12)
incq %r12
cmpq %rcx, %rsi
movq %rax, %rsi
jae 0x729d
testl %r8d, %r8d
je 0x7328
leaq -0x1(%r12), %rax
cmpl %ebp, %r12d
setl %cl
cmpq $0x26, %rax
setb %al
testb %al, %cl
je 0x7328
leaq (%rsp,%r12), %rdi
movl %r12d, %eax
notl %eax
addl %ebp, %eax
movl $0x26, %edx
subq %r12, %rdx
cmpq %rdx, %rax
cmovbq %rax, %rdx
incq %rdx
movl $0x30, %esi
callq 0x3240
leaq 0x1(%r12), %rax
leal 0x1(%r12), %ecx
cmpl %ebp, %ecx
jge 0x732b
cmpq $0x26, %r12
movq %rax, %r12
jb 0x730f
jmp 0x732b
movl %r12d, %eax
testq %r15, %r15
jns 0x7339
movslq %eax, %rcx
incl %eax
movb $0x2d, (%rsp,%rcx)
testl %eax, %eax
jle 0x7363
movl %eax, %ecx
movslq %r14d, %rdx
leaq -0x1(%rsp), %rsi
xorl %edi, %edi
cmpq %rdx, %rdi
jge 0x7356
movb (%rsi,%rcx), %r8b
movb %r8b, (%rbx,%rdi)
incq %rdi
decq %rsi
cmpq %rdi, %rcx
jne 0x7349
jmp 0x7365
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: c_strnstr
const char *c_strnstr(const char *s, const char *find, size_t slen) {
  size_t find_length = strlen(find);
  size_t i;

  for (i = 0; i < slen; i++) {
    if (i + find_length > slen) {
      return NULL;
    }

    if (strncmp(&s[i], find, find_length) == 0) {
      return &s[i];
    }
  }

  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x3180
movq %rax, %r12
testq %rbx, %rbx
sete %al
cmpq %rbx, %r12
seta %cl
orb %al, %cl
je 0x742b
movq $0x0, (%rsp)
jmp 0x7469
movl $0x1, %r13d
movq $0x0, (%rsp)
leaq (%r15,%r13), %rbp
decq %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x30c0
testl %eax, %eax
je 0x7465
cmpq %rbx, %r13
jae 0x7469
leaq (%r12,%r13), %rax
incq %r13
cmpq %rbx, %rax
jbe 0x7439
jmp 0x7469
movq %rbp, (%rsp)
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_to_hex
void cs_to_hex(char *to, const unsigned char *p, size_t len) {
  static const char *hex = "0123456789abcdef";

  for (; len--; p++) {
    *to++ = hex[p[0] >> 4];
    *to++ = hex[p[0] & 0x0f];
  }
  *to = '\0';
}

// Assembly:
testq %rdx, %rdx
je 0x74bf
xorl %eax, %eax
leaq 0xe1af(%rip), %rcx      # 0x15639
xorl %r8d, %r8d
movzbl (%rsi,%r8), %r9d
shrl $0x4, %r9d
movb (%r9,%rcx), %r9b
movb %r9b, (%rdi,%r8,2)
movzbl (%rsi,%r8), %r9d
andl $0xf, %r9d
movb (%r9,%rcx), %r9b
movb %r9b, 0x1(%rdi,%r8,2)
incq %r8
addq $-0x2, %rax
cmpq %r8, %rdx
jne 0x748d
subq %rax, %rdi
movb $0x0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_from_hex
void cs_from_hex(char *to, const char *p, size_t len) {
  size_t i;

  for (i = 0; i < len; i += 2) {
    *to++ = (fourbit(p[i]) << 4) + fourbit(p[i + 1]);
  }
  *to = '\0';
}

// Assembly:
testq %rdx, %rdx
je 0x7547
xorl %eax, %eax
xorl %ecx, %ecx
movsbl (%rsi,%rcx), %r9d
leal -0x30(%r9), %r8d
cmpl $0xa, %r8d
jb 0x74fe
leal -0x61(%r9), %r8d
cmpl $0x5, %r8d
ja 0x74eb
addl $-0x57, %r9d
jmp 0x74fb
leal -0x41(%r9), %r8d
addl $-0x37, %r9d
cmpl $0x6, %r8d
cmovael %eax, %r9d
movl %r9d, %r8d
movsbl 0x1(%rsi,%rcx), %r9d
leal -0x30(%r9), %r10d
cmpl $0xa, %r10d
jb 0x7531
leal -0x61(%r9), %r10d
cmpl $0x5, %r10d
ja 0x751e
addl $-0x57, %r9d
jmp 0x752e
leal -0x41(%r9), %r10d
addl $-0x37, %r9d
cmpl $0x6, %r10d
cmovael %eax, %r9d
movl %r9d, %r10d
shll $0x4, %r8d
addl %r10d, %r8d
movb %r8b, (%rdi)
incq %rdi
addq $0x2, %rcx
cmpq %rdx, %rcx
jb 0x74cc
movb $0x0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_avprintf
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap) {
  va_list ap_copy;
  int len;

  va_copy(ap_copy, ap);
  len = vsnprintf(*buf, size, fmt, ap_copy);
  va_end(ap_copy);

  if (len < 0) {
    /* eCos and Windows are not standard-compliant and return -1 when
     * the buffer is too small. Keep allocating larger buffers until we
     * succeed or out of memory. */
    *buf = NULL; /* LCOV_EXCL_START */
    while (len < 0) {
      MG_FREE(*buf);
      if (size == 0) {
        size = 5;
      }
      size *= 2;
      if ((*buf = (char *) MG_MALLOC(size)) == NULL) {
        len = -1;
        break;
      }
      va_copy(ap_copy, ap);
      len = vsnprintf(*buf, size - 1, fmt, ap_copy);
      va_end(ap_copy);
    }

    /*
     * Microsoft version of vsnprintf() is not always null-terminated, so put
     * the terminator manually
     */
    (*buf)[len] = 0;
    /* LCOV_EXCL_STOP */
  } else if (len >= (int) size) {
    /* Standard-compliant code path. Allocate a buffer that is large enough. */
    if ((*buf = (char *) MG_MALLOC(len + 1)) == NULL) {
      len = -1; /* LCOV_EXCL_LINE */
    } else {    /* LCOV_EXCL_LINE */
      va_copy(ap_copy, ap);
      len = vsnprintf(*buf, len + 1, fmt, ap_copy);
      va_end(ap_copy);
    }
  }

  return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r14
movq 0x10(%rcx), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
movups (%r15), %xmm0
movaps %xmm0, (%rcx)
movq (%rdi), %rdi
callq 0x3110
testl %eax, %eax
js 0x7656
movl %eax, %r12d
cmpl %ebp, %eax
jl 0x76c3
incl %r12d
movq %r12, %rdi
callq 0x33e0
movq %rax, (%r14)
testq %rax, %rax
je 0x76bd
movq 0x10(%r15), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
movups (%r15), %xmm0
movaps %xmm0, (%rcx)
movq (%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3110
movl %eax, %r12d
jmp 0x76c3
movq $0x0, (%r14)
movq (%r14), %rdi
callq 0x3060
leaq (,%rbp,2), %r13
testq %rbp, %rbp
movl $0xa, %eax
cmoveq %rax, %r13
movq %r13, %rdi
callq 0x33e0
movq %rax, (%r14)
movups (%r15), %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movq (%r14), %rdi
leaq -0x1(%r13), %rsi
movq %rbx, %rdx
movq %rsp, %rcx
callq 0x3110
movq %r13, %rbp
testl %eax, %eax
js 0x765d
movl %eax, %r12d
movq (%r14), %rax
movl %r12d, %ecx
movb $0x0, (%rax,%rcx)
jmp 0x76c3
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_next_comma_list_entry_n
struct mg_str mg_next_comma_list_entry_n(struct mg_str list, struct mg_str *val,
                                         struct mg_str *eq_val) {
  if (list.len == 0) {
    /* End of the list */
    list = mg_mk_str(NULL);
  } else {
    const char *chr = NULL;
    *val = list;

    if ((chr = mg_strchr(*val, ',')) != NULL) {
      /* Comma found. Store length and shift the list ptr */
      val->len = chr - val->p;
      chr++;
      list.len -= (chr - list.p);
      list.p = chr;
    } else {
      /* This value is the last one */
      list = mg_mk_str_n(list.p + list.len, 0);
    }

    if (eq_val != NULL) {
      /* Value has form "x=y", adjust pointers and lengths */
      /* so that val points to "x", and eq_val points to "y". */
      eq_val->len = 0;
      eq_val->p = (const char *) memchr(val->p, '=', val->len);
      if (eq_val->p != NULL) {
        eq_val->p++; /* Skip over '=' character */
        eq_val->len = val->p + val->len - eq_val->p;
        val->len = (eq_val->p - val->p) - 1;
      }
    }
  }

  return list;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rsi, %rsi
je 0x7747
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq %rdi, (%rdx)
movq %rsi, 0x8(%rdx)
movl $0x2c, %edx
callq 0x6cc8
testq %rax, %rax
je 0x7756
movq %rax, %r12
movq (%r14), %rax
movq %r12, %rcx
subq %rax, %rcx
movq %rcx, 0x8(%r14)
incq %r12
addq %r13, %rbx
subq %r12, %rbx
jmp 0x7769
xorl %edi, %edi
callq 0x6b26
movq %rax, %r12
movq %rdx, %rbx
jmp 0x77b3
addq %r13, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6b43
movq %rax, %r12
movq %rdx, %rbx
testq %r15, %r15
je 0x77b3
movq $0x0, 0x8(%r15)
movq (%r14), %rdi
movq 0x8(%r14), %r13
movl $0x3d, %esi
movq %r13, %rdx
callq 0x32c0
movq %rax, (%r15)
testq %rax, %rax
je 0x77b3
leaq 0x1(%rax), %rcx
movq %rcx, (%r15)
movq (%r14), %rdx
addq %rdx, %r13
subq %rcx, %r13
movq %r13, 0x8(%r15)
notq %rdx
addq %rdx, %rax
incq %rax
movq %rax, 0x8(%r14)
movq %r12, %rax
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_if_timer
void mg_if_timer(struct mg_connection *c, double now) {
  if (c->ev_timer_time > 0 && now >= c->ev_timer_time) {
    double old_value = c->ev_timer_time;
    c->ev_timer_time = 0;
    mg_call(c, NULL, c->user_data, MG_EV_TIMER, &old_value);
  }
}

// Assembly:
movsd 0x78(%rdi), %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x7978
ucomisd %xmm1, %xmm0
jb 0x7978
pushq %rax
movq %rsp, %rcx
movsd %xmm1, (%rcx)
movq $0x0, 0x78(%rdi)
xorl %esi, %esi
movl $0x6, %edx
callq 0x7979
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_destroy_conn
void mg_destroy_conn(struct mg_connection *conn, int destroy_if) {
  if (destroy_if) conn->iface->vtable->destroy_conn(conn);
  if (conn->proto_data != NULL && conn->proto_data_destructor != NULL) {
    conn->proto_data_destructor(conn->proto_data);
  }
#if MG_ENABLE_SSL
  mg_ssl_if_conn_free(conn);
#endif
  mbuf_free(&conn->recv_mbuf);
  mbuf_free(&conn->send_mbuf);

  memset(conn, 0, sizeof(*conn));
  MG_FREE(conn);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0x7b68
movq 0xc0(%rbx), %rax
movq 0x10(%rax), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x7b82
movq 0x90(%rbx), %rax
testq %rax, %rax
je 0x7b82
callq *%rax
leaq 0x40(%rbx), %rdi
callq 0x6934
leaq 0x58(%rbx), %rdi
callq 0x6934
movq %rbx, %rdi
popq %rbx
jmp 0x3060
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_mgr_init_opt
void mg_mgr_init_opt(struct mg_mgr *m, void *user_data,
                     struct mg_mgr_init_opts opts) {
  memset(m, 0, sizeof(*m));
#if MG_ENABLE_BROADCAST
  m->ctl[0] = m->ctl[1] = INVALID_SOCKET;
#endif
  m->user_data = user_data;

#ifdef _WIN32
  {
    WSADATA data;
    WSAStartup(MAKEWORD(2, 2), &data);
  }
#elif defined(__unix__)
  /* Ignore SIGPIPE signal, so if client cancels the request, it
   * won't kill the whole process. */
  signal(SIGPIPE, SIG_IGN);
#endif

#if MG_ENABLE_SSL
  {
    static int init_done;
    if (!init_done) {
      mg_ssl_if_init();
      init_done++;
    }
  }
#endif
  {
    int i;
    if (opts.num_ifaces == 0) {
      opts.num_ifaces = mg_num_ifaces;
      opts.ifaces = mg_ifaces;
    }
    if (opts.main_iface != NULL) {
      opts.ifaces[MG_MAIN_IFACE] = opts.main_iface;
    }
    m->num_ifaces = opts.num_ifaces;
    m->ifaces =
        (struct mg_iface **) MG_MALLOC(sizeof(*m->ifaces) * opts.num_ifaces);
    for (i = 0; i < mg_num_ifaces; i++) {
      m->ifaces[i] = mg_if_create_iface(opts.ifaces[i], m);
      m->ifaces[i]->vtable->init(m->ifaces[i]);
    }
  }
  if (opts.nameserver != NULL) {
    m->nameserver = strdup(opts.nameserver);
  }
  DBG(("=================================="));
  DBG(("init mgr=%p", m));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, (%rdi)
movq $0x0, 0x30(%rdi)
movq $-0x1, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
movl $0x1, %esi
movl $0xd, %edi
callq 0x3390
movl 0x8(%r14), %eax
testl %eax, %eax
jne 0x7c26
movl 0x16749(%rip), %eax     # 0x1e364
leaq 0x1674e(%rip), %rcx     # 0x1e370
movq %rcx, 0x10(%r14)
movq (%r14), %rcx
testq %rcx, %rcx
je 0x7c35
movq 0x10(%r14), %rdx
movq %rcx, (%rdx)
movl %eax, 0x20(%rbx)
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x33e0
movq %rax, 0x28(%rbx)
cmpl $0x0, 0x16715(%rip)     # 0x1e364
jle 0x7c97
movq 0x10(%r14), %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %r13
movl $0x1, %edi
movl $0x18, %esi
callq 0x3300
movq %rbx, (%rax)
movq %r13, 0x10(%rax)
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq 0x10(%rdi), %rax
callq *(%rax)
incq %r12
movslq 0x166d2(%rip), %rax     # 0x1e364
cmpq %rax, %r12
jl 0x7c58
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x7ca9
callq 0x35f0
movq %rax, 0x30(%rbx)
leaq 0xd99a(%rip), %rsi      # 0x1564a
leaq 0xd917(%rip), %rdx      # 0x155ce
movl $0x4, %edi
callq 0x4447
testl %eax, %eax
je 0x7cd3
leaq 0xd98e(%rip), %rdi      # 0x1565a
xorl %eax, %eax
callq 0x4539
leaq 0xd970(%rip), %rsi      # 0x1564a
leaq 0xd8ed(%rip), %rdx      # 0x155ce
movl $0x4, %edi
callq 0x4447
testl %eax, %eax
je 0x7d09
leaq 0xd987(%rip), %rdi      # 0x1567d
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4539
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_if_create_iface
struct mg_iface *mg_if_create_iface(const struct mg_iface_vtable *vtable,
                                    struct mg_mgr *mgr) {
  struct mg_iface *iface = (struct mg_iface *) MG_CALLOC(1, sizeof(*iface));
  iface->mgr = mgr;
  iface->data = NULL;
  iface->vtable = vtable;
  return iface;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x3300
movq %rbx, (%rax)
movq %r14, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_mgr_free
void mg_mgr_free(struct mg_mgr *m) {
  struct mg_connection *conn, *tmp_conn;

  DBG(("%p", m));
  if (m == NULL) return;
  /* Do one last poll, see https://github.com/cesanta/mongoose/issues/286 */
  mg_mgr_poll(m, 0);

#if MG_ENABLE_BROADCAST
  if (m->ctl[0] != INVALID_SOCKET) closesocket(m->ctl[0]);
  if (m->ctl[1] != INVALID_SOCKET) closesocket(m->ctl[1]);
  m->ctl[0] = m->ctl[1] = INVALID_SOCKET;
#endif

  for (conn = m->active_connections; conn != NULL; conn = tmp_conn) {
    tmp_conn = conn->next;
    mg_close_conn(conn);
  }

  {
    int i;
    for (i = 0; i < m->num_ifaces; i++) {
      m->ifaces[i]->vtable->free(m->ifaces[i]);
      MG_FREE(m->ifaces[i]);
    }
    MG_FREE(m->ifaces);
  }

  MG_FREE((char *) m->nameserver);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xd940(%rip), %rsi      # 0x15689
leaq 0xd87e(%rip), %rdx      # 0x155ce
movl $0x4, %edi
callq 0x4447
testl %eax, %eax
je 0x7d6f
leaq 0xe406(%rip), %rdi      # 0x1616b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4539
testq %rbx, %rbx
je 0x7e06
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7e0e
movl 0x10(%rbx), %edi
cmpl $-0x1, %edi
je 0x7d8f
callq 0x3280
movl 0x14(%rbx), %edi
cmpl $-0x1, %edi
je 0x7d9c
callq 0x3280
movq $-0x1, 0x10(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x7dbc
movq (%rdi), %r14
callq 0x7e85
movq %r14, %rdi
testq %r14, %r14
jne 0x7dac
cmpl $0x0, 0x20(%rbx)
jle 0x7ded
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq 0x10(%rdi), %rax
callq *0x8(%rax)
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3060
incq %r14
movslq 0x20(%rbx), %rax
cmpq %rax, %r14
jl 0x7dc5
movq 0x28(%rbx), %rdi
callq 0x3060
movq 0x30(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_mgr_poll
time_t mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
  int i;
  time_t now = 0; /* oh GCC, seriously ? */

  if (m->num_ifaces == 0) {
    LOG(LL_ERROR, ("cannot poll: no interfaces"));
    return 0;
  }

  for (i = 0; i < m->num_ifaces; i++) {
    now = m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);
  }
  return now;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x20(%rdi), %eax
testl %eax, %eax
je 0x7e48
jle 0x7e75
movl %esi, %ebp
movq %rdi, %r14
xorl %r15d, %r15d
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rdi
movq 0x10(%rdi), %rax
movl %ebp, %esi
callq *0x20(%rax)
movq %rax, %rbx
incq %r15
movslq 0x20(%r14), %rax
cmpq %rax, %r15
jl 0x7e26
jmp 0x7e77
leaq 0xd846(%rip), %rsi      # 0x15695
leaq 0xd778(%rip), %rdx      # 0x155ce
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x4447
testl %eax, %eax
je 0x7e77
leaq 0xd837(%rip), %rdi      # 0x156a1
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4539
jmp 0x7e77
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq