// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_20/dcl.c
// Function: dir_dcl
void dir_dcl(void)
{
  if (next_token == PAREN_OPEN)
  {
    dcl();

    if (next_token != PAREN_CLOSE)
    {
      Error = TRUE;
      printf("Syntax Error: missing ')' on line %zu.\n", line_nr);
    }
  }
  else if (next_token == NAME)
  {
    strcpy(name, token);
  }
  else
  {
    Error = TRUE;
    printf("Syntax Error: expected name or (dcl) on line %zu.\n", line_nr);
  }

  while ((next_token = get_next_token()) == PARENS || next_token == BRACKETS || next_token == PAREN_OPEN)
  {
    if (next_token == PAREN_OPEN)
    {
      strcat(out, " function expecting");
      attr_dcl();
      strcat(out, " and returning");

      if (next_token != PAREN_CLOSE)
      {
        Error = TRUE;
        printf("Syntax Error: missing ')' on line %zu.\n", line_nr);

        if (next_token == '\n')
        {
          return;
        }
      }
    }
    else if (next_token == PARENS)
    {
      strcat(out, " function returning");
    }
    else if (next_token == BRACKETS)
    {
      strcat(out, " array[");
      strcat(out, token);
      strcat(out, "] of");
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpl $0x28, 0x28bd(%rip)     # 0x40bc
jne 0x1830
callq 0x1530
cmpl $0x29, 0x28af(%rip)     # 0x40bc
je 0x182e
movl $0x1, 0x289f(%rip)      # 0x40b8
movq 0x2890(%rip), %rsi      # 0x40b0
leaq 0x8bb(%rip), %rdi       # 0x20e2
movb $0x0, %al
callq 0x1040
jmp 0x186f
cmpl $0x0, 0x2885(%rip)      # 0x40bc
jne 0x184e
leaq 0x2d50(%rip), %rdi      # 0x4590
leaq 0x2c69(%rip), %rsi      # 0x44b0
callq 0x1030
jmp 0x186d
movl $0x1, 0x2860(%rip)      # 0x40b8
movq 0x2851(%rip), %rsi      # 0x40b0
leaq 0x8a4(%rip), %rdi       # 0x210a
movb $0x0, %al
callq 0x1040
jmp 0x186f
jmp 0x1871
callq 0x1340
movl %eax, %ecx
movl %ecx, 0x283e(%rip)      # 0x40bc
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0x1(%rbp)
je 0x18a3
movb $0x1, %al
cmpl $0x2, 0x282b(%rip)      # 0x40bc
movb %al, -0x1(%rbp)
je 0x18a3
cmpl $0x28, 0x281f(%rip)     # 0x40bc
sete %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
testb $0x1, %al
jne 0x18af
jmp 0x1983
cmpl $0x28, 0x2806(%rip)     # 0x40bc
jne 0x191a
leaq 0x2801(%rip), %rdi      # 0x40c0
leaq 0x877(%rip), %rsi       # 0x213d
callq 0x1070
callq 0x1990
leaq 0x27e9(%rip), %rdi      # 0x40c0
leaq 0x873(%rip), %rsi       # 0x2151
callq 0x1070
cmpl $0x29, 0x27d2(%rip)     # 0x40bc
je 0x1918
movl $0x1, 0x27c2(%rip)      # 0x40b8
movq 0x27b3(%rip), %rsi      # 0x40b0
leaq 0x7de(%rip), %rdi       # 0x20e2
movb $0x0, %al
callq 0x1040
cmpl $0xa, 0x27aa(%rip)      # 0x40bc
jne 0x1916
jmp 0x1983
jmp 0x1918
jmp 0x197e
cmpl $0x1, 0x279b(%rip)      # 0x40bc
jne 0x1938
leaq 0x2796(%rip), %rdi      # 0x40c0
leaq 0x82f(%rip), %rsi       # 0x2160
callq 0x1070
jmp 0x197c
cmpl $0x2, 0x277d(%rip)      # 0x40bc
jne 0x197a
leaq 0x2778(%rip), %rdi      # 0x40c0
leaq 0x825(%rip), %rsi       # 0x2174
callq 0x1070
leaq 0x2765(%rip), %rdi      # 0x40c0
leaq 0x2b4e(%rip), %rsi      # 0x44b0
callq 0x1070
leaq 0x2752(%rip), %rdi      # 0x40c0
leaq 0x807(%rip), %rsi       # 0x217c
callq 0x1070
jmp 0x197c
jmp 0x197e
jmp 0x1871
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)