// File: /workspace/github_c_makefile_star2_O1/ShinyaKato[P]skcc/preprocess.c
// Function: if_control
int if_control(struct preprocessor *pp) {
  struct pp_list *list = allocate_pp_list();
  while(!check_pp_token(pp, PP_NEW_LINE)) {
    struct pp_token *token = read_pp_token(pp);
    append_pp_list(list, token);
  }
  discard_new_line(pp);

  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    if(node->token->type == PP_IDENT && strcmp(node->token->text->head, "defined") == 0) {
      struct pp_node *ident = check_defined_operator(&node);
      ident->skip = 1;
    }
  }

  list = scan_macro(pp, list);

  struct pp_token *zero = allocate_pp_token();
  zero->type = PP_NUM;
  zero->name = pp_token_name[PP_NUM];
  append_string(zero->text, '0');

  struct pp_token *one = allocate_pp_token();
  one->type = PP_NUM;
  one->name = pp_token_name[PP_NUM];
  append_string(one->text, '1');

  struct pp_list *replaced = allocate_pp_list();
  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    if(node->token->type == PP_IDENT && strcmp(node->token->text->head, "defined") == 0) {
      struct pp_node *ident = check_defined_operator(&node);
      struct macro_entry *macro = search_macro_table(ident->token->text->head);
      append_pp_list(replaced, macro == NULL ? zero : one);
    } else {
      append_pp_list(replaced, node->token->type != PP_IDENT ? node->token : zero);
    }
  }

  for(struct pp_node **node = &(replaced->head); *node != NULL;) {
    if((*node)->token->type == PP_SPACE || (*node)->token->type == PP_SPACE) {
      *node = (*node)->next;
    } else {
       node = &((*node)->next);
    }
  }

  return conditional_expression(&(replaced->head));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3ad0
movq %rax, %r14
movq %rbx, %rdi
movl $0x3b, %esi
callq 0x4d19
movq %rbx, %rdi
testl %eax, %eax
jne 0x55b2
callq 0x4ce7
movq %rax, %r15
movl $0x18, %edi
callq 0x10b0
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
movq $0x0, 0x8(%rax)
movl $0x0, 0x10(%rax)
movq 0x8(%r14), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%r14)
jmp 0x5569
movl $0x3b, %esi
callq 0x4dda
movq %rax, %rdi
callq 0x1e5a
movq (%r14), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x5615
leaq 0x294b(%rip), %r15      # 0x7f22
movq %rsp, %r12
movq (%rax), %rax
cmpl $0x1, (%rax)
jne 0x5604
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq %r15, %rsi
callq 0x1080
testl %eax, %eax
jne 0x5604
movq %r12, %rdi
callq 0x5473
movl $0x1, 0x10(%rax)
movq (%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
testq %rax, %rax
jne 0x55da
movq %rbx, %rdi
movq %r14, %rsi
callq 0x402b
movq %rax, %r12
xorl %eax, %eax
callq 0x1e32
movq %rax, %r14
movl $0x2, %ebx
movl %ebx, (%rax)
leaq 0x1da5(%rip), %r13      # 0x73e0
addq $0x40, %r13
movq %r13, 0x8(%rax)
movq 0x10(%rax), %rdi
movl $0x30, %esi
callq 0x1a19
xorl %eax, %eax
callq 0x1e32
movq %rax, %r15
movl %ebx, (%rax)
movq %r13, 0x8(%rax)
movq 0x10(%rax), %rdi
movl $0x31, %esi
callq 0x1a19
callq 0x3ad0
movq %rax, %rbx
movq (%r12), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x570e
leaq 0x2893(%rip), %r12      # 0x7f22
movq %rsp, %r13
movq (%rax), %rbp
cmpl $0x1, (%rbp)
jne 0x56d2
movq 0x10(%rbp), %rax
movq (%rax), %rdi
movq %r12, %rsi
callq 0x1080
movq %r14, %rbp
testl %eax, %eax
jne 0x56d2
movq %r13, %rdi
callq 0x5473
movq (%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
callq 0x3ede
testq %rax, %rax
movq %r15, %rbp
cmoveq %r14, %rbp
movl $0x18, %edi
callq 0x10b0
movq %rbp, (%rax)
leaq 0x8(%rax), %rcx
movq $0x0, 0x8(%rax)
movl $0x0, 0x10(%rax)
movq 0x8(%rbx), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%rbx)
movq (%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rsp)
testq %rax, %rax
jne 0x5692
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x5738
movq %rbx, %rax
movq (%rcx), %rdx
addq $0x8, %rcx
cmpl $0x3c, (%rdx)
jne 0x572d
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x5730
movq %rcx, %rax
movq (%rax), %rcx
testq %rcx, %rcx
jne 0x5719
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5064