LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/unifi-motion.c
// Function: cleanup
void cleanup() {
  close_log(_umHandles.logfile);
  inotify_rm_watch(_umHandles.trigger, _umHandles.descriptor);

  if (_mqtt_status == mqttrunning && _mqtt_connection != NULL)
    mg_mqtt_disconnect(_mqtt_connection);

  free_config(&_config);
}

// Assembly:
pushq %rax
movq 0x1a66b(%rip), %rdi     # 0x1e590
callq 0x3e25
movl 0x1a668(%rip), %edi     # 0x1e598
movl 0x1a66a(%rip), %esi     # 0x1e5a0
callq 0x3610
cmpl $0x1, 0x1a40e(%rip)     # 0x1e350
sete %al
movq 0x1a45c(%rip), %rdi     # 0x1e3a8
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3f5e
callq 0x11cac
leaq 0x1a44b(%rip), %rdi     # 0x1e3b0
popq %rax
jmp 0x14693
// File: /workspace/github_c_makefile_star2_O1/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 0x40c3
leaq 0x1a5d0(%rip), %rbp     # 0x1e5b0
leaq 0x1a3c9(%rip), %rbx     # 0x1e3b0
xorl %r15d, %r15d
movq 0x8(%rsp), %rsi
movl $0x3, %edx
leaq 0x1a40d(%rip), %rdi     # 0x1e408
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
callq 0x3460
testl %eax, %eax
je 0x402e
incl %r15d
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x3590
cmpq $-0x1, %rax
jne 0x3fea
jmp 0x40c3
movslq 0x40(%rsp), %rax
cmpq $-0x1, %rax
je 0x400c
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 0x11077(%rip), %rsi     # 0x150d8
xorl %eax, %eax
callq 0x35a0
movslq 0x1a519(%rip), %r12     # 0x1e588
testq %r12, %r12
jle 0x400c
xorl %r14d, %r14d
movq 0x98(%rbx,%r14,8), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3310
testl %eax, %eax
je 0x409b
incq %r14
cmpq %r14, %r12
jne 0x4077
jmp 0x400c
movq 0x1a306(%rip), %rdi     # 0x1e3a8
addq $0x28, %r13
movq %r13, %rsi
callq 0x3d30
cmpb $0x0, 0x14(%rsp)
je 0x400c
callq 0x3908
jmp 0x400c
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_O1/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 %rbx
movq %rdi, %rbx
movq 0x1a16d(%rip), %rdi     # 0x1e5e8
callq 0x3060
testq %rbx, %rbx
je 0x449e
movq %rbx, %rdi
callq 0x35f0
movq %rax, 0x1a154(%rip)     # 0x1e5e8
movq %rbx, %rdi
callq 0x3180
jmp 0x44ab
movq $0x0, 0x1a13f(%rip) # 0x1e5e8
xorl %eax, %eax
movq %rax, 0x1a13e(%rip)     # 0x1e5f0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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, 0x1a112(%rip)     # 0x1e5d8
jl 0x4561
movq %rsi, %r14
movl %edi, %ebx
movq 0x1a110(%rip), %rdi     # 0x1e5e8
testq %rdi, %rdi
je 0x450b
movq %rdx, %r15
movl 0x1a10a(%rip), %esi     # 0x1e5f0
movq %r14, %rdx
callq 0x456e
testl %eax, %eax
jns 0x450b
movq 0x1a0ef(%rip), %rdi     # 0x1e5e8
movl 0x1a0f1(%rip), %esi     # 0x1e5f0
movq %r15, %rdx
callq 0x456e
testl %eax, %eax
js 0x4561
movq %rsp, %r15
movl $0x14, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x30b0
movb $0x0, 0x14(%r15)
cmpq $0x0, 0x1a0b5(%rip)     # 0x1e5e0
jne 0x453e
movq 0x19abc(%rip), %rax     # 0x1dff0
movq (%rax), %rax
movq %rax, 0x1a0a2(%rip)     # 0x1e5e0
movl %ebx, 0x19e1c(%rip)     # 0x1e360
movq 0x1a095(%rip), %rdi     # 0x1e5e0
leaq 0x11006(%rip), %rsi     # 0x15558
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_O1/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 %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
testq %rdx, %rdx
je 0x458c
movq %rbx, %rdi
callq 0x3180
movq %rax, %rcx
jmp 0x458e
xorl %ecx, %ecx
movslq %ebp, %rsi
movq %r14, %rdi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x789b
// File: /workspace/github_c_makefile_star2_O1/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 0x45fe
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 0x19fbb(%rip), %rdi     # 0x1e5e0
movq %r10, %rsi
callq 0x3540
movq 0x19fac(%rip), %rsi     # 0x1e5e0
movl $0xa, %edi
callq 0x32b0
movq 0x19f9b(%rip), %rdi     # 0x1e5e0
callq 0x3400
movl $0xffffffff, 0x19d0c(%rip) # imm = 0xFFFFFFFF
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x46d1
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movb (%r14,%r12), %al
movslq 0xc(%r15), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0xc(%r15)
movb %al, 0x8(%r15,%rcx)
cmpl $0x3, 0xc(%r15)
jne 0x46be
movq %r15, %rdi
callq 0x46d2
movl $0x0, 0xc(%r15)
incq %r12
cmpq %r12, %rbx
jne 0x4693
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x12bda
shll $0x4, %r15d
andl $0x30, %r15d
movl %r14d, %esi
shrl $0x4, %esi
orl %r15d, %esi
movq %rbx, %rdi
callq 0x12bda
cmpl $0x2, 0xc(%rbx)
jl 0x4729
andl $0xf, %r14d
movl %ebp, %eax
shrl $0x6, %eax
leal (%rax,%r14,4), %esi
movq %rbx, %rdi
callq 0x12bda
cmpl $0x3, 0xc(%rbx)
jl 0x4746
andl $0x3f, %ebp
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x12bda
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x47a7
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 0x46d2
cmpl $0x2, 0xc(%rbx)
jg 0x47a1
movq 0x10(%rbx), %rsi
movl $0x3d, %edi
callq *(%rbx)
incl %ebp
movl $0x3, %eax
subl 0xc(%rbx), %eax
cmpl %eax, %ebp
jl 0x4788
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movq %rcx, -0x8(%rsp)
movl %esi, %eax
movq %rdx, %r8
cmpl $0x4, %esi
jl 0x4b02
leaq 0x2(%rdx), %r9
leaq 0x10a2c(%rip), %rcx     # 0x15460
movl %eax, %esi
movq %rdx, %r8
movzbl (%rdi), %r15d
andl $0x7f, %r15d
movb (%r15,%rcx), %bl
cmpb $-0x1, %bl
je 0x4b02
movzbl 0x1(%rdi), %r10d
andl $0x7f, %r10d
movb (%r10,%rcx), %r11b
cmpb $-0x1, %r11b
je 0x4b02
movzbl 0x2(%rdi), %r12d
andl $0x7f, %r12d
movb (%r12,%rcx), %bpl
cmpb $-0x1, %bpl
je 0x4af0
movzbl 0x3(%rdi), %r13d
andl $0x7f, %r13d
movb (%r13,%rcx), %r14b
cmpb $-0x1, %r14b
je 0x4b02
addl $-0x4, %esi
cmpb $0x3d, %r15b
je 0x4b02
cmpb $0x3d, %r10b
je 0x4b02
shlb $0x2, %bl
movl %r11d, %r10d
shrb $0x4, %r10b
orb %bl, %r10b
movb %r10b, -0x2(%r9)
cmpb $0x3d, %r12b
je 0x4af9
shlb $0x4, %r11b
movl %ebp, %r10d
shrb $0x2, %r10b
orb %r11b, %r10b
movb %r10b, -0x1(%r9)
cmpb $0x3d, %r13b
je 0x4afe
shlb $0x6, %bpl
orb %bpl, %r14b
addq $0x3, %r8
movb %r14b, (%r9)
leal 0x4(%rsi), %r10d
addq $0x3, %r9
addq $0x4, %rdi
cmpl $0x7, %r10d
jg 0x4a39
jmp 0x4b02
addq $-0x2, %r9
movq %r9, %r8
jmp 0x4b02
incq %r8
jmp 0x4b02
addq $0x2, %r8
movb $0x0, (%r8)
movq -0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x4b16
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_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_timegm
double cs_timegm(const struct tm *tm) {
  /* Month-to-day offset for non-leap-years. */
  static const int month_day[12] = {0,   31,  59,  90,  120, 151,
                                    181, 212, 243, 273, 304, 334};

  /* Most of the calculation is easy; leap years are the main difficulty. */
  int month = tm->tm_mon % 12;
  int year = tm->tm_year + tm->tm_mon / 12;
  int year_for_leap;
  int64_t rt;

  if (month < 0) { /* Negative values % 12 are still negative. */
    month += 12;
    --year;
  }

  /* This is the number of Februaries since 1900. */
  year_for_leap = (month > 1) ? year + 1 : year;

  rt =
      tm->tm_sec /* Seconds */
      +
      60 *
          (tm->tm_min /* Minute = 60 seconds */
           +
           60 * (tm->tm_hour /* Hour = 60 minutes */
                 +
                 24 * (month_day[month] + tm->tm_mday - 1 /* Day = 24 hours */
                       + 365 * (year - 70)                /* Year = 365 days */
                       + (year_for_leap - 69) / 4 /* Every 4 years is leap... */
                       - (year_for_leap - 1) / 100 /* Except centuries... */
                       + (year_for_leap + 299) / 400))); /* Except 400s. */
  return rt < 0 ? -1 : (double) rt;
}

