// File: /workspace/github_c_makefile_star2_O0/ShinyaKato[P]skcc/preprocess.c
// Function: define_directive
void define_directive(struct preprocessor *pp) {
  struct macro_entry *macro = allocate_macro_entry();

  macro->identifier = expect_pp_token(pp, PP_IDENT)->text->head;

  if(check_pp_token(pp, PP_SPACE) || check_pp_token(pp, PP_NEW_LINE)) {
    macro->type = MACRO_OBJECT;
    remove_white_space(pp);
  } else if(check_pp_token(pp, PP_LPAREN)) {
    macro->type = MACRO_FUNCTION;
    macro->parameter_size = 0;

    skip_pp_token_with_space(pp);

    if(check_pp_token(pp, PP_RPAREN)) {
      macro->parameter_ellipsis = 0;
      skip_pp_token_with_space(pp);
    } else {
      while(1) {
        if(check_pp_token(pp, PP_IDENT)) {
          if(macro->parameter_size == MACRO_PARAMS_LIMIT) {
            error("too many macro parameters.\n");
          }

          struct pp_token *token = read_pp_token_with_space(pp);
          macro->parameters[macro->parameter_size++] = token->text;

          if(check_pp_token(pp, PP_COMMA)) {
            skip_pp_token_with_space(pp);
          } else if(check_pp_token(pp, PP_RPAREN)) {
            macro->parameter_ellipsis = 0;
            skip_pp_token_with_space(pp);
            break;
          } else {
            unexpected_pp_token(pp);
          }
        } else if(check_pp_token(pp, PP_ELLIPSIS)) {
          skip_pp_token_with_space(pp);

          struct string *va_args = allocate_string();
          write_string(va_args, "__VA_ARGS__");
          macro->parameters[macro->parameter_size] = va_args;
          macro->parameter_ellipsis = 1;

          if(check_pp_token(pp, PP_RPAREN)) {
            skip_pp_token_with_space(pp);
            break;
          } else {
            unexpected_pp_token(pp);
          }
        }
        else {
          unexpected_pp_token(pp);
        }
      }
    }
  } else {
    unexpected_pp_token(pp);
  }

  while(!check_pp_token(pp, PP_NEW_LINE)) {
    struct pp_token *token = read_pp_token(pp);
    append_pp_list(macro->replacement_list, token);
  }

  discard_new_line(pp);

  if(macro->type == MACRO_FUNCTION && !check_stringify_operator(macro)) {
    error("invalid # operator.\n");
  }
  if(!check_concat_operator(macro)) {
    error("invalid ## operator.\n");
  }

  insert_macro_table(macro);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
callq 0x5510
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x6ee0
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movl $0x3c, %esi
callq 0x6df0
cmpl $0x0, %eax
jne 0x8cf8
movq -0x8(%rbp), %rdi
movl $0x3b, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8d10
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6eb0
jmp 0x8fa3
movq -0x8(%rbp), %rdi
movl $0x7, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8f66
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x6fa0
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8d71
movq -0x10(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x6fa0
jmp 0x8f64
jmp 0x8d73
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8e6a
movq -0x10(%rbp), %rax
cmpl $0x7f, 0x10(%rax)
jne 0x8dae
leaq 0x1c24(%rip), %rdi      # 0xa9bf
movl $0x44e, %esi            # imm = 0x44E
leaq 0x1da6(%rip), %rdx      # 0xab4d
movb $0x0, %al
callq 0x1280
movq -0x8(%rbp), %rdi
callq 0x6f70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rsi
movl 0x10(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x10(%rsi)
movslq %ecx, %rcx
movq %rdx, 0x18(%rax,%rcx,8)
movq -0x8(%rbp), %rdi
movl $0xd, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8dfc
movq -0x8(%rbp), %rdi
callq 0x6fa0
jmp 0x8e65
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8e28
movq -0x10(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x6fa0
jmp 0x8f62
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
leaq 0x126e(%rip), %rcx      # 0xa0b0
shlq $0x5, %rax
addq %rax, %rcx
leaq 0x1b6f(%rip), %rdi      # 0xa9bf
movl $0x45b, %esi            # imm = 0x45B
leaq 0x1d0d(%rip), %rdx      # 0xab69
movb $0x0, %al
callq 0x1280
jmp 0x8e65
jmp 0x8f5d
movq -0x8(%rbp), %rdi
movl $0xc, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8f20
movq -0x8(%rbp), %rdi
callq 0x6fa0
movb $0x0, %al
callq 0x2060
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x1ced(%rip), %rsi      # 0xab8d
callq 0x21a0
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x10(%rcx), %rcx
movq %rdx, 0x18(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl $0x1, 0x14(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x6df0
cmpl $0x0, %eax
je 0x8ee3
movq -0x8(%rbp), %rdi
callq 0x6fa0
jmp 0x8f62
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
leaq 0x11b3(%rip), %rcx      # 0xa0b0
shlq $0x5, %rax
addq %rax, %rcx
leaq 0x1ab4(%rip), %rdi      # 0xa9bf
movl $0x469, %esi            # imm = 0x469
leaq 0x1c52(%rip), %rdx      # 0xab69
movb $0x0, %al
callq 0x1280
jmp 0x8f5b
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
leaq 0x1176(%rip), %rcx      # 0xa0b0
shlq $0x5, %rax
addq %rax, %rcx
leaq 0x1a77(%rip), %rdi      # 0xa9bf
movl $0x46d, %esi            # imm = 0x46D
leaq 0x1c15(%rip), %rdx      # 0xab69
movb $0x0, %al
callq 0x1280
jmp 0x8f5d
jmp 0x8d73
jmp 0x8f64
jmp 0x8fa1
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
leaq 0x1130(%rip), %rcx      # 0xa0b0
shlq $0x5, %rax
addq %rax, %rcx
leaq 0x1a31(%rip), %rdi      # 0xa9bf
movl $0x472, %esi            # imm = 0x472
leaq 0x1bcf(%rip), %rdx      # 0xab69
movb $0x0, %al
callq 0x1280
jmp 0x8fa3
jmp 0x8fa5
movq -0x8(%rbp), %rdi
movl $0x3b, %esi
callq 0x6df0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x8fc1
jmp 0x8fe4
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x418(%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x5460
jmp 0x8fa5
movq -0x8(%rbp), %rdi
callq 0x6f40
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x901e
movq -0x10(%rbp), %rdi
callq 0x8b60
cmpl $0x0, %eax
jne 0x901e
leaq 0x19b4(%rip), %rdi      # 0xa9bf
movl $0x47d, %esi            # imm = 0x47D
leaq 0x1b82(%rip), %rdx      # 0xab99
movb $0x0, %al
callq 0x1280
movq -0x10(%rbp), %rdi
callq 0x8c20
cmpl $0x0, %eax
jne 0x9046
leaq 0x198c(%rip), %rdi      # 0xa9bf
movl $0x480, %esi            # imm = 0x480
leaq 0x1b6f(%rip), %rdx      # 0xabae
movb $0x0, %al
callq 0x1280
movq -0x10(%rbp), %rdi
callq 0x5790
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)