// File: /workspace/github_c_makefile_star2_O0/mattn[P]orelang/ore.c
// Function: ore_func_call
ore_value
ore_func_call(ore_context* ore, ore_value fn, int num_in, ore_value* args) {
  if ((fn.v.f.num_in != -1 && num_in < fn.v.f.num_in) || (fn.v.f.max_in != -1 && num_in > fn.v.f.max_in)) {
    fprintf(stderr, "number of arguments mismatch: %d for %d\n",
      num_in, fn.v.f.num_in);
    fprintf(stderr, "number of arguments mismatch: %d for %d\n",
      num_in, fn.v.f.max_in);
    ore->err = ORE_ERROR_EXCEPTION;
    return ore_value_nil();
  }

  ore_context* env = ore_new((ore_context*) fn.v.f.ore);
  mpc_ast_t* stmts = NULL;
  mpc_ast_t* f = fn.v.f.x.o;
  int n = 0, i;
  for (i = 2; i < f->children_num; i++) {
    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(env, 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(env, f->children[i]->contents, args[n++]);
    } else if (is_a(f->children[i], "char")) {
      if (f->children[i]->contents[0] == '{') {
        i++;
        break;
      }
    }
  }
  for (; i < f->children_num; i++) {
    if (stmts == NULL && !is_a(f->children[i], "char")) {
      stmts = f->children[i];
    }
  }
  ore_value v = ore_value_nil();
  if (stmts) {
    v = ore_eval(env, stmts);
    if (env->err == ORE_ERROR_EXCEPTION)
      ore->err = env->err;
    char buf[64];
    sprintf(buf, "0x%p", env->env);
    ore_define(ore, buf, ore_value_env_from_context(env));
  }
  return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x120(%rbp)
movq %rdi, -0x118(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq %rsi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
cmpl $-0x1, 0x10(%rax)
je 0x11444
movq -0x110(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x10(%rcx), %eax
jl 0x11460
movq -0x110(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
je 0x114c6
movq -0x110(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x14(%rcx), %eax
jle 0x114c6
movq -0x110(%rbp), %rax
movq 0xfb8a(%rip), %rcx      # 0x20ff8
movq (%rcx), %rdi
movl -0xc(%rbp), %edx
movl 0x10(%rax), %ecx
leaq 0x9774(%rip), %rsi      # 0x1abf2
movb $0x0, %al
callq 0x2140
movq -0x110(%rbp), %rax
movq 0xfb65(%rip), %rcx      # 0x20ff8
movq (%rcx), %rdi
movl -0xc(%rbp), %edx
movl 0x14(%rax), %ecx
leaq 0x974f(%rip), %rsi      # 0x1abf2
movb $0x0, %al
callq 0x2140
movq -0x120(%rbp), %rdi
movq -0x8(%rbp), %rax
movl $0x1, 0x20(%rax)
callq 0x10670
jmp 0x11803
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x11230
movq %rax, %rcx
movq -0x110(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x2, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x116d0
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
leaq 0x96ef(%rip), %rsi      # 0x1ac1b
callq 0x2260
cmpq $0x0, %rax
je 0x115f1
callq 0x11820
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x11583
movq -0x40(%rbp), %rdi
callq 0x11890
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movslq -0x44(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movl $0x28, %edx
callq 0x2170
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1154b
movq -0x20(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x128(%rbp)
movq -0x8(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x11900
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x70(%rbp), %xmm0
movups -0x60(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x11030
jmp 0x116c0
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
leaq 0x9617(%rip), %rsi      # 0x1ac22
callq 0x2260
cmpq $0x0, %rax
je 0x1166e
movl -0x34(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1166c
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rcx
movl -0x34(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
cltq
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq 0x20(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x20(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x11030
jmp 0x116be
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
leaq 0x8f9a(%rip), %rsi      # 0x1a622
callq 0x2260
cmpq $0x0, %rax
je 0x116bc
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0x116ba
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x116d0
jmp 0x116bc
jmp 0x116be
jmp 0x116c0
jmp 0x116c2
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x11502
jmp 0x116d2
movl -0x38(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x1172b
cmpq $0x0, -0x28(%rbp)
jne 0x1171e
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
leaq 0x8f23(%rip), %rsi      # 0x1a622
callq 0x2260
cmpq $0x0, %rax
jne 0x1171e
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
jmp 0x11720
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x116d2
movq -0x120(%rbp), %rdi
callq 0x10670
cmpq $0x0, -0x28(%rbp)
je 0x11801
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0x119b0
movq -0x120(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movl $0x28, %edx
callq 0x2170
movq -0x20(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x11786
movq -0x20(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
leaq -0xe0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
leaq 0x948d(%rip), %rsi      # 0x1ac28
movb $0x0, %al
callq 0x2220
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0x10720
movq -0x140(%rbp), %rdi
movq -0x138(%rbp), %rsi
movq -0xe8(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x108(%rbp), %xmm0
movups -0xf8(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x11030
jmp 0x11803
movq -0x118(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)