// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_19/undcl.c
// Function: main
int main(void)
{
  char temp[MAX_OUT_LEN + MAX_TOKEN_LEN];

  while (get_next_token() != EOF)
  {
    strcpy(out, token);

    while (get_next_token() != '\n')
    {
      if (next_token == PARENS)
      {
        if (out[0] == '*')
        {
          sprintf(temp, "(%s)", out);
          strcpy(out, temp);
        }

        strcat(out, token);
      }
      else if (next_token == BRACKETS)
      {
        if (out[0] == '*')
        {
          sprintf(temp, "(%s)", out);
          strcpy(out, temp);
        }

        sprintf(temp, "[%s]", token);
        strcat(out, temp);
      }
      else if (next_token == '*')
      {
        sprintf(temp, "*%s", out);
        strcpy(out, temp);
      }
      else if (next_token == NAME)
      {
        sprintf(temp, "%s %s", token, out);
        strcpy(out, temp);
      }
      else
      {
        printf("Syntax Error: Invalid input at %s.\n", token);
      }
    }
    puts(out);
  }

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movl $0x0, -0x4(%rbp)
callq 0x1380
cmpl $-0x1, %eax
je 0x1371
leaq 0x2ea9(%rip), %rdi      # 0x4080
leaq 0x3292(%rip), %rsi      # 0x4470
callq 0x1030
callq 0x1380
cmpl $0xa, %eax
je 0x1360
cmpl $0x1, 0x32dc(%rip)      # 0x44d4
jne 0x124d
movsbl 0x2e7f(%rip), %eax      # 0x4080
cmpl $0x2a, %eax
jne 0x1235
leaq -0x450(%rbp), %rdi
leaq 0xdf0(%rip), %rsi       # 0x2004
leaq 0x2e65(%rip), %rdx      # 0x4080
movb $0x0, %al
callq 0x1080
leaq -0x450(%rbp), %rsi
leaq 0x2e50(%rip), %rdi      # 0x4080
callq 0x1030
leaq 0x2e44(%rip), %rdi      # 0x4080
leaq 0x322d(%rip), %rsi      # 0x4470
callq 0x1070
jmp 0x135b
cmpl $0x2, 0x3280(%rip)      # 0x44d4
jne 0x12c5
movsbl 0x2e23(%rip), %eax      # 0x4080
cmpl $0x2a, %eax
jne 0x1291
leaq -0x450(%rbp), %rdi
leaq 0xd94(%rip), %rsi       # 0x2004
leaq 0x2e09(%rip), %rdx      # 0x4080
movb $0x0, %al
callq 0x1080
leaq -0x450(%rbp), %rsi
leaq 0x2df4(%rip), %rdi      # 0x4080
callq 0x1030
leaq -0x450(%rbp), %rdi
leaq 0xd6a(%rip), %rsi       # 0x2009
leaq 0x31ca(%rip), %rdx      # 0x4470
movb $0x0, %al
callq 0x1080
leaq -0x450(%rbp), %rsi
leaq 0x2dc5(%rip), %rdi      # 0x4080
callq 0x1070
jmp 0x1359
cmpl $0x2a, 0x3208(%rip)     # 0x44d4
jne 0x12ff
leaq -0x450(%rbp), %rdi
leaq 0xd32(%rip), %rsi       # 0x200e
leaq 0x2d9d(%rip), %rdx      # 0x4080
movb $0x0, %al
callq 0x1080
leaq -0x450(%rbp), %rsi
leaq 0x2d88(%rip), %rdi      # 0x4080
callq 0x1030
jmp 0x1357
cmpl $0x0, 0x31ce(%rip)      # 0x44d4
jne 0x1340
leaq -0x450(%rbp), %rdi
leaq 0xcfc(%rip), %rsi       # 0x2012
leaq 0x3153(%rip), %rdx      # 0x4470
leaq 0x2d5c(%rip), %rcx      # 0x4080
movb $0x0, %al
callq 0x1080
leaq -0x450(%rbp), %rsi
leaq 0x2d47(%rip), %rdi      # 0x4080
callq 0x1030
jmp 0x1355
leaq 0xcd1(%rip), %rdi       # 0x2018
leaq 0x3122(%rip), %rsi      # 0x4470
movb $0x0, %al
callq 0x1050
jmp 0x1357
jmp 0x1359
jmp 0x135b
jmp 0x11e3
leaq 0x2d19(%rip), %rdi      # 0x4080
callq 0x1040
jmp 0x11c2
xorl %eax, %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopl (%rax)