// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/string_type.c
// Function: prv_left_right_non_const
static size_t prv_left_right_non_const(subtilis_parser_t *p, size_t str_reg,
				       size_t arg2_reg, bool arg2_const,
				       subtilis_ir_operand_t partial,
				       subtilis_error_t *err)
{
	subtilis_ir_operand_t less_zero;
	subtilis_ir_operand_t gt_len;
	subtilis_ir_operand_t str_len_zero;
	subtilis_ir_operand_t condee;
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t full_string;
	size_t len_reg;

	op0.reg = str_reg;
	op1.integer = SUBTIILIS_STRING_SIZE_OFF;
	len_reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, op0, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	full_string.label = subtilis_ir_section_new_label(p->current);

	if (!arg2_const) {
		op0.reg = arg2_reg;
		op1.integer = 0;
		less_zero.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_LTI_I32, op0, op1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;

		op0.reg = arg2_reg;
		op1.reg = len_reg;
		gt_len.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_GTE_I32, op0, op1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;

		condee.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_OR_I32, less_zero, gt_len,
		    err);
	} else {
		op0.reg = arg2_reg;
		op1.reg = len_reg;
		condee.reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_GTE_I32, op0, op1, err);
	}
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	op0.reg = len_reg;
	op1.integer = 0;
	str_len_zero.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_EQI_I32, op0, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_OR_I32, condee, str_len_zero, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  condee, full_string, partial, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	subtilis_ir_section_add_label(p->current, full_string.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	return len_reg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r15
movl %ecx, %r13d
movq %rdx, %rbp
movq %rsi, %rdx
movq %rdi, %r12
movq 0x48(%rdi), %rdi
movl $0x12, %esi
xorl %ecx, %ecx
movq %r9, %r8
callq 0x2bc8f
movq $-0x1, %r14
cmpl $0x0, (%rbx)
je 0x4c1b3
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, 0x8(%rsp)
movq 0x48(%r12), %rdi
callq 0x2cc99
movq %rax, 0x10(%rsp)
movq 0x48(%r12), %rdi
testb %r13b, %r13b
je 0x4c28b
movl $0x3f, %esi
movq %rbp, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
callq 0x2bc8f
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq %r15, %r13
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movq 0x8(%rsp), %rdx
andq %rdx, %rcx
movq 0x48(%r12), %rdi
movl $0x2d, %esi
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq 0x48(%r12), %rdi
movl $0x26, %esi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq 0x48(%r12), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq 0x10(%rsp), %r15
movq %r15, %rcx
movq %r13, %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq 0x48(%r12), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2cca6
xorl %r14d, %r14d
cmpl (%rbx), %r14d
sbbq %r14, %r14
orq 0x8(%rsp), %r14
jmp 0x4c1a1
movl $0x3d, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq %rax, %r13
movq 0x48(%r12), %rdi
movl $0x3f, %esi
movq %rbp, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x4c1a1
movq 0x48(%r12), %rdi
movl $0x26, %esi
movq %r13, %rdx
movq %rax, %rcx
jmp 0x4c1e2