LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/regalloc.c
// Function: alloc_regs
void alloc_regs(IProgram* prog) {
  for (int i = 0; i < prog->ifuncs->length; i++) {
    IFunc* func = prog->ifuncs->ptr[i];
    if (func->blocks) {
      Vector* regs = collect_regs(func);
      scan(regs);

      for (int i = 0; i < regs->length; i++) {
        eprintf("%s ", show_ireg(regs->ptr[i]));
      }
      eprintf("\n");
    } 

    // TODO: Reserve stack area to spilled register

    // TODO: Convert accesses to spilled registers to load and stores
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
xorl %ecx, %ecx
movq 0x8(%rsp), %rax
movq (%rax), %rax
cmpq %rcx, 0x10(%rax)
jbe 0x98aa
movq (%rax), %rax
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rax)
je 0x98a2
movq %rcx, 0x10(%rsp)
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x229c
movq %rax, %r12
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
cmpq %r14, 0x10(%rax)
jbe 0x985b
movq (%rax), %rax
movq %r14, 0x20(%rsp)
movq (%rax,%r14,8), %rbp
xorl %eax, %eax
callq 0x229c
movq %rax, %r13
xorl %r14d, %r14d
movq 0x8(%rbp), %rax
cmpq 0x10(%rax), %r14
jae 0x9798
movq (%rax), %rax
movq (%rax,%r14,8), %r15
cmpq $0x0, 0x10(%r15)
je 0x9788
cmpq $0x0, 0x18(%r15)
je 0x9788
cmpq $0x0, 0x20(%r15)
je 0x9788
pushq $0x16
popq %rdi
callq 0x6c44
movups 0x10(%r15), %xmm0
movups %xmm0, 0x10(%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x22c6
movq 0x10(%r15), %rax
movq %rax, 0x18(%r15)
movq %r13, %rdi
movq %r15, %rsi
callq 0x22c6
incq %r14
jmp 0x973e
movq %r13, 0x8(%rbp)
xorl %r15d, %r15d
movq 0x20(%rsp), %r14
cmpq %r15, 0x10(%r13)
jbe 0x9853
movq (%r13), %rax
movq (%rax,%r15,8), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x97c8
cmpl $0x0, 0x10(%rsi)
jne 0x97c8
movl %ebx, 0x10(%rsi)
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x97d9
cmpl %ebx, 0x14(%rcx)
jge 0x97d9
movl %ebx, 0x14(%rcx)
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x97ea
cmpl %ebx, 0x14(%rcx)
jge 0x97ea
movl %ebx, 0x14(%rcx)
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x9817
movq 0x10(%rax), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x9817
movq (%rax), %rdi
movq (%rdi,%rdx,8), %rdi
testq %rdi, %rdi
je 0x9812
cmpl %ebx, 0x14(%rdi)
jge 0x9812
movl %ebx, 0x14(%rdi)
incq %rdx
jmp 0x97f9
testq %rsi, %rsi
je 0x9849
movq 0x10(%r12), %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x983d
movq (%r12), %rdx
movq (%rdx,%rcx,8), %rdx
movl 0x4(%rsi), %edi
incq %rcx
cmpl 0x4(%rdx), %edi
jne 0x9823
jmp 0x9849
movq %r12, %rdi
callq 0x22c6
movq 0x8(%rbp), %r13
incq %r15
incl %ebx
jmp 0x97a4
incq %r14
jmp 0x9712
movq %r12, %rdi
callq 0x9604
xorl %ebx, %ebx
cmpq %rbx, 0x10(%r12)
jbe 0x988f
movq (%r12), %rax
movq (%rax,%rbx,8), %rdi
callq 0x6cbf
leaq 0x3b0b(%rip), %rdi      # 0xd38b
movq %rax, %rsi
xorl %eax, %eax
callq 0xa9a6
incq %rbx
jmp 0x9865
leaq 0x3c2a(%rip), %rdi      # 0xd4c0
xorl %eax, %eax
callq 0xa9a6
movq 0x10(%rsp), %rcx
incq %rcx
jmp 0x96d5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/sema.c
// Function: sema
void sema(Program* prog) {
  for (GVar* gvar = prog->globals; gvar != NULL; gvar = gvar->next) {
    walk(gvar->init);
    if (gvar->inits != NULL) {
      for (size_t i = 0; i < gvar->inits->length; i++) {
        walk(gvar->inits->ptr[i]);
      }
    }
  }

  funcs = prog->funcs;
  switches = new_vec();
  for (size_t i = 0; i < prog->funcs->length; i++) {
    Function* fn = prog->funcs->ptr[i];
    if (fn->body)
      walk(fn->body);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x9900
movq 0x18(%r14), %rdi
callq 0x9944
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x98c8
xorl %r15d, %r15d
cmpq 0x10(%rax), %r15
jae 0x98c8
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
callq 0x9944
incq %r15
movq 0x20(%r14), %rax
jmp 0x98e5
movq (%rbx), %rax
movq %rax, 0x888e(%rip)      # 0x12198
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x229c
movq %rax, 0x8885(%rip)      # 0x121a0
movq (%rbx), %rax
cmpq 0x10(%rax), %r14
jae 0x993e
movq (%rax), %rax
movq (%rax,%r14,8), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x9939
callq 0x9944
incq %r14
jmp 0x991b
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/sema.c
// Function: rewrite_arith_node
static void rewrite_arith_node(Node* node) {
  /* ポインタ演算を通常の整数演算に置き換える */
  if (type_of(node->lhs)->ty == TY_PTR && type_of(node->rhs)->ty != TY_PTR) {
    Node* rhs = node->rhs;
    Node* new = new_node(NMUL, rhs->token);
    new->lhs = rhs;
    new->rhs = new_node(NINT, rhs->token);
    new->rhs->integer = size_of(type_of(node->lhs)->ptr_to);
    new->rhs->type = ptr_to(type_of(node->lhs)->ptr_to);
    new->type = new->rhs->type;
    node->rhs = new;
  } else if (type_of(node->rhs)->ty == TY_PTR && type_of(node->lhs)->ty != TY_PTR) {
    Node* lhs = node->lhs;
    Node* new = new_node(NMUL, lhs->token);
    new->lhs = lhs;
    new->rhs = new_node(NINT, lhs->token);
    new->rhs->integer = size_of(type_of(node->rhs)->ptr_to);
    new->rhs->type = ptr_to(type_of(node->lhs)->ptr_to);
    new->type = new->rhs->type;
    node->lhs = new;
  }

  Type* type = arith_conv(type_of(node->lhs), type_of(node->rhs));

  node->type = type;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x76db
cmpl $0x4, (%rax)
jne 0x9e8d
movq 0x20(%rbx), %rdi
callq 0x76db
cmpl $0x4, (%rax)
jne 0x9f1a
movq 0x20(%rbx), %rdi
callq 0x76db
cmpl $0x4, (%rax)
movq 0x18(%rbx), %r15
jne 0x9f7f
movq %r15, %rdi
callq 0x76db
cmpl $0x4, (%rax)
movq 0x18(%rbx), %r15
je 0x9f7f
movq 0x8(%r15), %rsi
pushq $0x5
popq %rdi
callq 0x75dc
movq %rax, %r14
movq %r15, 0x18(%rax)
movq 0x8(%r15), %rsi
xorl %edi, %edi
callq 0x75dc
movq %rax, 0x20(%r14)
movq 0x20(%rbx), %rdi
callq 0x76db
movq 0x18(%rax), %rdi
callq 0x75fe
movq 0x20(%r14), %rcx
movl %eax, 0x28(%rcx)
movq 0x18(%rbx), %rdi
callq 0x76db
movq 0x18(%rax), %rdi
callq 0x76a2
movq 0x20(%r14), %rcx
movq %rax, 0x10(%rcx)
movq %rax, 0x10(%r14)
movq %r14, 0x18(%rbx)
movq %r14, %r15
jmp 0x9f7f
movq 0x20(%rbx), %r15
movq 0x8(%r15), %rsi
pushq $0x5
popq %rdi
callq 0x75dc
movq %rax, %r14
movq %r15, 0x18(%rax)
movq 0x8(%r15), %rsi
xorl %edi, %edi
callq 0x75dc
movq %rax, 0x20(%r14)
movq 0x18(%rbx), %rdi
callq 0x76db
movq 0x18(%rax), %rdi
callq 0x75fe
movq 0x20(%r14), %rcx
movl %eax, 0x28(%rcx)
movq 0x18(%rbx), %rdi
callq 0x76db
movq 0x18(%rax), %rdi
callq 0x76a2
movq 0x20(%r14), %rcx
movq %rax, 0x10(%rcx)
movq %rax, 0x10(%r14)
movq %r14, 0x20(%rbx)
movq 0x18(%rbx), %r15
movq %r15, %rdi
callq 0x76db
movq %rax, %r14
movq 0x20(%rbx), %rdi
callq 0x76db
movq %r14, %rdi
movq %rax, %rsi
callq 0x9fa8
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/sema.c
// Function: arith_conv
static Type* arith_conv(Type* t1, Type* t2) {
  Type* type = NULL;

  if (t1->ty == TY_STRUCT || t2->ty == TY_STRUCT) {
    error("error(arith_conv):");
    dump_type(t1);
    eprintf("\n");
    dump_type(t2);
    eprintf("\n");
  }

  /* 左辺と右辺のサイズが大きい方の型をnodeに割り当てる */
  if (size_of(t1) >= size_of(t2)) {
    type = t1;
  } else {
    type = t2;
  }

  if (type->array_size != 0) {
    /* 配列型になった場合はポインタ型に変換する */
    type = clone_type(type);
    type->array_size = 0;
  }

  return type;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x5, (%rdi)
je 0x9ff4
movq %rsi, %r14
cmpl $0x5, (%rsi)
je 0x9ff4
movq %rdi, %rbx
callq 0x75fe
movq %rax, %r15
movq %r14, %rdi
callq 0x75fe
cmpq %rax, %r15
cmovbq %r14, %rbx
cmpq $0x0, 0x20(%rbx)
je 0x9feb
movq %rbx, %rdi
callq 0x7627
movq %rax, %rbx
andq $0x0, 0x20(%rax)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x3446(%rip), %rdi      # 0xd441
xorl %eax, %eax
callq 0xa90e
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/token.c
// Function: print_line
static void print_line(char* start, char* pos) {
  size_t line = 0;
  size_t column = 0;
  /* char* start = src; // 出力する行の先頭文字 */

  for (char *c = start; c != pos && *c != '\0'; c++) {
    if (*c == '\n') {
      start = c + 1;
      line++;
      column = 0;
    } else {
      column++;
    }
  }

  eprintf("error at (%d, %d)\n\n", line + 1, column + 1);

  // 行を出力
  size_t len = strchr(start, '\n') - start;
  eprintf("%.*s\n", len, start);

  // posまでインデントする
  for (size_t i = 0; i < column; i++) {
    if (start[i] == '\t') {
      eprintf("\t");
    } else {
      eprintf(" ");
    }
  }

  eprintf("^\n\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rax
xorl %esi, %esi
xorl %r14d, %r14d
movq %rdi, %rbx
cmpq %rax, %rdi
je 0xa0a7
movzbl (%rdi), %ecx
cmpl $0xa, %ecx
je 0xa098
testl %ecx, %ecx
je 0xa0a7
incq %r14
jmp 0xa0a2
leaq 0x1(%rdi), %rbx
incq %rsi
xorl %r14d, %r14d
incq %rdi
jmp 0xa082
incq %rsi
leaq 0x1(%r14), %rdx
leaq 0x33f9(%rip), %rdi      # 0xd4ae
xorl %eax, %eax
callq 0xa9a6
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x2090
subq %rbx, %rax
leaq 0x33f1(%rip), %rdi      # 0xd4c2
movq %rax, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xa9a6
leaq 0x33e3(%rip), %r15      # 0xd4c8
leaq 0x2161(%rip), %r12      # 0xc24d
xorl %r13d, %r13d
cmpq %r13, %r14
je 0xa10d
cmpb $0x9, (%rbx,%r13)
movq %r15, %rdi
je 0xa101
movq %r12, %rdi
xorl %eax, %eax
callq 0xa9a6
incq %r13
jmp 0xa0ef
leaq 0x33b6(%rip), %rdi      # 0xd4ca
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xa9a6
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/token.c
// Function: lex
Token* lex(char* path) {
  FILE* file = fopen(path, "r");
  if (file == NULL) {
    error("cannot open file: %s\n", path);
  }

  src = read_file(file);
  fclose(file);
  cur = src;

  Token* current = next_token();
  Token* head = current;

  while ((current->next = next_token()) != NULL) {
    current = current->next;
  }

  return head;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x30c6(%rip), %rsi      # 0xd206
callq 0x2150
testq %rax, %rax
je 0xa1b9
movq %rax, %rbx
callq 0xaa4f
movq %rax, %r14
movq %rbx, %rdi
callq 0x20d0
cmpb $-0x1, %al
je 0xa16e
movsbl %al, %esi
movq %r14, %rdi
callq 0xaa85
jmp 0xa155
movq %r14, %rdi
callq 0xaaf4
movq %rax, 0x8033(%rip)      # 0x121b0
movq %rbx, %rdi
callq 0x2070
movq 0x8024(%rip), %rax      # 0x121b0
movq %rax, 0x8025(%rip)      # 0x121b8
callq 0xa1ca
movq %rax, %rbx
movq %rax, %r14
callq 0xa1ca
movq %rax, (%r14)
movq %rax, %r14
testq %rax, %rax
jne 0xa19e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x32d8(%rip), %rdi      # 0xd498
movq %r14, %rsi
xorl %eax, %eax
callq 0xa90e
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/token.c
// Function: start_with
static bool start_with(char* s1, char* s2) {
  while (*s1 != '\0' && *s2 != '\0') {
    if (*s1 == *s2) {
      s1++;
      s2++;
    } else {
      return false;
    }
  }
  return true;
}

// Assembly:
xorl %ecx, %ecx
movb (%rdi,%rcx), %dl
movb $0x1, %al
testb %dl, %dl
je 0xa6ef
movb (%rsi,%rcx), %r8b
testb %r8b, %r8b
je 0xa6ef
cmpb %r8b, %dl
jne 0xa6ed
incq %rcx
jmp 0xa6d1
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/token.c
// Function: new_token
static Token* new_token(enum TokenTag tag, char* start) {
  Token* t = calloc(1, sizeof(Token));
  t->tag = tag;
  t->source = src;
  t->start = start;
  t->bol = bol;
  return t;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x20f0
movl %ebp, 0x8(%rax)
movq 0x7aa3(%rip), %rcx      # 0x121b0
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movb 0x7aa5(%rip), %cl       # 0x121c0
xorb $0x1, %cl
movb %cl, 0x30(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/token.c
// Function: read_char
static char read_char(void) {
  char c;
  if (*cur == '\\') {
    consume();
    switch (*cur) {
    case 'a':
      c = '\a';
      break;
    case 'b':
      c = '\b';
      break;
    case 'f':
      c = '\f';
      break;
    case 'n':
      c = '\n';
      break;
    case 'r':
      c = '\r';
      break;
    case 't':
      c = '\t';
      break;
    case 'v':
      c = '\v';
      break;
    case '\\':
      c = '\\';
      break;
    case '\'':
      c = '\'';
      break;
    case '\"':
      c = '\"';
      break;
    case '0':
      c = '\0';
      break;
    default:
      print_line(src, cur);
      error("invalid escape sequence: %c\n", *cur);
    }
  } else {
    c = *cur;
  }
  consume();
  return c;
}

// Assembly:
pushq %rbx
movq 0x7a73(%rip), %rax      # 0x121b8
movb (%rax), %bl
cmpb $0x5c, %bl
jne 0xa7b6
callq 0xa7e3
movq 0x7a60(%rip), %rsi      # 0x121b8
movb (%rsi), %bl
movzbl %bl, %eax
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
jbe 0xa78c
cmpl $0x22, %eax
je 0xa7b6
cmpl $0x27, %eax
je 0xa7b6
cmpl $0x30, %eax
je 0xa7b0
cmpl $0x5c, %eax
je 0xa7b6
cmpl $0x61, %eax
je 0xa7b4
cmpl $0x66, %eax
je 0xa7ac
cmpl $0x62, %eax
jne 0xa7bf
movb $0x8, %bl
jmp 0xa7b6
leaq 0x2ce1(%rip), %rax      # 0xd474
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movb $0xa, %bl
jmp 0xa7b6
movb $0xb, %bl
jmp 0xa7b6
movb $0xd, %bl
jmp 0xa7b6
movb $0x9, %bl
jmp 0xa7b6
movb $0xc, %bl
jmp 0xa7b6
xorl %ebx, %ebx
jmp 0xa7b6
movb $0x7, %bl
callq 0xa7e3
movl %ebx, %eax
popq %rbx
retq
movq 0x79ea(%rip), %rdi      # 0x121b0
callq 0xa06e
movq 0x79e6(%rip), %rax      # 0x121b8
movsbl (%rax), %esi
leaq 0x2e6b(%rip), %rdi      # 0xd647
xorl %eax, %eax
callq 0xa90e
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: error
void error(const char *fmt, ...) {
#endif
  va_list ap;
  va_start(ap, fmt);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  exit(1);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0xa96c
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rdx
movq %rdi, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x7665(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq %r10, %rsi
callq 0x2170
pushq $0x1
popq %rdi
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: new_sb
StringBuilder* new_sb(void) {
  StringBuilder* sb = calloc(1, sizeof(StringBuilder));
  sb->buf = calloc(8, sizeof(char));
  sb->capacity = 8;
  sb->length = 0;
  return sb;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $0x1
popq %rbx
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x20f0
movq %rax, %r14
pushq $0x8
popq %rdi
movq %rbx, %rsi
callq 0x20f0
movq %rax, (%r14)
movq $0x8, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: sb_putc
void sb_putc(StringBuilder* sb, char c) {
  while (sb->length >= sb->capacity) {
    sb->capacity += 8;
    sb->buf = realloc(sb->buf, sizeof(char) * sb->capacity);
  }
  sb->buf[sb->length] = c;
  sb->length++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rsi, %rax
jb 0xaaaf
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
movq (%rbx), %rdi
callq 0x2140
movq %rax, (%rbx)
jmp 0xaa8d
movq (%rbx), %rcx
movb %bpl, (%rcx,%rax)
incq 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: sb_run
char* sb_run(StringBuilder* sb) {
  sb_putc(sb, '\0');
  char* ret = sb->buf;
  sb_destory(sb);
  return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xaa85
movq (%rbx), %r14
movq %rbx, %rdi
callq 0x2030
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: dump_token
void dump_token(Token* tok) {
  switch (tok->tag) {
  case TINT: {
    eprintf("%d", tok->integer);
    break;
  }
  case TSTRING: {
    eprintf("\"%s\"", tok->str);
    break;
  }
  case TIDENT: {
    eprintf("%s", tok->ident);
    break;
  }
  case TRESERVED: {
    eprintf("_%s_", tok->ident);
    break;
  }
  case TDIRECTIVE: {
    eprintf("#%s", tok->ident);
    break;
  }
  }
  if (tok->next != NULL) {
    eprintf(" ");
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0xaba3
leaq 0x2b16(%rip), %rcx      # 0xd664
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc(%rbx), %esi
leaq 0x1e7c(%rip), %rdi      # 0xc9dd
xorl %eax, %eax
callq 0xa9a6
jmp 0xaba3
movq 0x10(%rbx), %rsi
leaq 0x2bc9(%rip), %rdi      # 0xd73e
jmp 0xab9c
movq 0x10(%rbx), %rsi
leaq 0x24e8(%rip), %rdi      # 0xd06a
jmp 0xab9c
movq 0x10(%rbx), %rsi
leaq 0x2baa(%rip), %rdi      # 0xd739
jmp 0xab9c
movq 0x18(%rbx), %rsi
leaq 0x2b98(%rip), %rdi      # 0xd734
xorl %eax, %eax
callq 0xa9a6
cmpq $0x0, (%rbx)
je 0xabb8
leaq 0x169d(%rip), %rdi      # 0xc24d
xorl %eax, %eax
popq %rbx
jmp 0xa9a6
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: show_type_
static void show_type_(StringBuilder* sb, Type* ty) {
  if (ty == NULL) {
    sb_puts(sb, "NULL");
    return;
  }

  switch (ty->ty) {
  case TY_VOID:
    sb_puts(sb, "void");
    break;
  case TY_CHAR:
    sb_puts(sb, "char");
    break;
  case TY_INT:
    sb_puts(sb, "int");
    break;
  case TY_LONG:
    sb_puts(sb, "long");
    break;
  case TY_PTR:
    if (ty->array_size) {
      sb_puts(sb, "array(");
      show_type_(sb, ty->ptr_to);
      sb_puts(sb, format(", %zu)", ty->array_size));
    } else {
      sb_puts(sb, "ptr(");
      show_type_(sb, ty->ptr_to);
      sb_puts(sb, ")");
    }
    break;
  case TY_STRUCT: {
    if (ty->tag) {
      sb_puts(sb, format("struct %s", ty->tag));
    } else {
      sb_puts(sb, "struct");
    }

    // 以下のコードは無限ループを引き起こす
    /* sb_puts(sb, format("struct %s {", ty->tag)); */
    /* for (Field* f = ty->fields; f != NULL; f = f->next) { */
    /*   sb_puts(sb, format("%s(+%zu) : ", f->name, f->offset)); */
    /*   show_type_(sb, f->type, ty->tag); */
    /*   sb_puts(sb, ","); */
    /* } */
    /* sb_puts(sb, "}"); */
    break;
  }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0xac17
movq %rsi, %r14
movl (%rsi), %eax
cmpq $0x5, %rax
ja 0xac96
leaq 0x2a73(%rip), %rcx      # 0xd678
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x25e9(%rip), %rsi      # 0xd1fe
jmp 0xac1e
leaq 0x2c1e(%rip), %rsi      # 0xd83c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xaac1
cmpq $0x0, 0x20(%r14)
je 0xac9e
leaq 0x2c06(%rip), %rsi      # 0xd841
movq %rbx, %rdi
callq 0xaac1
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0xabe3
movq 0x20(%r14), %rsi
leaq 0x2bee(%rip), %rdi      # 0xd848
jmp 0xac87
leaq 0x25a5(%rip), %rsi      # 0xd208
jmp 0xac1e
leaq 0x25a0(%rip), %rsi      # 0xd20c
jmp 0xac1e
leaq 0x258e(%rip), %rsi      # 0xd203
jmp 0xac1e
movq 0x28(%r14), %rsi
testq %rsi, %rsi
je 0xacc5
leaq 0x2bcd(%rip), %rdi      # 0xd854
xorl %eax, %eax
callq 0xa84a
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xac21
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2baa(%rip), %rsi      # 0xd84f
movq %rbx, %rdi
callq 0xaac1
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0xabe3
leaq 0x2632(%rip), %rsi      # 0xd2f2
jmp 0xac1e
leaq 0x256f(%rip), %rsi      # 0xd23b
jmp 0xac1e
// File: /workspace/github_c_makefile_star2_O2/takoeight0821[P]hoc_nyan/src/utils.c
// Function: dump_function
void dump_function(Function* func) {
  eprintf("%s ", func->name);
  eprintf("(");
  for (size_t i = 0; i < func->params->length; i++) {
    if (i != 0)
      eprintf(", ");
    dump_type(((Node*)func->params->ptr[i])->type);
    eprintf(" %s", ((Node*)func->params->ptr[i])->name);
  }
  eprintf(")\n");

  if (func->body)
    dump_node(func->body, 1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x20fc(%rip), %rdi      # 0xd38b
xorl %eax, %eax
callq 0xa9a6
leaq 0x25b5(%rip), %rdi      # 0xd852
xorl %eax, %eax
callq 0xa9a6
leaq 0x1dbe(%rip), %r14      # 0xd069
leaq 0x2587(%rip), %r15      # 0xd839
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
cmpq 0x10(%rax), %r12
jae 0xb300
testq %r12, %r12
je 0xb2d2
movq %r15, %rdi
xorl %eax, %eax
callq 0xa9a6
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rdi
callq 0xacd1
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
movq 0x40(%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0xa9a6
incq %r12
jmp 0xb2b5
leaq 0x2523(%rip), %rdi      # 0xd82a
xorl %eax, %eax
callq 0xa9a6
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0xb32a
pushq $0x1
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xace2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/smoke.c
// Function: test_syntax
void test_syntax() {
    test_case errors[] = {
        {"", 1},
        {"1+", 2},
        {"1)", 2},
        {"(1", 2},
        {"1**1", 3},
        {"1*2(+4", 4},
        {"1*2(1+4", 4},
        {"a+5", 1},
        {"!+5", 1},
        {"_a+5", 1},
        {"#a+5", 1},
        {"1^^5", 3},
        {"1**5", 3},
        {"sin(cos5", 8},
    };


    int i;
    for (i = 0; i < sizeof(errors) / sizeof(test_case); ++i) {
        const char *expr = errors[i].expr;
        const int e = errors[i].answer;

        int err;
        const double r = te_interp(expr, &err);
        lequal(err, e);
        lok(r != r);

        te_expr *n = te_compile(expr, 0, 0, &err);
        lequal(err, e);
        lok(!n);

        if (err != e) {
            printf("FAILED: %s\n", expr);
        }

        const double k = te_interp(expr, 0);
        lok(k != k);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
pushq $0x8
popq %rbx
leaq 0xc(%rsp), %r13
leaq 0x4fc7(%rip), %r15      # 0x83c3
cmpq $0xe8, %rbx
je 0x3568
leaq 0x8100(%rip), %rax      # 0xb510
movq -0x8(%rbx,%rax), %rbp
cvttsd2si (%rbx,%rax), %r12d
movq %rbp, %rdi
movq %r13, %rsi
callq 0x6cc5
movl 0x8cd0(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8cc8(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
cmpl %r12d, %ecx
je 0x346e
incl 0x8cbd(%rip)            # 0xc100
leaq 0x4fdf(%rip), %rdi      # 0x8429
movq %r15, %rsi
movl $0xc1, %edx
movl %r12d, %r8d
xorl %eax, %eax
movsd %xmm0, 0x10(%rsp)
callq 0x3090
movsd 0x10(%rsp), %xmm0
movl 0x8c8e(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8c86(%rip)      # 0xc0fc
ucomisd %xmm0, %xmm0
jp 0x3498
incl 0x8c7e(%rip)            # 0xc100
leaq 0x4f2c(%rip), %rdi      # 0x83b5
movq %r15, %rsi
movl $0xc2, %edx
xorl %eax, %eax
callq 0x3090
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r13, %r14
movq %r13, %rcx
callq 0x6b26
movq %rax, %r13
movl 0x8c49(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8c41(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
cmpl %r12d, %ecx
je 0x34e9
incl 0x8c36(%rip)            # 0xc100
leaq 0x4f58(%rip), %rdi      # 0x8429
movq %r15, %rsi
movl $0xc5, %edx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x3090
movl 0x8c13(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8c0b(%rip)      # 0xc0fc
testq %r13, %r13
je 0x3512
incl 0x8c04(%rip)            # 0xc100
leaq 0x4eb2(%rip), %rdi      # 0x83b5
movq %r15, %rsi
movl $0xc6, %edx
xorl %eax, %eax
callq 0x3090
cmpl %r12d, 0xc(%rsp)
movq %r14, %r13
je 0x352d
leaq 0x4f18(%rip), %rdi      # 0x843b
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3090
movq %rbp, %rdi
xorl %esi, %esi
callq 0x6cc5
incl 0x8bbf(%rip)            # 0xc0fc
ucomisd %xmm0, %xmm0
jp 0x355f
incl 0x8bb7(%rip)            # 0xc100
leaq 0x4e65(%rip), %rdi      # 0x83b5
movq %r15, %rsi
movl $0xcd, %edx
xorl %eax, %eax
callq 0x3090
addq $0x10, %rbx
jmp 0x33fc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/smoke.c
// Function: test_nans
void test_nans() {

    const char *nans[] = {
        "0/0",
        "1%0",
        "1%(1%0)",
        "(1%0)%1",
        "fac(-1)",
        "ncr(2, 4)",
        "ncr(-2, 4)",
        "ncr(2, -4)",
        "npr(2, 4)",
        "npr(-2, 4)",
        "npr(2, -4)",
    };

    int i;
    for (i = 0; i < sizeof(nans) / sizeof(const char *); ++i) {
        const char *expr = nans[i];

        int err;
        const double r = te_interp(expr, &err);
        lequal(err, 0);
        lok(r != r);

        te_expr *n = te_compile(expr, 0, 0, &err);
        lok(n);
        lequal(err, 0);
        const double c = te_eval(n);
        lok(c != c);
        te_free(n);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xc(%rsp), %rbx
leaq 0x4e24(%rip), %r14      # 0x83b5
leaq 0x4e2b(%rip), %r15      # 0x83c3
leaq 0x4e8a(%rip), %r12      # 0x8429
xorl %ebp, %ebp
cmpq $0x58, %rbp
je 0x36d6
leaq 0x803e(%rip), %rax      # 0xb5f0
movq (%rbp,%rax), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6cc5
movl 0x8b34(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8b2c(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x3605
incl 0x8b22(%rip)            # 0xc100
movq %r12, %rdi
movq %r15, %rsi
movl $0xe8, %edx
xorl %r8d, %r8d
xorl %eax, %eax
movsd %xmm0, 0x10(%rsp)
callq 0x3090
movsd 0x10(%rsp), %xmm0
movl 0x8af7(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8aef(%rip)      # 0xc0fc
ucomisd %xmm0, %xmm0
jp 0x362b
incl 0x8ae7(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0xe9, %edx
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x6b26
movq %rax, %r13
movl 0x8ab9(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8ab1(%rip)      # 0xc0fc
testq %r13, %r13
jne 0x366e
incl 0x8aaa(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0xec, %edx
xorl %eax, %eax
callq 0x3090
movl 0x8a8e(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8a86(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x3699
incl 0x8a7c(%rip)            # 0xc100
movq %r12, %rdi
movq %r15, %rsi
movl $0xed, %edx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
callq 0x652d
incl 0x8a55(%rip)            # 0xc0fc
ucomisd %xmm0, %xmm0
jp 0x36c5
incl 0x8a4d(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0xef, %edx
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
callq 0x6224
addq $0x8, %rbp
jmp 0x35a1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/smoke.c
// Function: test_infs
void test_infs() {

    const char *infs[] = {
            "1/0",
            "log(0)",
            "pow(2,10000000)",
            "fac(300)",
            "ncr(300,100)",
            "ncr(300000,100)",
            "ncr(300000,100)*8",
            "npr(3,2)*ncr(300000,100)",
            "npr(100,90)",
            "npr(30,25)",
    };

    int i;
    for (i = 0; i < sizeof(infs) / sizeof(const char *); ++i) {
        const char *expr = infs[i];

        int err;
        const double r = te_interp(expr, &err);
        lequal(err, 0);
        lok(r == r + 1);

        te_expr *n = te_compile(expr, 0, 0, &err);
        lok(n);
        lequal(err, 0);
        const double c = te_eval(n);
        lok(c == c + 1);
        te_free(n);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xc(%rsp), %rbx
leaq 0x4cb6(%rip), %r14      # 0x83b5
leaq 0x4cbd(%rip), %r15      # 0x83c3
leaq 0x4d1c(%rip), %r12      # 0x8429
xorl %ebp, %ebp
cmpq $0x50, %rbp
je 0x3860
leaq 0x7f30(%rip), %rax      # 0xb650
movq (%rbp,%rax), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6cc5
movl 0x89c6(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x89be(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x3773
incl 0x89b4(%rip)            # 0xc100
movq %r12, %rdi
movq %r15, %rsi
movl $0x10a, %edx            # imm = 0x10A
xorl %r8d, %r8d
xorl %eax, %eax
movsd %xmm0, 0x10(%rsp)
callq 0x3090
movsd 0x10(%rsp), %xmm0
movl 0x8989(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8981(%rip)      # 0xc0fc
movapd %xmm0, %xmm1
addsd 0x48c1(%rip), %xmm1     # 0x8048
ucomisd %xmm1, %xmm0
jne 0x378f
jnp 0x37a7
incl 0x896b(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0x10b, %edx            # imm = 0x10B
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x6b26
movq %rax, %r13
movl 0x893d(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x8935(%rip)      # 0xc0fc
testq %r13, %r13
jne 0x37ea
incl 0x892e(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0x10e, %edx            # imm = 0x10E
xorl %eax, %eax
callq 0x3090
movl 0x8912(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x890a(%rip)      # 0xc0fc
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x3815
incl 0x8900(%rip)            # 0xc100
movq %r12, %rdi
movq %r15, %rsi
movl $0x10f, %edx            # imm = 0x10F
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
callq 0x652d
incl 0x88d9(%rip)            # 0xc0fc
movapd %xmm0, %xmm1
addsd 0x4819(%rip), %xmm1     # 0x8048
ucomisd %xmm1, %xmm0
jne 0x3837
jnp 0x384f
incl 0x88c3(%rip)            # 0xc100
movq %r14, %rdi
movq %r15, %rsi
movl $0x111, %edx            # imm = 0x111
xorl %eax, %eax
callq 0x3090
movq %r13, %rdi
callq 0x6224
addq $0x8, %rbp
jmp 0x370f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/smoke.c
// Function: test_optimize
void test_optimize() {

    test_case cases[] = {
        {"5+5", 10},
        {"pow(2,2)", 4},
        {"sqrt 100", 10},
        {"pi * 2", 6.2832},
    };

    int i;
    for (i = 0; i < sizeof(cases) / sizeof(test_case); ++i) {
        const char *expr = cases[i].expr;
        const double answer = cases[i].answer;

        int err;
        te_expr *ex = te_compile(expr, 0, 0, &err);
        lok(ex);

        /* The answer should be know without
         * even running eval. */
        lfequal(ex->value, answer);
        lfequal(te_eval(ex), answer);

        te_free(ex);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x5fc9(%rip), %rbp      # 0xb870
leaq 0x14(%rsp), %rbx
leaq 0x2b10(%rip), %r15      # 0x83c3
leaq 0x2b11(%rip), %r12      # 0x83cb
xorl %r14d, %r14d
cmpq $0x40, %r14
je 0x59e1
movq (%r14,%rbp), %rdi
movsd 0x8(%r14,%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x6b26
movq %rax, %r13
movl 0x680f(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x6807(%rip)      # 0xc0fc
testq %r13, %r13
jne 0x591c
incl 0x6800(%rip)            # 0xc100
leaq 0x2aae(%rip), %rdi      # 0x83b5
movq %r15, %rsi
movl $0x234, %edx            # imm = 0x234
xorl %eax, %eax
callq 0x3090
movl 0x67e0(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x67d8(%rip)      # 0xc0fc
movsd 0x8(%r13), %xmm0
movapd %xmm0, %xmm1
subsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0x26d0(%rip), %xmm2     # 0x8010
ucomisd 0x26f8(%rip), %xmm2     # 0x8040
ja 0x5950
ucomisd %xmm1, %xmm1
jnp 0x5974
incl 0x67aa(%rip)            # 0xc100
movq %r12, %rdi
movq %r15, %rsi
movl $0x238, %edx            # imm = 0x238
movsd 0x8(%rsp), %xmm1
movb $0x2, %al
callq 0x3090
movl 0x6788(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x6780(%rip)      # 0xc0fc
movq %r13, %rdi
callq 0x652d
movsd 0x8(%rsp), %xmm2
subsd %xmm2, %xmm0
movapd %xmm0, %xmm1
andpd 0x2676(%rip), %xmm1     # 0x8010
ucomisd 0x269e(%rip), %xmm1     # 0x8040
ja 0x59aa
ucomisd %xmm0, %xmm0
jnp 0x59d0
incl 0x6750(%rip)            # 0xc100
movq %r13, %rdi
callq 0x652d
movq %r12, %rdi
movq %r15, %rsi
movl $0x239, %edx            # imm = 0x239
movsd 0x8(%rsp), %xmm1
movb $0x2, %al
callq 0x3090
movq %r13, %rdi
callq 0x6224
addq $0x10, %r14
jmp 0x58bd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/smoke.c
// Function: test_combinatorics
void test_combinatorics() {
    test_case cases[] = {
            {"fac(0)", 1},
            {"fac(0.2)", 1},
            {"fac(1)", 1},
            {"fac(2)", 2},
            {"fac(3)", 6},
            {"fac(4.8)", 24},
            {"fac(10)", 3628800},

            {"ncr(0,0)", 1},
            {"ncr(10,1)", 10},
            {"ncr(10,0)", 1},
            {"ncr(10,10)", 1},
            {"ncr(16,7)", 11440},
            {"ncr(16,9)", 11440},
            {"ncr(100,95)", 75287520},

            {"npr(0,0)", 1},
            {"npr(10,1)", 10},
            {"npr(10,0)", 1},
            {"npr(10,10)", 3628800},
            {"npr(20,5)", 1860480},
            {"npr(100,4)", 94109400},
    };


    int i;
    for (i = 0; i < sizeof(cases) / sizeof(test_case); ++i) {
        const char *expr = cases[i].expr;
        const double answer = cases[i].answer;

        int err;
        const double ev = te_interp(expr, &err);
        lok(!err);
        lfequal(ev, answer);

        if (err) {
            printf("FAILED: %s (%d)\n", expr, err);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
pushq $0x8
popq %r14
leaq 0x5d7f(%rip), %r12      # 0xb970
leaq 0x4(%rsp), %rbx
leaq 0x27c6(%rip), %r15      # 0x83c3
leaq 0x27b1(%rip), %r13      # 0x83b5
cmpq $0x148, %r14            # imm = 0x148
je 0x5cdc
movq -0x8(%r14,%r12), %rbp
movsd (%r14,%r12), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6cc5
movl 0x64c9(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x64c1(%rip)      # 0xc0fc
cmpl $0x0, 0x4(%rsp)
je 0x5c6c
incl 0x64b8(%rip)            # 0xc100
movq %r13, %rdi
movq %r15, %rsi
movl $0x2ab, %edx            # imm = 0x2AB
xorl %eax, %eax
movsd %xmm0, 0x8(%rsp)
callq 0x3090
movsd 0x8(%rsp), %xmm0
movl 0x6490(%rip), %eax      # 0xc0fc
incl %eax
movl %eax, 0x6488(%rip)      # 0xc0fc
movapd %xmm0, %xmm3
movsd 0x10(%rsp), %xmm1
subsd %xmm1, %xmm3
movapd %xmm3, %xmm2
andpd 0x2382(%rip), %xmm2     # 0x8010
ucomisd 0x23aa(%rip), %xmm2     # 0x8040
ja 0x5c9e
ucomisd %xmm3, %xmm3
jnp 0x5cba
incl 0x645c(%rip)            # 0xc100
leaq 0x2720(%rip), %rdi      # 0x83cb
movq %r15, %rsi
movl $0x2ac, %edx            # imm = 0x2AC
movb $0x2, %al
callq 0x3090
movl 0x4(%rsp), %edx
testl %edx, %edx
je 0x5cd3
leaq 0x2714(%rip), %rdi      # 0x83dd
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3090
addq $0x10, %r14
jmp 0x5c04
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: te_free_parameters
void te_free_parameters(te_expr *n) {
    if (!n) return;
    switch (TYPE_MASK(n->type)) {
        case TE_FUNCTION7: case TE_CLOSURE7: te_free(n->parameters[6]);     /* Falls through. */
        case TE_FUNCTION6: case TE_CLOSURE6: te_free(n->parameters[5]);     /* Falls through. */
        case TE_FUNCTION5: case TE_CLOSURE5: te_free(n->parameters[4]);     /* Falls through. */
        case TE_FUNCTION4: case TE_CLOSURE4: te_free(n->parameters[3]);     /* Falls through. */
        case TE_FUNCTION3: case TE_CLOSURE3: te_free(n->parameters[2]);     /* Falls through. */
        case TE_FUNCTION2: case TE_CLOSURE2: te_free(n->parameters[1]);     /* Falls through. */
        case TE_FUNCTION1: case TE_CLOSURE1: te_free(n->parameters[0]);
    }
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x6222
movq %rdi, %rbx
movl (%rdi), %eax
andl $0x1f, %eax
addl $-0x9, %eax
cmpl $0xe, %eax
ja 0x6222
leaq 0x2753(%rip), %rcx      # 0x892c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%rbx), %rdi
callq 0x6224
movq 0x38(%rbx), %rdi
callq 0x6224
movq 0x30(%rbx), %rdi
callq 0x6224
movq 0x28(%rbx), %rdi
callq 0x6224
movq 0x20(%rbx), %rdi
callq 0x6224
movq 0x18(%rbx), %rdi
callq 0x6224
movq 0x10(%rbx), %rdi
popq %rbx
jmp 0x6224
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: te_compile
te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error) {
    state s;
    s.start = s.next = expression;
    s.lookup = variables;
    s.lookup_len = var_count;

    next_token(&s);
    te_expr *root = list(&s);
    if (root == NULL) {
        if (error) *error = -1;
        return NULL;
    }

    if (s.type != TOK_END) {
        te_free(root);
        if (error) {
            *error = (s.next - s.start);
            if (*error == 0) *error = 1;
        }
        return 0;
    } else {
        optimize(root);
        if (error) *error = 0;
        return root;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rsp, %r14
movq %rdi, 0x8(%r14)
movq %rdi, (%r14)
movq %rsi, 0x28(%r14)
movl %edx, 0x30(%r14)
movq %r14, %rdi
callq 0x623c
movq %r14, %rdi
callq 0x6bae
testq %rax, %rax
je 0x6b72
movq %rax, %r14
cmpl $0x1a, 0x10(%rsp)
jne 0x6b7f
movq %r14, %rdi
callq 0x6c40
xorl %eax, %eax
testq %rbx, %rbx
jne 0x6b9c
jmp 0x6b9e
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x6b9e
pushq $-0x1
popq %rax
jmp 0x6b9c
movq %r14, %rdi
callq 0x6224
testq %rbx, %rbx
je 0x6ba9
movl 0x8(%rsp), %eax
subl (%rsp), %eax
cmpl $0x1, %eax
adcl $0x0, %eax
xorl %r14d, %r14d
movl %eax, (%rbx)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
retq
xorl %r14d, %r14d
jmp 0x6b9e
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: list
static te_expr *list(state *s) {
    /* <list>      =    <expr> {"," <expr>} */
    te_expr *ret = expr(s);
    CHECK_NULL(ret);

    while (s->type == TOK_SEP) {
        next_token(s);
        te_expr *e = expr(s);
        CHECK_NULL(e, te_free(ret));

        te_expr *prev = ret;
        ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, e);
        CHECK_NULL(ret, te_free(e), te_free(prev));

        ret->function = comma;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
callq 0x6f59
testq %rax, %rax
je 0x6c2c
movq %rax, %rbx
pushq $0x2a
popq %rbp
leaq 0x8(%rsp), %r15
leaq 0x4a2(%rip), %r13       # 0x707d
cmpl $0x1b, 0x10(%r14)
jne 0x6c2e
movq %r14, %rdi
callq 0x623c
movq %r14, %rdi
callq 0x6f59
testq %rax, %rax
je 0x6c24
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movl %ebp, %edi
movq %r15, %rsi
callq 0x7001
testq %rax, %rax
je 0x6c1c
movq %r13, 0x8(%rax)
movq %rax, %rbx
jmp 0x6bdb
movq %r12, %rdi
callq 0x6224
movq %rbx, %rdi
callq 0x6224
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: optimize
static void optimize(te_expr *n) {
    /* Evaluates as much as possible. */
    if (n->type == TE_CONSTANT) return;
    if (n->type == TE_VARIABLE) return;

    /* Only optimize out functions flagged as pure. */
    if (IS_PURE(n->type)) {
        const int arity = ARITY(n->type);
        int known = 1;
        int i;
        for (i = 0; i < arity; ++i) {
            optimize(n->parameters[i]);
            if (((te_expr*)(n->parameters[i]))->type != TE_CONSTANT) {
                known = 0;
            }
        }
        if (known) {
            const double value = te_eval(n);
            te_free_parameters(n);
            n->type = TE_CONSTANT;
            n->value = value;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl (%rdi), %r14d
testb $0x20, %r14b
je 0x6cb6
movq %rdi, %rbx
movl %r14d, %r15d
andl $0x7, %r15d
pushq $0x1
popq %rbp
xorl %r12d, %r12d
xorl %r13d, %r13d
testb $0x18, %r14b
je 0x6c8d
cmpq %r15, %r13
jae 0x6c8d
movq 0x10(%rbx,%r13,8), %rdi
callq 0x6c40
movq 0x10(%rbx,%r13,8), %rax
cmpl $0x1, (%rax)
cmovnel %r12d, %ebp
incq %r13
jmp 0x6c67
testl %ebp, %ebp
je 0x6cb6
movq %rbx, %rdi
callq 0x652d
movsd %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x61bc
movl $0x1, (%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: te_interp
double te_interp(const char *expression, int *error) {
    te_expr *n = te_compile(expression, 0, 0, error);

    double ret;
    if (n) {
        ret = te_eval(n);
        te_free(n);
    } else {
        ret = NAN;
    }
    return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rcx
xorl %esi, %esi
xorl %edx, %edx
callq 0x6b26
testq %rax, %rax
je 0x6cfc
movq %rax, %rbx
movq %rax, %rdi
callq 0x652d
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x6224
movsd 0x8(%rsp), %xmm0
jmp 0x6d04
movsd 0x1da4(%rip), %xmm0     # 0x8aa8
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: pn
static void pn (const te_expr *n, int depth) {
    int i, arity;
    printf("%*s", depth, "");

    switch(TYPE_MASK(n->type)) {
    case TE_CONSTANT: printf("%f\n", n->value); break;
    case TE_VARIABLE: printf("bound %p\n", n->bound); break;

    case TE_FUNCTION0: case TE_FUNCTION1: case TE_FUNCTION2: case TE_FUNCTION3:
    case TE_FUNCTION4: case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
    case TE_CLOSURE0: case TE_CLOSURE1: case TE_CLOSURE2: case TE_CLOSURE3:
    case TE_CLOSURE4: case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
         arity = ARITY(n->type);
         printf("f%d", arity);
         for(i = 0; i < arity; i++) {
             printf(" %p", n->parameters[i]);
         }
         printf("\n");
         for(i = 0; i < arity; i++) {
             pn(n->parameters[i], depth + 1);
         }
         break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x1e37(%rip), %rdi      # 0x8b59
leaq 0x1699(%rip), %rdx      # 0x83c2
xorl %eax, %eax
callq 0x3090
movl (%rbx), %r14d
movl %r14d, %eax
andl $0x1f, %eax
leal -0x8(%rax), %ecx
cmpl $0x10, %ecx
jae 0x6da8
movl %r14d, %eax
andl $0x18, %eax
andl $0x7, %r14d
testl %eax, %eax
cmovel %eax, %r14d
leaq 0x1e13(%rip), %rdi      # 0x8b6b
movl %r14d, %esi
xorl %eax, %eax
callq 0x3090
leaq 0x1e06(%rip), %r15      # 0x8b6f
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x6d85
movq 0x10(%rbx,%r12,8), %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3090
incq %r12
jmp 0x6d6c
pushq $0xa
popq %rdi
callq 0x3040
incl %ebp
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x6dcc
movq 0x10(%rbx,%r15,8), %rdi
movl %ebp, %esi
callq 0x6d0e
incq %r15
jmp 0x6d92
testl %eax, %eax
je 0x6dd5
cmpl $0x1, %eax
jne 0x6dcc
movsd 0x8(%rbx), %xmm0
leaq 0x1da0(%rip), %rdi      # 0x8b5d
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3090
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rsi
leaq 0x1d81(%rip), %rdi      # 0x8b61
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3090
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: fac
static double fac(double a) {/* simplest version of fac */
    if (a < 0.0)
        return NAN;
    if (a > UINT_MAX)
        return INFINITY;
    unsigned int ua = (unsigned int)(a);
    unsigned long int result = 1, i;
    for (i = 1; i <= ua; i++) {
        if (i > ULONG_MAX / result)
            return INFINITY;
        result *= i;
    }
    return (double)result;
}

// Assembly:
movapd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x6e0f
movsd 0x1c9a(%rip), %xmm0     # 0x8aa8
retq
movsd 0x1ca1(%rip), %xmm0     # 0x8ab8
ucomisd 0x1ca1(%rip), %xmm1     # 0x8ac0
ja 0x6e6d
cvttsd2si %xmm1, %rax
movl %eax, %esi
negq %rsi
pushq $0x1
popq %rcx
movq %rcx, %rdi
leaq (%rsi,%rdi), %rax
cmpq $0x1, %rax
je 0x6e4c
movq %rcx, %rax
mulq %rdi
jo 0x6e6d
imulq %rdi, %rcx
incq %rdi
jmp 0x6e31
movq %rcx, %xmm1
punpckldq 0x1c77(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1c7f(%rip), %xmm1     # 0x8ae0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: ncr
static double ncr(double n, double r) {
    if (n < 0.0 || r < 0.0 || n < r) return NAN;
    if (n > UINT_MAX || r > UINT_MAX) return INFINITY;
    unsigned long int un = (unsigned int)(n), ur = (unsigned int)(r), i;
    unsigned long int result = 1;
    if (ur > un / 2) ur = un - ur;
    for (i = 1; i <= ur; i++) {
        if (result > ULONG_MAX / (un - ur + i))
            return INFINITY;
        result *= un - ur + i;
        result /= i;
    }
    return result;
}

// Assembly:
movapd %xmm0, %xmm2
ucomisd %xmm0, %xmm1
movsd 0x1c2a(%rip), %xmm0     # 0x8aa8
ja 0x6f24
xorpd %xmm3, %xmm3
ucomisd %xmm2, %xmm3
ja 0x6f24
ucomisd %xmm1, %xmm3
ja 0x6f24
ucomisd 0x1c1c(%rip), %xmm2     # 0x8ac0
movsd 0x1c0c(%rip), %xmm0     # 0x8ab8
ja 0x6f24
ucomisd 0x1c0a(%rip), %xmm1     # 0x8ac0
ja 0x6f24
cvttsd2si %xmm2, %rax
cvttsd2si %xmm1, %rcx
movl %eax, %edi
movl %ecx, %edx
shrl %eax
movq %rdi, %r8
subq %rdx, %r8
cmpl %ecx, %eax
cmovaeq %rdx, %r8
subq %r8, %rdi
pushq $0x1
popq %r9
movq %r9, %rcx
cmpq %r8, %r9
ja 0x6f03
leaq (%rdi,%r9), %rsi
movq %rsi, %rax
mulq %rcx
jo 0x6f24
imulq %rsi, %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r9
incq %r9
movq %rax, %rcx
jmp 0x6ede
movq %rcx, %xmm1
punpckldq 0x1bc0(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1bc8(%rip), %xmm1     # 0x8ae0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: expr
static te_expr *expr(state *s) {
    /* <expr>      =    <term> {("+" | "-") <term>} */
    te_expr *ret = term(s);
    CHECK_NULL(ret);

    while (s->type == TOK_INFIX && (s->function == add || s->function == sub)) {
        te_fun2 t = s->function;
        next_token(s);
        te_expr *te = term(s);
        CHECK_NULL(te, te_free(ret));

        te_expr *prev = ret;
        ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, te);
        CHECK_NULL(ret, te_free(te), te_free(prev));

        ret->function = t;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
callq 0x7081
testq %rax, %rax
je 0x6fed
movq %rax, %rbx
leaq -0xa65(%rip), %r13      # 0x6519
leaq -0xa67(%rip), %rbp      # 0x651e
cmpl $0x20, 0x10(%r14)
jne 0x6fef
movq 0x18(%r14), %r15
cmpq %r13, %r15
setne %al
cmpq %rbp, %r15
setne %cl
testb %cl, %al
jne 0x6fef
movq %r14, %rdi
callq 0x623c
movq %r14, %rdi
callq 0x7081
testq %rax, %rax
je 0x6fe5
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
pushq $0x2a
popq %rdi
leaq 0x8(%rsp), %rsi
callq 0x7001
testq %rax, %rax
je 0x6fdd
movq %r15, 0x8(%rax)
movq %rax, %rbx
jmp 0x6f85
movq %r12, %rdi
callq 0x6224
movq %rbx, %rdi
callq 0x6224
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: new_expr
static te_expr *new_expr(const int type, const te_expr *parameters[]) {
    const int arity = ARITY(type);
    const int psize = sizeof(void*) * arity;
    const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
    te_expr *ret = malloc(size);
    CHECK_NULL(ret);

    memset(ret, 0, size);
    if (arity && parameters) {
        memcpy(ret->parameters, parameters, psize);
    }
    ret->type = type;
    ret->bound = 0;
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movl %edi, %eax
andl $0x18, %eax
movl %edi, %r15d
andl $0x7, %r15d
testl %eax, %eax
cmovel %eax, %r15d
movl %edi, %eax
shrl %eax
andl $0x8, %eax
leal (%rax,%r15,8), %esi
addl $0x10, %esi
pushq $0x1
popq %rdi
callq 0x30d0
movq %rax, %r12
testq %rax, %rax
je 0x706e
testl %r15d, %r15d
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x7064
shll $0x3, %r15d
movq %r12, %rdi
addq $0x10, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x30f0
movl %ebx, (%r12)
andq $0x0, 0x8(%r12)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq