// File: Mulan-Szechuan-Sauce[P]javelin/src/node.cpp
// Function: NFunctionCallExpression::NFunctionCallExpression(NIdentifier*, NExpressionArgs*)
NFunctionCallExpression::
NFunctionCallExpression(NIdentifier *id, NExpressionArgs *args):
    id(id), args(args) {
  Definition *def = scope->findDefinition(id->name);
  if (def == NULL) {
    throw std::runtime_error(id->name + " function is undefined");
  }
  if ( ! def->isFunction()) {
    throw std::runtime_error(id->name + " is not defined as a function");
  }
  if ( ! ((FunctionDefinition *)def)->argsMatch(args)) {
    throw std::runtime_error("Type mismatch");
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0xc9b0
movq -0xc0(%rbp), %rax
leaq 0xcbc3(%rip), %rcx      # 0x1ebd8
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x5100
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movq %rax, -0xa8(%rbp)
jmp 0x1206a
leaq -0x40(%rbp), %rdi
callq 0x5190
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x12143
movb $0x1, -0x71(%rbp)
movl $0x10, %edi
callq 0x5130
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
leaq 0x4c92(%rip), %rdx      # 0x16d3f
leaq -0x70(%rbp), %rdi
callq 0x13930
jmp 0x120b8
movq -0xc8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5390
jmp 0x120ca
movq -0xc8(%rbp), %rdi
movb $0x0, -0x71(%rbp)
movq 0xcf0c(%rip), %rsi      # 0x1efe8
movq 0xced5(%rip), %rdx      # 0x1efb8
callq 0x53d0
jmp 0x12280
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5190
jmp 0x12277
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1212a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5190
testb $0x1, -0x71(%rbp)
jne 0x12132
jmp 0x1213e
movq -0xc8(%rbp), %rdi
callq 0x51b0
jmp 0x12277
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
testb $0x1, %al
jne 0x12203
movb $0x1, -0x99(%rbp)
movl $0x10, %edi
callq 0x5130
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
leaq 0x4bdb(%rip), %rdx      # 0x16d56
leaq -0x98(%rbp), %rdi
callq 0x13930
jmp 0x12189
movq -0xd0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5390
jmp 0x1219e
movq -0xd0(%rbp), %rdi
movb $0x0, -0x99(%rbp)
movq 0xce35(%rip), %rsi      # 0x1efe8
movq 0xcdfe(%rip), %rdx      # 0x1efb8
callq 0x53d0
jmp 0x12280
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x121ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x5190
testb $0x1, -0x99(%rbp)
jne 0x121f5
jmp 0x12201
movq -0xd0(%rbp), %rdi
callq 0x51b0
jmp 0x12277
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
testb $0x1, %al
jne 0x1226e
movl $0x10, %edi
callq 0x5130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
leaq 0x4b41(%rip), %rsi      # 0x16d74
callq 0x50e0
jmp 0x1223a
movq -0xd8(%rbp), %rdi
movq 0xcda0(%rip), %rsi      # 0x1efe8
movq 0xcd69(%rip), %rdx      # 0x1efb8
callq 0x53d0
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x51b0
jmp 0x12277
addq $0xe0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x5400