// File: /workspace/github_c_makefile_star2_O0/ShinyaKato[P]skcc/preprocess.c
// Function: concat_macro_token
struct pp_list *concat_macro_token(struct pp_list *list) {
  struct pp_list *result = allocate_pp_list();

  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    struct pp_node *left = node;
    struct pp_node *middle = left->next;
    if(middle != NULL && middle->token->type == PP_SPACE) {
      middle = middle->next;
    }
    struct pp_node *right = middle != NULL ? middle->next : NULL;
    if(right != NULL && right->token->type == PP_SPACE) {
      right = right->next;
    }

    if(middle != NULL && right != NULL && middle->token->type == PP_CONCAT && !middle->token->concat) {
      struct pp_token *l = left->token;
      struct pp_token *r = right->token;

      struct string *str = allocate_string();
      concat_string(str, l->text);
      concat_string(str, r->text);

      struct pp_token_lexer lexer;
      lexer.queue = (struct utf8c *) malloc(sizeof(struct utf8c) * (str->size + 1));
      lexer.queue_head = 0;
      lexer.queue_size = 0;
      lexer.queue_allocate_size = str->size + 1;
      lexer.context = CTX_NORMAL;

      for(int i = 0; i < str->size;) {
        struct utf8c uc;
        uc.bytes = count_bytes(str->head[i]);
        for(int j = 0; j < uc.bytes; j++) {
          uc.sequence[j] = str->head[i++];
        }
        uc.sequence[uc.bytes] = '\0';
        lexer.queue[lexer.queue_size++] = uc;
      }
      lexer.queue[lexer.queue_size++] = ueof;

      struct pp_token *new_token = next_pp_token(&lexer);
      new_token->concat = 1;
      if(lexer.queue_size > 1) {
        error("invalid token concatnation: %s ## %s\n", l->text->head, r->text->head);
      }
      append_pp_list(result, new_token);

      node = right;
    } else {
      append_pp_list(result, node->token);
    }
  }

  // remove place marker
  for(struct pp_node **node = &(result->head); *node != NULL;) {
    if((*node)->token->type == PP_PLACE_MARKER) {
      *node = (*node)->next;
    } else {
      node = &((*node)->next);
    }
  }

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
callq 0x53b0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6cd2
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6a41
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x3c, (%rax)
jne 0x6a41
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6a59
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
jmp 0x6a64
xorl %eax, %eax
movq %rax, -0xb8(%rbp)
jmp 0x6a64
movq -0xb8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x6a8e
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpl $0x3c, (%rax)
jne 0x6a8e
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6caf
cmpq $0x0, -0x30(%rbp)
je 0x6caf
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x3a, (%rax)
jne 0x6caf
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x18(%rax)
jne 0x6caf
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movb $0x0, %al
callq 0x2060
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x21f0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x21f0
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
cltq
imulq $0xc, %rax, %rdi
callq 0x10a0
movq %rax, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl $0x3, -0x4c(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x6c12
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x8c(%rbp), %rcx
movzbl (%rax,%rcx), %edi
callq 0x1470
movl %eax, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x6bd2
movq -0x48(%rbp), %rax
movq (%rax), %rax
movl -0x8c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x8c(%rbp)
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movslq -0x9c(%rbp), %rax
movb %cl, -0x94(%rbp,%rax)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x6b87
movslq -0x98(%rbp), %rax
movb $0x0, -0x94(%rbp,%rax)
movq -0x60(%rbp), %rax
movl -0x54(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x54(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movl -0x90(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0x6b4d
movq -0x60(%rbp), %rax
movl -0x54(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x54(%rbp)
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
leaq 0x7456(%rip), %rcx      # 0xe088
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
leaq -0x88(%rbp), %rdi
callq 0x3110
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movl $0x1, 0x18(%rax)
cmpl $0x1, -0x54(%rbp)
jle 0x6c95
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %r8
leaq 0x3d3d(%rip), %rdi      # 0xa9bf
movl $0x153, %esi            # imm = 0x153
leaq 0x3d9d(%rip), %rdx      # 0xaa2b
movb $0x0, %al
callq 0x1280
movq -0x10(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x5460
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x6cbf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x5460
jmp 0x6cc1
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x6a03
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6d2d
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
cmpl $0x3f, (%rax)
jne 0x6d16
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, (%rax)
jmp 0x6d2b
movq -0xb0(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
jmp 0x6cdd
movq -0x10(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)