// File: /workspace/github_c_makefile_star2_O3/adamjedlicka[P]blu/src/vm/compiler/compiler.c
// Function: caret
static void caret(bluCompiler* compiler, bool canAssign) {
	if (compiler->classCompiler == NULL) {
		error(compiler, "Cannot use '^' outside of a class.");
	} else if (!compiler->classCompiler->hasSuperclass) {
		// TODO : Every class will have superclass 'Object'
		error(compiler, "Cannot use '^' in a class with no superclass.");
	}

	if (match(compiler, TOKEN_LEFT_PAREN)) {
		namedVariable(compiler, syntheticToken(compiler, "@"), false);

		uint8_t argCount = argumentList(compiler);

		pushSuperclass(compiler);
		emitBytes(compiler, OP_SUPER, argCount);
		emitShort(compiler, makeConstant(compiler, OBJ_VAL(bluCopyString(compiler->vm, "__init", 6))));
		return;
	}

	consume(compiler, TOKEN_IDENTIFIER, "Expect superclass method name.");
	uint8_t name = identifierConstant(compiler, &compiler->parser->previous);

	// Push the receiver.
	namedVariable(compiler, syntheticToken(compiler, "@"), false);

	if (match(compiler, TOKEN_LEFT_PAREN)) {
		uint8_t argCount = argumentList(compiler);

		pushSuperclass(compiler);
		emitBytes(compiler, OP_SUPER, argCount);
		emitShort(compiler, name);
	} else {
		pushSuperclass(compiler);
		emitByte(compiler, OP_GET_SUPER);
		emitShort(compiler, name);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x2c8d
cmpb $0x0, 0x28(%rax)
jne 0x2ca4
leaq 0x650e(%rip), %rdx      # 0x9199
jmp 0x2c94
leaq 0x64e2(%rip), %rdx      # 0x9176
movq 0x8(%rbx), %rsi
addq $0x20, %rsi
movq %rbx, %rdi
callq 0x3a3b
movq 0x8(%rbx), %rax
cmpl $0x7, 0x40(%rax)
jne 0x2d61
movq %rbx, %rdi
callq 0x34a2
leaq 0x6506(%rip), %rax      # 0x91c7
movq %rax, 0x68(%rsp)
movb $0x1, 0x70(%rsp)
movups 0x60(%rsp), %xmm0
movups 0x70(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a54
movq %rbx, %rdi
callq 0x3b0f
movl %eax, %ebp
cmpq $0x0, 0x18(%rbx)
je 0x2d27
leaq 0x66f3(%rip), %rax      # 0x93f3
movq %rax, 0x28(%rsp)
movb $0x1, 0x30(%rsp)
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a54
movzbl %bpl, %edx
movq %rbx, %rdi
movl $0x14, %esi
callq 0x3b7f
movq (%rbx), %rdi
leaq 0x6487(%rip), %rsi      # 0x91c9
movl $0x6, %edx
callq 0x6239
movq %rbx, %rdi
movl $0x3, %esi
movq %rax, %rdx
callq 0x3c03
jmp 0x2e83
leaq 0x6468(%rip), %rdx      # 0x91d0
movq %rbx, %rdi
movl $0x19, %esi
callq 0x3c36
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
movq 0x28(%rax), %rsi
movzbl 0x30(%rax), %edx
callq 0x6239
movq %rbx, %rdi
movl $0x3, %esi
movq %rax, %rdx
callq 0x3c03
movl %eax, %ebp
leaq 0x6425(%rip), %rax      # 0x91c7
movq %rax, 0x48(%rsp)
movb $0x1, 0x50(%rsp)
movups 0x40(%rsp), %xmm0
movups 0x50(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a54
movq 0x8(%rbx), %rax
cmpl $0x7, 0x40(%rax)
jne 0x2e2e
movq %rbx, %rdi
callq 0x34a2
movq %rbx, %rdi
callq 0x3b0f
movl %eax, %r14d
cmpq $0x0, 0x18(%rbx)
je 0x2e1b
leaq 0x65ff(%rip), %rax      # 0x93f3
movq %rax, 0x28(%rsp)
movb $0x1, 0x30(%rsp)
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a54
movzbl %r14b, %edx
movq %rbx, %rdi
movl $0x14, %esi
callq 0x3b7f
jmp 0x2e7f
cmpq $0x0, 0x18(%rbx)
je 0x2e67
leaq 0x65b7(%rip), %rax      # 0x93f3
movq %rax, 0x28(%rsp)
movb $0x1, 0x30(%rsp)
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a54
movq 0x8(%rbx), %rax
movq 0x28(%rbx), %rdi
movl 0x54(%rax), %edx
movl 0x58(%rax), %ecx
addq $0x28, %rdi
movl $0xf, %esi
callq 0x2a5f
movzbl %bpl, %eax
movzwl %ax, %esi
movq %rbx, %rdi
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3bbf