// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/http-parser/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;

  assert(u->field_set & (1 << UF_HOST));

  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 = (uint16_t)(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 = (uint16_t)(p - buf);
        }
        u->field_data[UF_HOST].len++;
        break;

      case s_http_host_v6_zone_start:
      case s_http_host_v6_zone:
        u->field_data[UF_HOST].len++;
        break;

      case s_http_host_port:
        if (s != s_http_host_port) {
          u->field_data[UF_PORT].off = (uint16_t)(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 = (uint16_t)(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_v6_zone_start:
    case s_http_host_v6_zone:
    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
movzwl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xb20c
jmp 0xb22b
leaq 0x2a910(%rip), %rdi     # 0x35b23
leaq 0x29a7a(%rip), %rsi     # 0x34c94
movl $0x926, %edx            # imm = 0x926
leaq 0x2a91b(%rip), %rcx     # 0x35b41
callq 0x3250
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 0xb3dd
movl -0x20(%rbp), %edi
movq -0x28(%rbp), %rax
movsbl (%rax), %esi
callq 0xb520
movl %eax, -0x34(%rbp)
cmpl $0x1, -0x34(%rbp)
jne 0xb29a
movl $0x1, -0x4(%rbp)
jmp 0xb416
movl -0x34(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x9, %eax
ja 0xb3c4
movq -0x40(%rbp), %rax
leaq 0x29736(%rip), %rcx     # 0x349f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x6, -0x20(%rbp)
je 0xb2df
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 0xb3c6
cmpl $0x7, -0x20(%rbp)
je 0xb310
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 0xb3c6
movq -0x18(%rbp), %rax
movw 0xa(%rax), %cx
addw $0x1, %cx
movw %cx, 0xa(%rax)
jmp 0xb3c6
cmpl $0xc, -0x20(%rbp)
je 0xb36d
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 0xb3c6
cmpl $0x3, -0x20(%rbp)
je 0xb3b2
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 0xb3c6
jmp 0xb3c6
movl -0x34(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb261
movl -0x20(%rbp), %eax
movl %eax, -0x44(%rbp)
addl $-0x2, %eax
subl $0x4, %eax
jb 0xb404
jmp 0xb3ed
movl -0x44(%rbp), %eax
subl $0x7, %eax
je 0xb404
jmp 0xb3f7
movl -0x44(%rbp), %eax
addl $-0x9, %eax
subl $0x2, %eax
ja 0xb40d
jmp 0xb404
movl $0x1, -0x4(%rbp)
jmp 0xb416
jmp 0xb40f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop