// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]lair/src/lair_std.c
// Function: lair_builtin_operator_eq
const struct _lair_type *_lair_builtin_operator_eq(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 compare disparate types.");

	const LAIR_TOKEN first_arg_type = argv[0]->type;
	switch (first_arg_type) {
		case LR_BOOL:
			if (argv[0]->value.bool == argv[1]->value.bool)
				return _lair_canonical_true();
			return _lair_canonical_false();
		case LR_NUM:
			if (argv[0]->value.num == argv[1]->value.num)
				return _lair_canonical_true();
			return _lair_canonical_false();
		case LR_STRING: {
			const char *str0 = argv[0]->value.str;
			const char *str1 = argv[1]->value.str;
			const size_t str_siz = strlen(str0) + strlen(str1);
			if (strncmp(str0, str1, str_siz) == 0)
				return _lair_canonical_true();
			return _lair_canonical_false();
		}
		default:
			throw_exception(r, ERR_RUNTIME, "Don't know how to compare these two 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 0x43a3(%rip), %rcx      # 0x61ed
movl $0x2, %edx
movl %edx, -0x48(%rbp)
callq 0x1830
movl -0x48(%rbp), %edx
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
testq %rax, %rax
setne %al
movzbl %al, %esi
leaq 0x43a7(%rip), %rcx      # 0x621c
movq %rcx, -0x50(%rbp)
callq 0x1830
movq -0x50(%rbp), %rcx
movl -0x48(%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 -0x48(%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 0x437b(%rip), %rcx      # 0x623f
callq 0x1830
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x44(%rbp)
subl $0xa, %eax
je 0x1f6f
jmp 0x1ee6
movl -0x44(%rbp), %eax
subl $0xd, %eax
je 0x1efd
jmp 0x1ef0
movl -0x44(%rbp), %eax
subl $0xf, %eax
je 0x1f38
jmp 0x1fe2
movq -0x20(%rbp), %rax
movq (%rax), %rax
movzbl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movzbl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x1f28
movb $0x0, %al
callq 0x24c0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movb $0x0, %al
callq 0x24b0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1f5f
movb $0x0, %al
callq 0x24c0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movb $0x0, %al
callq 0x24b0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1060
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1060
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x1050
cmpl $0x0, %eax
jne 0x1fd5
movb $0x0, %al
callq 0x24c0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movb $0x0, %al
callq 0x24b0
movq %rax, -0x8(%rbp)
jmp 0x1fff
movq -0x10(%rbp), %rdi
movl $0x2, %esi
leaq 0x426d(%rip), %rdx      # 0x625f
callq 0x1870
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)