// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x3, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x8(%rbp), %rdx
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x35d0
movq %rax, -0x28(%rbp)
cmpq $-0x1, %rax
je 0x4164
movq -0x50(%rbp), %rcx
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq 0x2341a(%rip), %rdi     # 0x27480
addq $0x58, %rdi
xorl %r8d, %r8d
callq 0x34a0
cmpl $0x0, %eax
jne 0x415f
movq -0x50(%rbp), %rax
movslq 0x10(%rax), %rax
cmpq $-0x1, %rax
jne 0x408e
jmp 0x415d
movq -0x50(%rbp), %rax
movl 0xc(%rax), %edx
subl 0x8(%rax), %edx
movq -0x18(%rbp), %rcx
movslq 0x8(%rax), %rsi
addq %rsi, %rcx
movl 0x14(%rax), %r8d
subl 0x10(%rax), %r8d
movq -0x18(%rbp), %r9
movslq 0x10(%rax), %rax
addq %rax, %r9
leaq 0x235b3(%rip), %rdi     # 0x27670
leaq 0x1b014(%rip), %rsi     # 0x1f0d8
movb $0x0, %al
callq 0x35e0
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl 0x2357d(%rip), %eax     # 0x27658
jge 0x415b
movslq -0x48(%rbp), %rcx
leaq 0x23398(%rip), %rax     # 0x27480
movq 0x98(%rax,%rcx,8), %rdi
leaq 0x23579(%rip), %rsi     # 0x27670
callq 0x3340
cmpl $0x0, %eax
jne 0x414b
movq 0x23370(%rip), %rdi     # 0x27478
movslq -0x48(%rbp), %rcx
leaq 0x2336d(%rip), %rax     # 0x27480
movq 0x98(%rax,%rcx,8), %rsi
addq $0x28, %rsi
callq 0x3a80
testb $0x1, -0x9(%rbp)
je 0x4149
movq 0x22ebf(%rip), %rax     # 0x26ff0
movq (%rax), %rdi
leaq 0x1afa7(%rip), %rsi     # 0x1f0e2
leaq 0x2352e(%rip), %rdx     # 0x27670
movb $0x0, %al
callq 0x3370
jmp 0x415b
jmp 0x414d
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x40d2
jmp 0x415d
jmp 0x415f
jmp 0x402b
movl -0x44(%rbp), %eax
movq -0x38(%rbp), %rcx
movq %rcx, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)