// Assembly:
movslq 0x10(%rdi), %rcx
imulq $0x2aaaaaab, %rcx, %rsi # imm = 0x2AAAAAAB
movq %rsi, %rax
shrq $0x3f, %rax
sarq $0x21, %rsi
addl %eax, %esi
leal (,%rsi,4), %eax
leal (%rax,%rax,2), %eax
addl 0x14(%rdi), %esi
subl %eax, %ecx
leal 0xc(%rcx), %eax
movl %ecx, %edx
sarl $0x1f, %edx
addl %esi, %edx
testl %ecx, %ecx
cmovnsl %ecx, %eax
xorl %r9d, %r9d
cmpl $0x2, %eax
setge %r9b
leaq 0x1085c(%rip), %rsi     # 0x15400
imull $0x16d, %edx, %ecx      # imm = 0x16D
leal (%r9,%rdx), %r10d
addl $-0x45, %r10d
leal (%r9,%rdx), %r8d
addl $-0x42, %r8d
testl %r10d, %r10d
cmovnsl %r10d, %r8d
shrl $0x2, %r8d
leal (%r9,%rdx), %r10d
decl %r10d
movslq %r10d, %r10
imulq $-0x51eb851f, %r10, %r10 # imm = 0xAE147AE1
movq %r10, %r11
shrq $0x3f, %r11
sarq $0x25, %r10
addl %r11d, %r10d
addl %r9d, %edx
addl $0x12b, %edx            # imm = 0x12B
movslq %edx, %rdx
imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F
movq %rdx, %r9
shrq $0x3f, %r9
sarq $0x27, %rdx
addl (%rsi,%rax,4), %ecx
addl 0xc(%rdi), %ecx
addl %r9d, %edx
addl %r8d, %ecx
addl %r10d, %ecx
addl %edx, %ecx
leal (%rcx,%rcx,2), %eax
shll $0x3, %eax
addl 0x8(%rdi), %eax
imull $0x3c, %eax, %eax
addl 0x4(%rdi), %eax
movl (%rdi), %ecx
imull $0x3c, %eax, %eax
addl %ecx, %eax
addl $0x7c6a9980, %eax       # imm = 0x7C6A9980
testl %eax, %eax
js 0x4c37
cvtsi2sd %eax, %xmm0
retq
movsd 0x106b9(%rip), %xmm0    # 0x152f8
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x10(%rdi), %eax
leal (,%rdx,8), %ecx
addl %eax, %ecx
movl %ecx, 0x10(%rdi)
jae 0x4c7c
incl 0x14(%r15)
movl %ebx, %ecx
shrl $0x1d, %ecx
addl %ecx, 0x14(%r15)
shrl $0x3, %eax
andl $0x3f, %eax
je 0x4cf7
leaq (%r15,%rax), %rdi
addq $0x18, %rdi
movl $0x40, %r12d
subl %eax, %r12d
movq %rbx, %rbp
subq %r12, %rbp
jae 0x4cb6
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3380
movq %rbx, %rbp
jmp 0x4ce0
leaq 0x18(%r15), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x3380
movl $0x6, %eax
incq %rax
cmpl $0x16, %eax
jne 0x4cca
movq %r15, %rdi
movq %r13, %rsi
callq 0x4d71
addq %r12, %r14
cmpq %r12, %rbx
movq %rbp, %rbx
jae 0x4cf7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x40, %rbx
jb 0x4d51
leaq 0x18(%r15), %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)
movl $0x6, %eax
incq %rax
cmpl $0x16, %eax
jne 0x4d30
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d71
addq $0x40, %r14
addq $-0x40, %rbx
cmpq $0x3f, %rbx
ja 0x4d01
addq $0x18, %r15
movq %r15, %rdi
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_O1/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 0x552e
movl %ecx, %edx
xorl %esi, %esi
callq 0x3240
movl $0x6, %eax
incq %rax
cmpl $0x16, %eax
jne 0x5500
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d71
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq $0x0, 0x30(%r15)
jmp 0x553c
movl $0x37, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x3240
movl $0x6, %eax
incq %rax
cmpl $0x14, %eax
jne 0x5541
movq 0x10(%rbx), %rax
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d71
xorl %eax, %eax
incq %rax
cmpl $0x4, %eax
jne 0x555e
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_O1/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
addl %ebp, %eax
movl %eax, 0x14(%rdi)
jae 0x66c1
incl 0x18(%r15)
movl %ebx, %eax
shrl $0x1d, %eax
addl %eax, 0x18(%r15)
shrl $0x3, %ebp
andl $0x3f, %ebp
leal (%rbx,%rbp), %eax
cmpl $0x40, %eax
jb 0x6729
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 0x5591
xorl $0x7f, %ebp
cmpl %ebx, %ebp
jae 0x6730
leal -0x3f(%rbp), %esi
addq %r14, %rsi
movq %r15, %rdi
callq 0x5591
addl $0x40, %ebp
cmpl %ebx, %ebp
jb 0x670a
addl $-0x3f, %ebp
xorl %eax, %eax
movl %ebp, %r12d
jmp 0x6732
movl %ebp, %eax
xorl %r12d, %r12d
jmp 0x6732
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_O1/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 0x6770
leaq 0xf(%rsp), %rsi
movb $-0x80, (%rsi)
movq %rbx, %rdi
movl $0x1, %edx
callq 0x6699
movl $0x1f8, %ebp            # imm = 0x1F8
movl 0x14(%rbx), %eax
andl %ebp, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
je 0x67e3
leaq 0xf(%rsp), %r15
movb $0x0, 0xf(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x6699
movl 0x14(%rbx), %eax
andl %ebp, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x67c2
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x6699
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 0x67f9
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_O1/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 0x68aa
movaps 0xead4(%rip), %xmm0     # 0x15340
leaq 0xac(%rsp), %rbp
movups %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 0x6699
movq %rsp, %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x675c
movl $0x14, %r13d
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdi
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
leaq 0x20(%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
xorb $0x36, 0x60(%rsp,%rax)
xorb $0x5c, 0x20(%rsp,%rax)
incq %rax
cmpq $0x40, %rax
jne 0x68f1
movaps 0xea35(%rip), %xmm0     # 0x15340
leaq 0xac(%rsp), %r12
movups %xmm0, (%r12)
movl $0xc3d2e1f0, %r13d      # imm = 0xC3D2E1F0
movq %r13, 0x10(%r12)
xorl %ebp, %ebp
movl %ebp, 0x18(%r12)
leaq 0x60(%rsp), %rsi
movq %r12, %rdi
movl $0x40, %edx
callq 0x6699
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x6699
movq %rbx, %rdi
movq %r12, %rsi
callq 0x675c
movaps 0xe9e4(%rip), %xmm0     # 0x15340
movups %xmm0, (%r12)
movq %r13, 0x10(%r12)
movl %ebp, 0x18(%r12)
leaq 0x20(%rsp), %rsi
movq %r12, %rdi
movl $0x40, %edx
callq 0x6699
movq %r12, %rdi
movq %rbx, %rsi
movl $0x14, %edx
callq 0x6699
movq %rbx, %rdi
movq %r12, %rsi
callq 0x675c
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x69f1
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x34a0
testq %rax, %rax
sete %cl
testq %rbx, %rbx
setne %dl
testb %cl, %dl
jne 0x69f9
movq %rax, (%r14)
movq %rbx, 0x10(%r14)
jmp 0x69f9
jbe 0x69f9
cmpq %rbx, 0x8(%r14)
jbe 0x69cd
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6b4c
movq %rcx, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rcx, %rax
ja 0x6b6b
movq %rdx, %r15
movq %rsi, %r12
movq %rax, %rdx
subq %rsi, %rdx
jb 0x6b8a
movq (%r14), %rsi
movq %rsi, %rdi
addq %rbx, %rdi
jae 0x6a77
xorl %ebx, %ebx
jmp 0x6b3a
addq %rbx, %rax
cmpq %rcx, %rax
jbe 0x6b14
movq %rax, %xmm0
punpckldq 0xe8c0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xe8c8(%rip), %xmm0     # 0x15360
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xe854(%rip), %xmm1     # 0x15300
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xe848(%rip), %xmm1     # 0x15308
cvttsd2si %xmm1, %r13
andq %rcx, %r13
orq %rax, %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x34a0
testq %rax, %rax
je 0x6a70
movq %rax, %rbp
movq %rax, (%r14)
addq %r12, %rbp
leaq (%rbx,%rbp), %rdi
movq 0x8(%r14), %rdx
subq %r12, %rdx
movq %rbp, %rsi
callq 0x3500
testq %r15, %r15
je 0x6b0a
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3380
addq %rbx, 0x8(%r14)
movq %r13, 0x10(%r14)
jmp 0x6b3a
addq %r12, %rsi
leaq (%rsi,%rbx), %rdi
callq 0x3500
testq %r15, %r15
je 0x6b36
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 0xea4d(%rip), %rdi      # 0x155a0
leaq 0xea50(%rip), %rsi      # 0x155aa
leaq 0xea54(%rip), %rcx      # 0x155b5
movl $0x568, %edx            # imm = 0x568
callq 0x3220
leaq 0xea83(%rip), %rdi      # 0x155f5
leaq 0xea31(%rip), %rsi      # 0x155aa
leaq 0xea35(%rip), %rcx      # 0x155b5
movl $0x569, %edx            # imm = 0x569
callq 0x3220
leaq 0xea76(%rip), %rdi      # 0x15607
leaq 0xea12(%rip), %rsi      # 0x155aa
leaq 0xea16(%rip), %rcx      # 0x155b5
movl $0x56a, %edx            # imm = 0x56A
callq 0x3220
// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_vcmp
int mg_vcmp(const struct mg_str *str1, const char *str2) {
  size_t n2 = strlen(str2), n1 = str1->len;
  int r = strncmp(str1->p, str2, (n1 < n2) ? n1 : n2);
  if (r == 0) {
    return n1 - n2;
  }
  return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x3180
movq %rax, %r15
movq (%r14), %rdi
movq 0x8(%r14), %r14
cmpq %rax, %r14
movq %rax, %rdx
cmovbq %r14, %rdx
movq %rbx, %rsi
callq 0x30c0
subl %r15d, %r14d
testl %eax, %eax
cmovel %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6cd3
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 0x6ccd
xorl %eax, %eax
testb %sil, %sil
je 0x6ccd
leaq 0x1(%rdx), %rsi
cmpq %rdx, %rbx
movq %rsi, %rdx
jne 0x6ca8
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6d81
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1(%rsi), %rdi
callq 0x33e0
testq %rax, %rax
je 0x6d7c
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3380
movb $0x0, (%r15,%rbx)
movq %rbx, %rdx
jmp 0x6d81
xorl %edx, %edx
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6dec
movl $0x1, %r9d
movb -0x1(%rdx,%r9), %al
cmpb %al, -0x1(%rdi,%r9)
jl 0x6dfd
jg 0x6e03
cmpq %rcx, %r9
setb %r8b
cmpq %rsi, %r9
setb %al
jae 0x6dec
leaq 0x1(%r9), %r10
cmpq %rcx, %r9
movq %r10, %r9
jb 0x6dc3
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_O1/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 0x6e58
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 0x6e5b
incq %rbp
cmpq %r15, %rbp
jbe 0x6e3a
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_O1/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
leal 0x57(%rdx), %edi
movl %edx, %r9d
orb $0x30, %r9b
cmpq $0xa, %rdx
movzbl %r9b, %edx
movzbl %dil, %edi
cmovbl %edx, %edi
movb %dil, (%rsp,%r12)
incq %r12
cmpq %rcx, %rsi
movq %rax, %rsi
jae 0x736d
testl %r8d, %r8d
je 0x73f8
leaq -0x1(%r12), %rax
cmpl %ebp, %r12d
setl %cl
cmpq $0x26, %rax
setb %al
testb %al, %cl
je 0x73f8
leaq (%rsp,%r12), %rdi
movl %r12d, %eax
notl %eax
addl %ebp, %eax
movl $0x26, %edx
subl %r12d, %edx
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 0x73fb
cmpq $0x26, %r12
movq %rax, %r12
jb 0x73df
jmp 0x73fb
movl %r12d, %eax
testq %r15, %r15
jns 0x7409
movslq %eax, %rcx
incl %eax
movb $0x2d, (%rsp,%rcx)
testl %eax, %eax
jle 0x7433
movl %eax, %ecx
movslq %r14d, %rdx
leaq -0x1(%rsp), %rsi
xorl %eax, %eax
cmpq %rdx, %rax
jge 0x7426
movb (%rsi,%rcx), %dil
movb %dil, (%rbx,%rax)
incq %rax
decq %rsi
cmpq %rax, %rcx
jne 0x7419
jmp 0x7435
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: c_snprintf
int c_snprintf(char *buf, size_t buf_size, const char *fmt, ...) {
  int result;
  va_list ap;
  va_start(ap, fmt);
  result = c_vsnprintf(buf, buf_size, fmt, ap);
  va_end(ap);
  return result;
}

// Assembly:
subq $0xd8, %rsp
leaq 0x20(%rsp), %r10
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x7495
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 %r10, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
callq 0x6e86
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x74fb
movq $0x0, (%rsp)
jmp 0x7539
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 0x7535
cmpq %rbx, %r13
jae 0x7539
leaq (%r12,%r13), %rax
incq %r13
cmpq %rbx, %rax
jbe 0x7509
jmp 0x7539
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_O1/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 0x758f
xorl %eax, %eax
leaq 0xe0bb(%rip), %rcx      # 0x15615
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 0x755d
subq %rax, %rdi
movb $0x0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7617
xorl %eax, %eax
xorl %ecx, %ecx
movsbl (%rsi,%rcx), %r9d
leal -0x30(%r9), %r8d
cmpl $0xa, %r8d
jb 0x75ce
leal -0x61(%r9), %r8d
cmpl $0x5, %r8d
ja 0x75bb
addl $-0x57, %r9d
jmp 0x75cb
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 0x7601
leal -0x61(%r9), %r10d
cmpl $0x5, %r10d
ja 0x75ee
addl $-0x57, %r9d
jmp 0x75fe
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 0x759c
movb $0x0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_asprintf
int mg_asprintf(char **buf, size_t size, const char *fmt, ...) {
  int ret;
  va_list ap;
  va_start(ap, fmt);
  ret = mg_avprintf(buf, size, fmt, ap);
  va_end(ap);
  return ret;
}

// Assembly:
subq $0xd8, %rsp
leaq 0x20(%rsp), %r10
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x767a
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 %r10, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
callq 0x76a7
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rsi, %r12
movq %rdi, %rbx
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 0x7727
movl %eax, %r13d
cmpl %r12d, %eax
jl 0x779b
incl %r13d
movq %r13, %rdi
callq 0x33e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x7795
movq 0x10(%r15), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
movups (%r15), %xmm0
movaps %xmm0, (%rcx)
movq (%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x3110
movl %eax, %r13d
jmp 0x779b
movq $0x0, (%rbx)
movl $0xa, %ebp
movq (%rbx), %rdi
callq 0x3060
testq %r12, %r12
leaq (%r12,%r12), %r12
cmoveq %rbp, %r12
movq %r12, %rdi
callq 0x33e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x7783
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movaps %xmm0, (%rsp)
movq (%rbx), %rdi
leaq -0x1(%r12), %rsi
movq %r14, %rdx
movq %rsp, %rcx
callq 0x3110
testl %eax, %eax
js 0x7733
movl %eax, %r13d
jmp 0x7789
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq (%rbx), %rax
movslq %r13d, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x779b
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x781f
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq %rdi, (%rdx)
movq %rsi, 0x8(%rdx)
movl $0x2c, %edx
callq 0x6d8a
testq %rax, %rax
je 0x782e
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 0x7841
xorl %edi, %edi
callq 0x6be8
movq %rax, %r12
movq %rdx, %rbx
jmp 0x788b
addq %r13, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6c05
movq %rax, %r12
movq %rdx, %rbx
testq %r15, %r15
je 0x788b
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 0x788b
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_O1/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 0x7a50
ucomisd %xmm1, %xmm0
jb 0x7a50
pushq %rax
movq %rsp, %rcx
movsd %xmm1, (%rcx)
movq $0x0, 0x78(%rdi)
xorl %esi, %esi
movl $0x6, %edx
callq 0x7a51
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7c40
movq 0xc0(%rbx), %rax
movq 0x10(%rax), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x7c5a
movq 0x90(%rbx), %rax
testq %rax, %rax
je 0x7c5a
callq *%rax
leaq 0x40(%rbx), %rdi
callq 0x6a01
leaq 0x58(%rbx), %rdi
callq 0x6a01
movl $0xd0, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3240
movq %rbx, %rdi
popq %rbx
jmp 0x3060