// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
callq 0x53b0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3b, %esi
callq 0x6df0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x7d64
jmp 0x7d80
movq -0x8(%rbp), %rdi
callq 0x6d90
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5460
jmp 0x7d48
movq -0x8(%rbp), %rdi
callq 0x6f40
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7dee
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, (%rax)
jne 0x7dde
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
leaq 0x2cf5(%rip), %rsi      # 0xaab1
callq 0x1070
cmpl $0x0, %eax
jne 0x7dde
leaq -0x20(%rbp), %rdi
callq 0x7bc0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0x7de0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x7d94
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5c00
movq %rax, -0x10(%rbp)
movb $0x0, %al
callq 0x2800
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl $0x2, (%rax)
movq -0x30(%rbp), %rax
leaq 0x2291(%rip), %rcx      # 0xa0b0
addq $0x40, %rcx
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x30, %esi
callq 0x20c0
movb $0x0, %al
callq 0x2800
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl $0x2, (%rax)
movq -0x38(%rbp), %rax
leaq 0x2257(%rip), %rcx      # 0xa0b0
addq $0x40, %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x31, %esi
callq 0x20c0
callq 0x53b0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x7f5a
movq -0x48(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, (%rax)
jne 0x7f11
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
leaq 0x2bfe(%rip), %rsi      # 0xaab1
callq 0x1070
cmpl $0x0, %eax
jne 0x7f11
leaq -0x48(%rbp), %rdi
callq 0x7bc0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
callq 0x59c0
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x7efa
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x7f02
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x5460
jmp 0x7f47
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, (%rax)
je 0x7f32
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x7f3a
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x5460
jmp 0x7f49
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x7e87
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
je 0x7faf
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
cmpl $0x3c, (%rax)
je 0x7f8a
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
cmpl $0x3c, (%rax)
jne 0x7f9e
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
jmp 0x7fad
movq -0x60(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
jmp 0x7f62
movq -0x40(%rbp), %rdi
callq 0x7320
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)