// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: parse_header
static int parse_header(const char *str, size_t str_len, const char *var_name,
                        char *buf, size_t buf_size) {
  int ch = ' ', ch1 = ',', len = 0;
  size_t n = strlen(var_name);
  const char *p, *end = str + str_len, *s = NULL;

  if (buf != NULL && buf_size > 0) buf[0] = '\0';

  // Find where variable starts
  for (s = str; s != NULL && s + n < end; s++) {
    if ((s == str || s[-1] == ch || s[-1] == ch1) && s[n] == '=' &&
        !memcmp(s, var_name, n)) break;
  }

  if (s != NULL && &s[n + 1] < end) {
    s += n + 1;
    if (*s == '"' || *s == '\'') ch = ch1 = *s++;
    p = s;
    while (p < end && p[0] != ch && p[0] != ch1 && len < (int) buf_size) {
      if (ch == ch1 && p[0] == '\\' && p[1] == ch) p++;
      buf[len++] = *p++;
    }
    if (len >= (int) buf_size || (ch != ' ' && *p != ch)) {
      len = 0;
    } else {
      if (len > 0 && s[len - 1] == ',') len--;
      if (len > 0 && s[len - 1] == ';') len--;
      buf[len] = '\0';
    }
  }

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x20, -0x2c(%rbp)
movl $0x2c, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd550
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xb3077
cmpq $0x0, -0x28(%rbp)
jbe 0xb3077
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x58(%rbp)
movb %al, -0x59(%rbp)
je 0xb309d
movq -0x58(%rbp), %rax
addq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
setb %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0xb30a6
jmp 0xb3106
movq -0x58(%rbp), %rax
cmpq -0x8(%rbp), %rax
je 0xb30ca
movq -0x58(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl -0x2c(%rbp), %eax
je 0xb30ca
movq -0x58(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl -0x30(%rbp), %eax
jne 0xb30f3
movq -0x58(%rbp), %rax
movq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0xb30f3
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xddb0
cmpl $0x0, %eax
jne 0xb30f3
jmp 0xb3106
jmp 0xb30f5
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0xb307f
cmpq $0x0, -0x58(%rbp)
je 0xb3291
movq -0x58(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x1, %rcx
addq %rcx, %rax
cmpq -0x50(%rbp), %rax
jae 0xb3291
movq -0x40(%rbp), %rax
addq $0x1, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0xb3152
movq -0x58(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jne 0xb316a
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movsbl (%rax), %eax
movl %eax, -0x30(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x5a(%rbp)
jae 0xb31b2
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x5a(%rbp)
je 0xb31b2
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl -0x30(%rbp), %ecx
movb %al, -0x5a(%rbp)
je 0xb31b2
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl %ecx, %eax
setl %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0xb31bb
jmp 0xb3213
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0xb31e8
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0xb31e8
movq -0x48(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl -0x2c(%rbp), %eax
jne 0xb31e8
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x48(%rbp)
movb (%rax), %dl
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0xb3172
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl %ecx, %eax
jge 0xb3230
cmpl $0x20, -0x2c(%rbp)
je 0xb3239
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x2c(%rbp), %eax
je 0xb3239
movl $0x0, -0x34(%rbp)
jmp 0xb328f
cmpl $0x0, -0x34(%rbp)
jle 0xb325e
movq -0x58(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
jne 0xb325e
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0xb3283
movq -0x58(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
jne 0xb3283
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0xb3291
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)