// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_20/dcl.c
// Function: attr_dcl
void attr_dcl(void)
{
  while (get_next_token() != PAREN_CLOSE && next_token != '\n')
  {
    if (next_token == ATTR_SEPARATOR)
    {
      strcat(out, ",");
    }
    else if (next_token == NAME)
    {
      if (is_valid_qualifier(token))
      {
        strcat(out, " ");
        strcat(out, token);
        get_next_token();
      }

      if (is_valid_data_type(token))
      {
        enum boolean is_void_type = FALSE;
        if (strcmp(token, "void") == 0)
        {
          is_void_type = TRUE;
        }

        strcat(out, " ");
        strcat(out, token);

        get_next_token();
        if (next_token == NAME)
        {
          if (is_void_type)
          {
            printf("Error: variable '%s' has incomplete type 'void' on line %zu.\n", token, line_nr);
          }

          strcat(out, " ");
          strcat(out, token);
        }
        else if (next_token == PAREN_CLOSE)
        {
          if (is_void_type)
          {
            return;
          }

          Error = TRUE;
          printf("Syntax Error: missing variable name on line %zu.\n", line_nr);
          return;
        }
        else
        {
          Error = TRUE;
          printf("Syntax Error: '%c' unexpected on line %zu.\n", next_token, line_nr);
        }
      }
      else
      {
        Error = TRUE;
        printf("Syntax Error: '%s' unexpected on line %zu.\n", token, line_nr);
      }
    }
    else
    {
      Error = TRUE;
      printf("Syntax Error: '%c' unexpected on line %zu.\n", next_token, line_nr);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x1340
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x29, %ecx
movb %al, -0x5(%rbp)
je 0x19b6
cmpl $0xa, 0x270c(%rip)      # 0x40bc
setne %al
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %al
testb $0x1, %al
jne 0x19c2
jmp 0x1b97
cmpl $0x2c, 0x26f3(%rip)     # 0x40bc
jne 0x19e3
leaq 0x26ee(%rip), %rdi      # 0x40c0
leaq 0x7a8(%rip), %rsi       # 0x2181
callq 0x1070
jmp 0x1b92
cmpl $0x0, 0x26d2(%rip)      # 0x40bc
jne 0x1b6b
leaq 0x2ab9(%rip), %rdi      # 0x44b0
callq 0x17a0
cmpl $0x0, %eax
je 0x1a2c
leaq 0x26b8(%rip), %rdi      # 0x40c0
leaq 0x774(%rip), %rsi       # 0x2183
callq 0x1070
leaq 0x26a5(%rip), %rdi      # 0x40c0
leaq 0x2a8e(%rip), %rsi      # 0x44b0
callq 0x1070
callq 0x1340
leaq 0x2a7d(%rip), %rdi      # 0x44b0
callq 0x14c0
cmpl $0x0, %eax
je 0x1b43
movl $0x0, -0x4(%rbp)
leaq 0x2a61(%rip), %rdi      # 0x44b0
leaq 0x5ae(%rip), %rsi       # 0x2004
callq 0x1050
cmpl $0x0, %eax
jne 0x1a67
movl $0x1, -0x4(%rbp)
leaq 0x2652(%rip), %rdi      # 0x40c0
leaq 0x70e(%rip), %rsi       # 0x2183
callq 0x1070
leaq 0x263f(%rip), %rdi      # 0x40c0
leaq 0x2a28(%rip), %rsi      # 0x44b0
callq 0x1070
callq 0x1340
cmpl $0x0, 0x2623(%rip)      # 0x40bc
jne 0x1ae5
cmpl $0x0, -0x4(%rbp)
je 0x1abd
movq 0x2608(%rip), %rdx      # 0x40b0
leaq 0x6d6(%rip), %rdi       # 0x2185
leaq 0x29fa(%rip), %rsi      # 0x44b0
movb $0x0, %al
callq 0x1040
leaq 0x25fc(%rip), %rdi      # 0x40c0
leaq 0x6b8(%rip), %rsi       # 0x2183
callq 0x1070
leaq 0x25e9(%rip), %rdi      # 0x40c0
leaq 0x29d2(%rip), %rsi      # 0x44b0
callq 0x1070
jmp 0x1b41
cmpl $0x29, 0x25d0(%rip)     # 0x40bc
jne 0x1b1a
cmpl $0x0, -0x4(%rbp)
je 0x1af9
jmp 0x1b97
movl $0x1, 0x25b5(%rip)      # 0x40b8
movq 0x25a6(%rip), %rsi      # 0x40b0
leaq 0x6b2(%rip), %rdi       # 0x21c3
movb $0x0, %al
callq 0x1040
jmp 0x1b97
movl $0x1, 0x2594(%rip)      # 0x40b8
movl 0x2592(%rip), %esi      # 0x40bc
movq 0x257f(%rip), %rdx      # 0x40b0
leaq 0x556(%rip), %rdi       # 0x208e
movb $0x0, %al
callq 0x1040
jmp 0x1b41
jmp 0x1b69
movl $0x1, 0x256b(%rip)      # 0x40b8
movq 0x255c(%rip), %rdx      # 0x40b0
leaq 0x507(%rip), %rdi       # 0x2062
leaq 0x294e(%rip), %rsi      # 0x44b0
movb $0x0, %al
callq 0x1040
jmp 0x1b90
movl $0x1, 0x2543(%rip)      # 0x40b8
movl 0x2541(%rip), %esi      # 0x40bc
movq 0x252e(%rip), %rdx      # 0x40b0
leaq 0x505(%rip), %rdi       # 0x208e
movb $0x0, %al
callq 0x1040
jmp 0x1b92
jmp 0x1998
addq $0x10, %rsp
popq %rbp
retq