// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1f54
movq -0x8(%rbp), %rdi
leaq 0xc221(%rip), %rsi      # 0xe16e
callq 0x2db0
jmp 0x1f74
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x1, 0x28(%rax)
jne 0x1f72
movq -0x8(%rbp), %rdi
leaq 0xc224(%rip), %rsi      # 0xe191
callq 0x2db0
jmp 0x1f74
movq -0x8(%rbp), %rdi
movl $0x7, %esi
callq 0x2c40
testb $0x1, %al
jne 0x1f8b
jmp 0x205f
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
leaq 0xc21a(%rip), %rdx      # 0xe1bf
callq 0x2fc0
movq -0x90(%rbp), %rdi
leaq -0x30(%rbp), %rax
xorl %esi, %esi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x2ee0
movq -0x8(%rbp), %rdi
callq 0x3000
movb %al, -0x31(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3090
movq -0x8(%rbp), %rdi
movl $0x14, %esi
movzbl -0x31(%rbp), %edx
callq 0x3100
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x3, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq 0xc194(%rip), %rsi      # 0xe1c1
movl $0x6, %edx
callq 0x75a0
movq -0x88(%rbp), %rdi
movq %rax, -0x40(%rbp)
movl -0x48(%rbp), %esi
movq -0x40(%rbp), %rdx
callq 0x3190
movq -0x80(%rbp), %rdi
movzwl %ax, %esi
callq 0x3140
jmp 0x2153
movq -0x8(%rbp), %rdi
movl $0x19, %esi
leaq 0xc159(%rip), %rdx      # 0xe1c8
callq 0x3200
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x20, %rsi
callq 0x3250
movb %al, -0x49(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
leaq 0xc119(%rip), %rdx      # 0xe1bf
callq 0x2fc0
movq -0x98(%rbp), %rdi
leaq -0x70(%rbp), %rax
xorl %esi, %esi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x2ee0
movq -0x8(%rbp), %rdi
movl $0x7, %esi
callq 0x2c40
testb $0x1, %al
jne 0x20f3
jmp 0x212c
movq -0x8(%rbp), %rdi
callq 0x3000
movb %al, -0x71(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3090
movq -0x8(%rbp), %rdi
movl $0x14, %esi
movzbl -0x71(%rbp), %edx
callq 0x3100
movq -0x8(%rbp), %rdi
movzbl -0x49(%rbp), %eax
movzwl %ax, %esi
callq 0x3140
jmp 0x2153
movq -0x8(%rbp), %rdi
callq 0x3090
movq -0x8(%rbp), %rdi
movl $0xf, %esi
callq 0x32b0
movq -0x8(%rbp), %rdi
movzbl -0x49(%rbp), %eax
movzwl %ax, %esi
callq 0x3140
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)