// File: /workspace/github_c_makefile_star2_O2/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, %r12
movl %ecx, %r13d
movq %rdx, %rbp
movq %rsi, %rdx
movq %rdi, %r15
movq 0x48(%rdi), %rdi
pushq $0x12
popq %rsi
xorl %ecx, %ecx
movq %r9, %r8
callq 0x2a819
pushq $-0x1
popq %r14
cmpl $0x0, (%rbx)
je 0x4968b
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(%r15), %rdi
callq 0x2b774
movq %rax, 0x10(%rsp)
movq 0x48(%r15), %rdi
testb %r13b, %r13b
je 0x49755
pushq $0x3f
popq %rsi
movq %rbp, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
callq 0x2a819
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x49679
movq %r12, %r13
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movq 0x8(%rsp), %rdx
andq %rdx, %rcx
movq 0x48(%r15), %rdi
pushq $0x2d
popq %rsi
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x49679
movq 0x48(%r15), %rdi
pushq $0x26
popq %rsi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x49679
movq 0x48(%r15), %rdi
pushq $0x43
popq %rsi
movq %rax, %rdx
movq 0x10(%rsp), %r12
movq %r12, %rcx
movq %r13, %r8
movq %rbx, %r9
callq 0x2a8c1
cmpl $0x0, (%rbx)
jne 0x49679
movq 0x48(%r15), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2b781
xorl %r14d, %r14d
cmpl (%rbx), %r14d
sbbq %r14, %r14
orq 0x8(%rsp), %r14
jmp 0x49679
pushq $0x3d
popq %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x49679
movq %rax, %r13
movq 0x48(%r15), %rdi
pushq $0x3f
popq %rsi
movq %rbp, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x49679
movq 0x48(%r15), %rdi
pushq $0x26
popq %rsi
movq %r13, %rdx
movq %rax, %rcx
jmp 0x496b6