// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_20/dcl.c
// Function: main
int main(void)
{
  while (get_next_token() != EOF)
  {
    if (next_token == '\n')
    {
      ++line_nr;
      continue;
    }

    out[0] = '\0';

    if (is_valid_data_type(token))
    {
      strcpy(data_type, token);
    }
    else
    {
      Error = TRUE;
      printf("Error: invalid data type '%s' on line %zu.\n", token, line_nr);

      do
      {
        get_next_token();
      } while (next_token != '\n' && next_token != EOF);

      ++line_nr;
      continue;
    }

    dcl();

    if (next_token != '\n')
    {
      if (next_token == NAME)
      {
        printf("Syntax Error: '%s' unexpected on line %zu.\n", token, line_nr);
      }
      else
      {
        printf("Syntax Error: '%c' unexpected on line %zu.\n", next_token, line_nr);
      }

      do
      {
        get_next_token();
      } while (next_token != '\n' && next_token != EOF);
    }
    else if (!Error)
    {
      printf("%s:%s %s\n", name, out, data_type);
    }

    Error = FALSE;
    ++line_nr;
  }

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
callq 0x1340
cmpl $-0x1, %eax
je 0x1335
cmpl $0xa, 0x2ef8(%rip)      # 0x40bc
jne 0x11da
movq 0x2ee3(%rip), %rax      # 0x40b0
addq $0x1, %rax
movq %rax, 0x2ed8(%rip)      # 0x40b0
jmp 0x11af
movb $0x0, 0x2edf(%rip)      # 0x40c0
leaq 0x32c8(%rip), %rdi      # 0x44b0
callq 0x14c0
cmpl $0x0, %eax
je 0x1207
leaq 0x3327(%rip), %rdi      # 0x4520
leaq 0x32b0(%rip), %rsi      # 0x44b0
callq 0x1030
jmp 0x126b
movl $0x1, 0x2ea7(%rip)      # 0x40b8
movq 0x2e98(%rip), %rdx      # 0x40b0
leaq 0xe17(%rip), %rdi       # 0x2036
leaq 0x328a(%rip), %rsi      # 0x44b0
movb $0x0, %al
callq 0x1040
callq 0x1340
xorl %eax, %eax
cmpl $0xa, 0x2e81(%rip)      # 0x40bc
movb %al, -0x5(%rbp)
je 0x124d
cmpl $-0x1, 0x2e75(%rip)     # 0x40bc
setne %al
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %al
testb $0x1, %al
jne 0x122d
movq 0x2e55(%rip), %rax      # 0x40b0
addq $0x1, %rax
movq %rax, 0x2e4a(%rip)      # 0x40b0
jmp 0x11af
callq 0x1530
cmpl $0xa, 0x2e45(%rip)      # 0x40bc
je 0x12e6
cmpl $0x0, 0x2e3c(%rip)      # 0x40bc
jne 0x12a0
movq 0x2e27(%rip), %rdx      # 0x40b0
leaq 0xdd2(%rip), %rdi       # 0x2062
leaq 0x3219(%rip), %rsi      # 0x44b0
movb $0x0, %al
callq 0x1040
jmp 0x12bb
movl 0x2e16(%rip), %esi      # 0x40bc
movq 0x2e03(%rip), %rdx      # 0x40b0
leaq 0xdda(%rip), %rdi       # 0x208e
movb $0x0, %al
callq 0x1040
jmp 0x12bd
callq 0x1340
xorl %eax, %eax
cmpl $0xa, 0x2df1(%rip)      # 0x40bc
movb %al, -0x6(%rbp)
je 0x12dd
cmpl $-0x1, 0x2de5(%rip)     # 0x40bc
setne %al
movb %al, -0x6(%rbp)
movb -0x6(%rbp), %al
testb $0x1, %al
jne 0x12bd
jmp 0x1314
cmpl $0x0, 0x2dcb(%rip)      # 0x40b8
jne 0x1312
leaq 0xdc4(%rip), %rdi       # 0x20ba
leaq 0x3293(%rip), %rsi      # 0x4590
leaq 0x2dbc(%rip), %rdx      # 0x40c0
leaq 0x3215(%rip), %rcx      # 0x4520
movb $0x0, %al
callq 0x1040
jmp 0x1314
movl $0x0, 0x2d9a(%rip)      # 0x40b8
movq 0x2d8b(%rip), %rax      # 0x40b0
addq $0x1, %rax
movq %rax, 0x2d80(%rip)      # 0x40b0
jmp 0x11af
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)