// File: kram[P]kram/./src/parser/parser.cpp
// Function: Parser::call(Instruction*, ON)
Instruction* Parser::call(Instruction* prev, ON on) {
	Instruction* ins = new Instruction(Ins::CALL);
	ins->left = std::vector<Instruction*>{ prev };

	// All parameters
	do {
		ins->right = this->read_until(std::vector<lexer::Token>{
			lexer::Token::OPERATOR(")"),
			lexer::Token::OPERATOR(","),
		}, ins->right);
	} while (this->get_token()->sub == lexer::Type::OPERATOR_COMMA);

	return this->lookahead(ins, ON::DEFAULT);
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, 0x1e0(%rsp)
movq %rsi, 0x1d8(%rsp)
movl %edx, 0x1d4(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0x70(%rsp)
movl $0x80, %edi
callq 0x32e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movl $0x8, %esi
callq 0x26dd0
jmp 0x2182c
movq 0x78(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movq 0x1d8(%rsp), %rax
movq %rax, 0x188(%rsp)
leaq 0x188(%rsp), %rax
movq %rax, 0x190(%rsp)
movq $0x1, 0x198(%rsp)
leaq 0x187(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x16cc0
movq 0x68(%rsp), %rcx
movq 0x190(%rsp), %rsi
movq 0x198(%rsp), %rdx
leaq 0x1a0(%rsp), %rdi
callq 0x26e70
jmp 0x2189b
movq 0x1c8(%rsp), %rdi
addq $0x38, %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x26e30
leaq 0x1a0(%rsp), %rdi
callq 0x5560
leaq 0x187(%rsp), %rdi
callq 0x7010
movb $0x1, 0x9e(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x34a0
movq 0x60(%rsp), %rdx
leaq 0xa2d7(%rip), %rsi      # 0x2bbdb
leaq 0xc8(%rsp), %rdi
callq 0x3390
jmp 0x21913
leaq 0xf0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xd7e0
jmp 0x2192a
leaq 0x118(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rax, 0xe8(%rsp)
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x34a0
movq 0x58(%rsp), %rdx
leaq 0x9929(%rip), %rsi      # 0x2b286
leaq 0xa0(%rsp), %rdi
callq 0x3390
jmp 0x2196c
movq 0x50(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd7e0
jmp 0x21980
movb $0x0, 0x9e(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0x140(%rsp)
movq $0x2, 0x148(%rsp)
leaq 0x9d(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x26940
movq 0x48(%rsp), %rcx
movq 0x140(%rsp), %rsi
movq 0x148(%rsp), %rdx
leaq 0x150(%rsp), %rdi
callq 0x26950
jmp 0x219da
movq 0x1c8(%rsp), %rsi
addq $0x50, %rsi
leaq 0x80(%rsp), %rdi
callq 0x5460
jmp 0x219f5
movq 0x70(%rsp), %rsi
leaq 0x168(%rsp), %rdi
leaq 0x150(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x21120
jmp 0x21a19
movq 0x1c8(%rsp), %rdi
addq $0x50, %rdi
leaq 0x168(%rsp), %rsi
callq 0x26e30
leaq 0x168(%rsp), %rdi
callq 0x5560
leaq 0x80(%rsp), %rdi
callq 0x5560
leaq 0x150(%rsp), %rdi
callq 0x269e0
leaq 0x9d(%rsp), %rdi
callq 0x26a40
leaq 0xf0(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x50, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x30(%rsp)
callq 0xdeb0
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x21a7c
leaq 0xa0(%rsp), %rdi
callq 0x31f0
leaq 0x9f(%rsp), %rdi
callq 0x3310
leaq 0xc8(%rsp), %rdi
callq 0x31f0
leaq 0xc7(%rsp), %rdi
callq 0x3310
movq 0x70(%rsp), %rdi
callq 0x21200
cmpl $0x12, 0x4(%rax)
je 0x218ce
movq 0x70(%rsp), %rdi
movq 0x1c8(%rsp), %rsi
xorl %edx, %edx
callq 0x213f0
addq $0x1e8, %rsp            # imm = 0x1E8
retq
movq 0x78(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
callq 0x32b0
jmp 0x21ce2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x187(%rsp), %rdi
callq 0x7010
jmp 0x21ce2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x21c01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5560
leaq 0x150(%rsp), %rdi
callq 0x269e0
leaq 0x9d(%rsp), %rdi
callq 0x26a40
leaq 0xf0(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x50, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x18(%rsp)
callq 0xdeb0
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x21c31
jmp 0x21c5a
leaq 0xa0(%rsp), %rdi
callq 0x31f0
leaq 0x9f(%rsp), %rdi
callq 0x3310
leaq 0xc8(%rsp), %rdi
callq 0x31f0
leaq 0xc7(%rsp), %rdi
callq 0x3310
testb $0x1, 0x9e(%rsp)
jne 0x21c9a
jmp 0x21ce0
movq 0xe8(%rsp), %rax
leaq 0xf0(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x10(%rsp)
je 0x21cde
movq 0x10(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x8(%rsp)
callq 0xdeb0
movq 0x8(%rsp), %rax
leaq 0xf0(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x21cb4
jmp 0x21ce0
jmp 0x21ce2
movq 0x1c0(%rsp), %rdi
callq 0x3490
nop