// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]lair/src/lair_std.c
// Function: lair_builtin_operator_minus
const struct _lair_type *_lair_builtin_operator_minus(LAIR_FUNCTION_SIG) {
	check(r, argc == 2, ERR_RUNTIME, "Incorrect number of arguments to `-` function.");
	check(r, argv[0] != NULL, ERR_RUNTIME, "Argument to `-` function was NULL.");
	check(r, argv[1] != NULL, ERR_RUNTIME, "Argument to `-` function was NULL.");
	check(r, argv[0]->type == argv[1]->type, ERR_RUNTIME, "Cannot add variables of different types together.");
	check(r, argv[0]->type != LR_STRING, ERR_RUNTIME, "Cannot subtract strings");
	check(r, argv[1]->type != LR_STRING, ERR_RUNTIME, "Cannot subtract strings");

	/* We already know (probably) that the types are the same. */
	const LAIR_TOKEN first_arg_type = argv[0]->type;
	switch (first_arg_type) {
		/* Integer addition. */
		case LR_NUM: {
			struct _lair_type _stack = {
				.type = LR_NUM,
				.value = {
					.num = argv[0]->value.num - argv[1]->value.num
				}
			};
			struct _lair_type *to_return = calloc(1, sizeof(struct _lair_type));
			memcpy(to_return, &_stack, sizeof(struct _lair_type));
			return to_return;
		}
		default:
			throw_exception(r, ERR_RUNTIME, "Don't know how to subtract these things.");
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
subl $0x2, %eax
sete %al
movzbl %al, %esi
leaq 0x44a0(%rip), %rcx      # 0x615a
movl $0x2, %edx
movl %edx, -0x4c(%rbp)
callq 0x1830
movl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
testq %rax, %rax
setne %al
movzbl %al, %esi
leaq 0x44a4(%rip), %rcx      # 0x6189
movq %rcx, -0x58(%rbp)
callq 0x1830
movq -0x58(%rbp), %rcx
movl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
setne %al
movzbl %al, %esi
callq 0x1830
movl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movl (%rax), %eax
movl (%rcx), %ecx
subl %ecx, %eax
sete %al
movzbl %al, %esi
leaq 0x43c7(%rip), %rcx      # 0x60fb
callq 0x1830
movl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
subl $0xa, %eax
setne %al
movzbl %al, %esi
leaq 0x4453(%rip), %rcx      # 0x61ac
movq %rcx, -0x48(%rbp)
callq 0x1830
movl -0x4c(%rbp), %edx
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
subl $0xa, %eax
setne %al
movzbl %al, %esi
callq 0x1830
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
subl $0xf, %eax
jne 0x1dea
jmp 0x1d9b
movl $0xf, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x30(%rbp)
movl $0x1, %edi
movl $0x10, %esi
callq 0x1110
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1e07
movq -0x10(%rbp), %rdi
movl $0x2, %esi
leaq 0x43ca(%rip), %rdx      # 0x61c4
callq 0x1870
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)