// File: /workspace/github_c_makefile_star2_O0/marcomorain[P]garcon/http_parser.c
// Function: http_parse_host
static int
http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
  enum http_host_state s;

  const char *p;
  size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len;

  u->field_data[UF_HOST].len = 0;

  s = found_at ? s_http_userinfo_start : s_http_host_start;

  for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) {
    enum http_host_state new_s = http_parse_host_char(s, *p);

    if (new_s == s_http_host_dead) {
      return 1;
    }

    switch(new_s) {
      case s_http_host:
        if (s != s_http_host) {
          u->field_data[UF_HOST].off = p - buf;
        }
        u->field_data[UF_HOST].len++;
        break;

      case s_http_host_v6:
        if (s != s_http_host_v6) {
          u->field_data[UF_HOST].off = p - buf;
        }
        u->field_data[UF_HOST].len++;
        break;

      case s_http_host_port:
        if (s != s_http_host_port) {
          u->field_data[UF_PORT].off = p - buf;
          u->field_data[UF_PORT].len = 0;
          u->field_set |= (1 << UF_PORT);
        }
        u->field_data[UF_PORT].len++;
        break;

      case s_http_userinfo:
        if (s != s_http_userinfo) {
          u->field_data[UF_USERINFO].off = p - buf ;
          u->field_data[UF_USERINFO].len = 0;
          u->field_set |= (1 << UF_USERINFO);
        }
        u->field_data[UF_USERINFO].len++;
        break;

      default:
        break;
    }
    s = new_s;
  }

  /* Make sure we don't end somewhere unexpected */
  switch (s) {
    case s_http_host_start:
    case s_http_host_v6_start:
    case s_http_host_v6:
    case s_http_host_port_start:
    case s_http_userinfo:
    case s_http_userinfo_start:
      return 1;
    default:
      break;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
movzwl 0xa(%rcx), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movw $0x0, 0xa(%rax)
movl -0x1c(%rbp), %edx
movl $0x4, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
addq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jae 0x8fa8
movl -0x20(%rbp), %edi
movq -0x28(%rbp), %rax
movsbl (%rax), %esi
callq 0x90c0
movl %eax, -0x34(%rbp)
cmpl $0x1, -0x34(%rbp)
jne 0x8e7a
movl $0x1, -0x4(%rbp)
jmp 0x8fde
movl -0x34(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x7, %eax
ja 0x8f8f
movq -0x40(%rbp), %rax
leaq 0x293a(%rip), %rcx      # 0xb7d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x6, -0x20(%rbp)
je 0x8ebf
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x18(%rbp), %rax
movw 0xa(%rax), %cx
addw $0x1, %cx
movw %cx, 0xa(%rax)
jmp 0x8f91
cmpl $0x7, -0x20(%rbp)
je 0x8ef0
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x18(%rbp), %rax
movw 0xa(%rax), %cx
addw $0x1, %cx
movw %cx, 0xa(%rax)
jmp 0x8f91
cmpl $0xa, -0x20(%rbp)
je 0x8f38
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0xe(%rax)
movq -0x18(%rbp), %rax
movzwl (%rax), %ecx
orl $0x4, %ecx
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movw 0xe(%rax), %cx
addw $0x1, %cx
movw %cx, 0xe(%rax)
jmp 0x8f91
cmpl $0x3, -0x20(%rbp)
je 0x8f7d
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x1e(%rax)
movq -0x18(%rbp), %rax
movzwl (%rax), %ecx
orl $0x40, %ecx
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movw 0x1e(%rax), %cx
addw $0x1, %cx
movw %cx, 0x1e(%rax)
jmp 0x8f91
jmp 0x8f91
movl -0x34(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8e41
movl -0x20(%rbp), %eax
movl %eax, -0x44(%rbp)
addl $-0x2, %eax
subl $0x4, %eax
jb 0x8fcc
jmp 0x8fb8
movl -0x44(%rbp), %eax
subl $0x7, %eax
je 0x8fcc
jmp 0x8fc2
movl -0x44(%rbp), %eax
subl $0x9, %eax
jne 0x8fd5
jmp 0x8fcc
movl $0x1, -0x4(%rbp)
jmp 0x8fde
jmp 0x8fd7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)