// File: /workspace/github_c_makefile_star2_O2/mattn[P]orelang/ore.c
// Function: ore_bind_args
static ore_value*
ore_bind_args(ore_context* ore, mpc_ast_t* f, ore_context* this, mpc_ast_t* t) {
  int num_in = t->children_num / 2 - 1, n = 0, i;
  ore_value* args = (ore_value*) malloc(sizeof(ore_value) * num_in);
  if (!args) {
    fprintf(stderr, "failed to allocate memory\n");
    ore->err = ORE_ERROR_EXCEPTION;
    return NULL;
  }
  for (i = 0; i < num_in; i++) {
    args[i] = ore_value_nil();
  }
  i = 0;
  for (i = 0; i < t->children_num; i++) {
    if (is_a(t->children[i], "char") && t->children[i]->contents[0] == '(') {
      i++;
      break;
    }
  }
  for (; i < t->children_num; i++) {
    if (is_a(t->children[i], "char")) {
      if (t->children[i]->contents[0] == ')') {
        i++;
        break;
      }
    } else
      args[n++] = ore_eval(ore, t->children[i]);
  }

  for (i = 0; i < f->children_num; i++) {
    if (is_a(f->children[i], "char") && f->children[i]->contents[0] == '(') {
      i++;
      break;
    }
  }
  n = 0;
  for (; i < f->children_num; i++) {
    if (is_a(f->children[i], "char") && f->children[i]->contents[0] == ')') {
      i++;
      break;
    }
    if (is_a(f->children[i], "vararg")) {
      ore_array_t* a = kl_init(value);
      int j;
      for (j = 0; j < num_in; j++) {
        *kl_pushp(value, a) = args[j];
      }
      ore_define(this, f->children[i-1]->contents, ore_value_array_from_klist(ore, a));
    } else if (is_a(f->children[i], "ident")) {
      if (n < num_in)
        ore_define(this, f->children[i]->contents, args[n++]);
    }
  }
  return args;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, %r13
movq %rdx, 0x50(%rsp)
movq %rsi, %rbx
movq %rdi, 0x40(%rsp)
movl 0x28(%rcx), %eax
pushq $0x2
popq %rcx
movl %eax, 0x38(%rsp)
cltd
idivl %ecx
movl %eax, %ebp
decl %ebp
movslq %ebp, %rax
imulq $0x28, %rax, %rdi
callq 0x21a0
movq %rax, %r12
testq %rax, %rax
je 0xf8c5
xorl %eax, %eax
testl %ebp, %ebp
movl $0x0, %ecx
cmovgl %ebp, %ecx
imulq $0x28, %rcx, %r15
xorps %xmm0, %xmm0
cmpq %rax, %r15
je 0xf63d
movups %xmm0, 0x10(%r12,%rax)
movups %xmm0, (%r12,%rax)
andq $0x0, 0x20(%r12,%rax)
addq $0x28, %rax
jmp 0xf621
movl %ebp, 0x4c(%rsp)
movq %rbx, 0x30(%rsp)
xorl %ebp, %ebp
movl 0x38(%rsp), %eax
testl %eax, %eax
movl $0x0, %ebx
cmovgl %eax, %ebx
cmpq %rbp, %rbx
je 0xf689
movq 0x30(%r13), %rax
movq (%rax,%rbp,8), %r14
movq (%r14), %rdi
leaq 0xe8b(%rip), %rsi       # 0x104f8
callq 0x2290
testq %rax, %rax
je 0xf680
movq 0x8(%r14), %rax
cmpb $0x28, (%rax)
je 0xf685
incq %rbp
jmp 0xf656
incl %ebp
movl %ebp, %ebx
movslq %ebx, %r14
movl $0x0, 0x3c(%rsp)
movl 0x38(%rsp), %ebp
movslq %ebp, %rax
cmpq %rax, %r14
jge 0xf725
movq 0x30(%r13), %rax
movq (%rax,%r14,8), %rbx
movq (%rbx), %rdi
leaq 0xe42(%rip), %rsi       # 0x104f8
callq 0x2290
testq %rax, %rax
je 0xf6cb
movq 0x8(%rbx), %rax
cmpb $0x29, (%rax)
jne 0xf71d
jmp 0xf725
movl 0x3c(%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, 0x3c(%rsp)
imulq $0x28, %rax, %rbp
leaq 0x80(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rbx, %rdx
callq 0xb1b8
movq 0xa0(%rsp), %rax
movq %rax, 0x20(%r12,%rbp)
movups 0x80(%rsp), %xmm0
movups 0x90(%rsp), %xmm1
movups %xmm1, 0x10(%r12,%rbp)
movups %xmm0, (%r12,%rbp)
movl 0x28(%r13), %ebp
incq %r14
jmp 0xf698
movq 0x30(%rsp), %rax
movl 0x28(%rax), %ebx
xorl %ebp, %ebp
testl %ebx, %ebx
movl $0x0, %r13d
cmovgl %ebx, %r13d
cmpq %rbp, %r13
je 0xf774
movq 0x30(%rax), %rax
movq (%rax,%rbp,8), %r14
movq (%r14), %rdi
leaq 0xda6(%rip), %rsi       # 0x104f8
callq 0x2290
testq %rax, %rax
je 0xf765
movq 0x8(%r14), %rax
cmpb $0x28, (%rax)
je 0xf76f
incq %rbp
movq 0x30(%rsp), %rax
jmp 0xf73b
incl %ebp
movl %ebp, %r13d
movslq %r13d, %rbp
xorl %r13d, %r13d
movslq %ebx, %rax
cmpq %rax, %rbp
jge 0xf8ed
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
movq (%rax,%rbp,8), %rbx
movq (%rbx), %r14
movq %r14, %rdi
leaq 0xd58(%rip), %rsi       # 0x104f8
callq 0x2290
testq %rax, %rax
je 0xf7b7
movq 0x8(%rbx), %rax
cmpb $0x29, (%rax)
je 0xf8ed
movq %r14, %rdi
leaq 0x12e2(%rip), %rsi      # 0x10aa3
callq 0x2290
testq %rax, %rax
je 0xf85a
callq 0xb0dd
movq %rax, %r14
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0xf807
movq %r14, %rdi
callq 0xb123
movups (%r12,%rbx), %xmm0
movups 0x10(%r12,%rbx), %xmm1
movups %xmm0, (%rax)
movups %xmm1, 0x10(%rax)
movq 0x20(%r12,%rbx), %rcx
movq %rcx, 0x20(%rax)
addq $0x28, %rbx
jmp 0xf7d9
movq 0x30(%rsp), %rcx
movq 0x30(%rcx), %rax
movq -0x8(%rax,%rbp,8), %rax
movq 0x8(%rax), %rbx
leaq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r14, %rdx
movq %rcx, %r14
callq 0xb14a
movq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0xaad0
jmp 0xf8b9
movq %r14, %rdi
leaq 0x1246(%rip), %rsi      # 0x10aaa
callq 0x2290
testq %rax, %rax
setne %al
cmpl 0x4c(%rsp), %r13d
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xf8b4
movq 0x8(%rbx), %rsi
movslq %r13d, %rax
incl %r13d
imulq $0x28, %rax, %rax
movq 0x20(%r12,%rax), %rcx
movq %rcx, 0x20(%rsp)
movups (%r12,%rax), %xmm0
movups 0x10(%r12,%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x50(%rsp), %rdi
callq 0xaad0
movq 0x30(%rsp), %r14
incq %rbp
movl 0x28(%r14), %ebx
jmp 0xf77a
movq 0x872c(%rip), %rax      # 0x17ff8
movq (%rax), %rcx
leaq 0x1170(%rip), %rdi      # 0x10a46
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x2260
movq 0x40(%rsp), %rax
movl $0x1, 0x20(%rax)
movq %r12, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq