// File: /workspace/github_c_makefile_star2_O3/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 $0xb8, %rsp
movq %rcx, %r13
movq %rdx, 0x48(%rsp)
movq %rsi, %rbx
movq %rdi, 0x40(%rsp)
movl 0x28(%rcx), %ebp
movl %ebp, %r14d
shrl $0x1f, %r14d
addl %ebp, %r14d
sarl %r14d
movslq %r14d, %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdi
addq $-0x28, %rdi
callq 0x21a0
testq %rax, %rax
movq %rax, 0x38(%rsp)
je 0x12c56
decl %r14d
cmpl $0x4, %ebp
jl 0x1293c
cmpl $0x2, %r14d
movl $0x1, %ecx
cmovgel %r14d, %ecx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
movq $0x0, 0x20(%rax,%rcx)
addq $0x28, %rcx
cmpq %rcx, %rdx
jne 0x12921
movl %r14d, 0x34(%rsp)
movq %rbx, 0x28(%rsp)
testl %ebp, %ebp
movq %rbp, 0x60(%rsp)
jle 0x12988
movq 0x30(%r13), %r15
xorl %ebx, %ebx
leaq 0x1bac(%rip), %r14      # 0x14508
movq (%r15,%rbx,8), %r12
movq (%r12), %rdi
movq %r14, %rsi
callq 0x2290
testq %rax, %rax
je 0x1297b
movq 0x8(%r12), %rax
cmpb $0x28, (%rax)
je 0x1298c
incq %rbx
cmpq %rbx, %rbp
jne 0x1295c
jmp 0x12a22
xorl %ebx, %ebx
jmp 0x1298e
incl %ebx
cmpl %ebp, %ebx
jge 0x12a22
movslq %ebx, %r15
xorl %r14d, %r14d
leaq 0x1b65(%rip), %r12      # 0x14508
movl %ebp, %ebx
movq 0x30(%r13), %rax
movq (%rax,%r15,8), %rbp
movq (%rbp), %rdi
movq %r12, %rsi
callq 0x2290
testq %rax, %rax
je 0x129c9
movq 0x8(%rbp), %rax
cmpb $0x29, (%rax)
jne 0x12a17
jmp 0x12a22
movslq %r14d, %rax
incl %r14d
leaq (%rax,%rax,4), %rbx
leaq 0x90(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
callq 0xdc73
movq 0xb0(%rsp), %rax
movq 0x38(%rsp), %rcx
movq %rax, 0x20(%rcx,%rbx,8)
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rcx,%rbx,8)
movups %xmm0, (%rcx,%rbx,8)
movl 0x28(%r13), %ebx
incq %r15
movslq %ebx, %rax
cmpq %rax, %r15
jl 0x129a5
movq 0x28(%rsp), %rax
movslq 0x28(%rax), %r15
testq %r15, %r15
jle 0x12a68
movq 0x30(%rax), %r12
xorl %ebx, %ebx
leaq 0x1acb(%rip), %r14      # 0x14508
movq (%r12,%rbx,8), %r13
movq (%r13), %rdi
movq %r14, %rsi
callq 0x2290
testq %rax, %rax
je 0x12a5b
movq 0x8(%r13), %rax
cmpb $0x28, (%rax)
je 0x12a6c
incq %rbx
cmpq %rbx, %r15
jne 0x12a3d
jmp 0x12c60
xorl %ebx, %ebx
jmp 0x12a6e
incl %ebx
cmpl %r15d, %ebx
jge 0x12c60
movl 0x34(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %r13d
cmovgel %eax, %r13d
movl %ebx, %r15d
xorl %r12d, %r12d
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rbx
movq (%rbx,%r15,8), %rbp
movq (%rbp), %r14
movq %r14, %rdi
leaq 0x1a5f(%rip), %rsi      # 0x14508
callq 0x2290
testq %rax, %rax
je 0x12ac0
movq 0x8(%rbp), %rax
cmpb $0x29, (%rax)
je 0x12c60
movq %r14, %rdi
leaq 0x2065(%rip), %rsi      # 0x14b2f
callq 0x2290
testq %rax, %rax
je 0x12be2
movl $0x1, %edi
movl $0x20, %esi
callq 0x2140
movq %rax, %r14
movl $0x1, %edi
movl $0x20, %esi
callq 0x2140
movq %rax, %rbp
movq %rax, 0x10(%r14)
movq $0x1, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x2140
movq %rax, 0x8(%r14)
movq %rax, (%r14)
cmpl $0x4, 0x60(%rsp)
jl 0x12b9d
movq %rbp, 0x50(%rsp)
movq %r12, 0x58(%rsp)
movq 0x38(%rsp), %r12
xorl %ebx, %ebx
movq %rax, %rbp
movl $0x1, %edi
movl $0x30, %esi
callq 0x2140
movq $0x0, 0x28(%rax)
movq %rax, 0x28(%rbp)
movq 0x20(%r12), %rcx
movq %rcx, 0x20(%rbp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rbp)
movups %xmm0, (%rbp)
incq %rbx
addq $0x28, %r12
cmpq %rbx, %r13
jne 0x12b35
movq %rax, 0x8(%r14)
leaq 0x1(%rbx), %rax
movq 0x50(%rsp), %rcx
movq %rax, (%rcx)
movq %rbx, 0x18(%r14)
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rbx
movq 0x58(%rsp), %r12
movq -0x8(%rbx,%r15,8), %rax
movq 0x8(%rax), %rbp
leaq 0x68(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r14, %rdx
callq 0xdc1f
movq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x68(%rsp), %xmm0
movups 0x78(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
movq %rbp, %rsi
jmp 0x12c3a
movq %r14, %rdi
leaq 0x1f4a(%rip), %rsi      # 0x14b36
callq 0x2290
testq %rax, %rax
setne %al
cmpl 0x34(%rsp), %r12d
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x12c3f
movq 0x8(%rbp), %rsi
movslq %r12d, %rax
incl %r12d
leaq (%rax,%rax,4), %rax
movq 0x38(%rsp), %rdx
movq 0x20(%rdx,%rax,8), %rcx
movq %rcx, 0x20(%rsp)
movups (%rdx,%rax,8), %xmm0
movups 0x10(%rdx,%rax,8), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0xd3c9
movq 0x28(%rsp), %rax
incq %r15
movslq 0x28(%rax), %rax
cmpq %rax, %r15
jl 0x12a8e
jmp 0x12c60
movq 0x40(%rsp), %rdi
callq 0x2967
movq 0x38(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq