// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/string_type_if.c
// Function: prv_eq_non_const_const
static subtilis_exp_t *prv_eq_non_const_const(subtilis_parser_t *p,
					      subtilis_exp_t *a1,
					      subtilis_exp_t *a2,
					      subtilis_error_t *err)
{
	size_t const_ptr;
	subtilis_ir_operand_t len_eq;
	subtilis_ir_operand_t len_neq;
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op2;
	size_t a2_len;
	size_t a1_ptr;
	size_t dest_reg = p->current->reg_counter++;
	subtilis_exp_t *len1 = NULL;
	subtilis_exp_t *eq = NULL;

	len_eq.label = subtilis_ir_section_new_label(p->current);
	len_neq.label = subtilis_ir_section_new_label(p->current);

	len1 = subtilis_type_if_dup(a1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	len1 = subtilis_string_type_len(p, len1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	op0.reg = dest_reg;
	a2_len = subtilis_buffer_get_size(&a2->exp.str) - 1;
	op2.integer = (int32_t)a2_len;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_EQI_I32,
					  op0, len1->exp.ir_op, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC_NF,
					  op0, len_eq, len_neq, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	subtilis_ir_section_add_label(p->current, len_eq.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	const_ptr = subtilis_string_type_lca_const(
	    p, subtilis_buffer_get_string(&a2->exp.str), op2.integer, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	a1_ptr = subtilis_reference_get_data(p, a1->exp.ir_op.reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (a2_len == 1)
		eq = prv_compare_fixed_len(p, a1_ptr, const_ptr,
					   SUBTILIS_OP_INSTR_LOADO_I8,
					   SUBTILIS_OP_INSTR_EQ_I32, err);
	else if (a2_len == 4)
		eq = prv_compare_fixed_len(p, a1_ptr, const_ptr,
					   SUBTILIS_OP_INSTR_LOADO_I32,
					   SUBTILIS_OP_INSTR_EQ_I32, err);
	else
		eq = subtilis_string_type_eq(p, a1_ptr, const_ptr,
					     len1->exp.ir_op.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_reg2(p->current, SUBTILIS_OP_INSTR_MOV,
					      op0, eq->exp.ir_op, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, len_neq.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	a1->exp.ir_op.reg = dest_reg;
	a1->type.type = SUBTILIS_TYPE_INTEGER;

	subtilis_exp_delete(eq);
	subtilis_exp_delete(len1);
	subtilis_exp_delete(a2);
	return a1;

cleanup:

	subtilis_exp_delete(eq);
	subtilis_exp_delete(len1);
	subtilis_exp_delete(a1);
	subtilis_exp_delete(a2);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rcx)
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x47d20
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64aa7
jmp 0x64d03
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x67350
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64aca
jmp 0x64d03
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16270
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x70(%rbp), %rax
movq -0x28(%rbp), %r9
movq -0x48(%rbp), %rdx
movq 0x148(%rax), %rcx
movq -0x50(%rbp), %r8
movl $0x2d, %esi
callq 0x38360
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64b28
jmp 0x64d03
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %r9
movq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movl $0x44, %esi
callq 0x38360
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64b58
jmp 0x64d03
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64b7b
jmp 0x64d03
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x16760
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movslq -0x50(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x65d80
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64bb9
jmp 0x64d03
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x148(%rax), %rsi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x6d1e0
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64be7
jmp 0x64d03
cmpq $0x1, -0x58(%rbp)
jne 0x64c14
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %r9
movl $0x11, %ecx
movl $0x2b, %r8d
callq 0x650f0
movq %rax, -0x78(%rbp)
jmp 0x64c67
cmpq $0x4, -0x58(%rbp)
jne 0x64c41
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %r9
movl $0x12, %ecx
movl $0x2b, %r8d
callq 0x650f0
movq %rax, -0x78(%rbp)
jmp 0x64c65
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x70(%rbp), %rax
movq 0x148(%rax), %rcx
movq -0x28(%rbp), %r8
callq 0x67990
movq %rax, -0x78(%rbp)
jmp 0x64c67
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64c75
jmp 0x64d03
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x78(%rbp), %rax
movq -0x28(%rbp), %r8
movq -0x48(%rbp), %rdx
movq 0x148(%rax), %rcx
movl $0x1d, %esi
callq 0x385a0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64ca5
jmp 0x64d03
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x39960
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x64cc5
jmp 0x64d03
movq -0x68(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
movq -0x78(%rbp), %rdi
callq 0x36ee0
movq -0x70(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x64d2f
movq -0x78(%rbp), %rdi
callq 0x36ee0
movq -0x70(%rbp), %rdi
callq 0x36ee0
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)