// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/parser_output.c
// Function: prv_spc
static void prv_spc(subtilis_parser_t *p, subtilis_exp_t *e,
		    subtilis_error_t *err)
{
	subtilis_ir_operand_t start_label;
	subtilis_ir_operand_t end_label;
	subtilis_ir_operand_t next_label;
	subtilis_ir_operand_t counter_reg;
	subtilis_exp_t *one = NULL;
	subtilis_exp_t *zero = NULL;
	subtilis_exp_t *space = NULL;
	subtilis_exp_t *cond = NULL;
	subtilis_exp_t *e_dup = NULL;

	start_label.label = subtilis_ir_section_new_label(p->current);
	next_label.label = subtilis_ir_section_new_label(p->current);
	end_label.label = subtilis_ir_section_new_label(p->current);

	e = subtilis_type_if_exp_to_var(p, e, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	counter_reg = e->exp.ir_op;

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

	zero = subtilis_exp_new_int32(0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	one = subtilis_exp_new_int32(1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	space = subtilis_exp_new_int32(32, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e_dup = subtilis_type_if_dup(e, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	cond = subtilis_type_if_gte(p, zero, e_dup, err);
	zero = NULL;
	e_dup = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  cond->exp.ir_op, end_label,
					  next_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	prv_vdu_byte(p, space, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e = subtilis_type_if_sub(p, e, one, err);
	one = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_JMP,
					     start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, end_label.label, err);

cleanup:

	subtilis_exp_delete(cond);
	subtilis_exp_delete(space);
	subtilis_exp_delete(one);
	subtilis_exp_delete(e_dup);
	subtilis_exp_delete(zero);
	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x48(%rdi), %rdi
callq 0x2b774
movq %rax, %r13
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, %r12
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3415f
movq %r15, 0x10(%rsp)
cmpl $0x0, (%r15)
movq %rax, 0x20(%rsp)
jne 0x25df8
movq %rax, %rbx
movq %r12, 0x40(%rsp)
movq 0x148(%rax), %r15
movq 0x48(%r14), %rdi
movq %r13, %rsi
movq 0x10(%rsp), %r12
movq %r12, %rdx
callq 0x2b781
cmpl $0x0, (%r12)
je 0x25e46
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x29d88
movq %r13, %rdi
callq 0x29d88
movq %r15, %rdi
callq 0x29d88
movq %r14, %rdi
callq 0x29d88
movq %rbp, %rdi
callq 0x29d88
movq 0x20(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x29d88
movq %r14, 0x18(%rsp)
movq %r15, 0x38(%rsp)
movq %rbp, 0x28(%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
movq %r12, %rsi
callq 0x2a369
movq %rax, %rbp
cmpl $0x0, (%r12)
jne 0x25dfd
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0x2a369
movq %rax, %r15
cmpl $0x0, (%r12)
jne 0x25dfd
pushq $0x20
popq %rdi
movq %r12, %rsi
callq 0x2a369
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
je 0x25ea4
xorl %r12d, %r12d
xorl %r14d, %r14d
jmp 0x25ebc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x341c4
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x25ec6
xorl %r12d, %r12d
movq 0x8(%rsp), %r13
jmp 0x25e06
movq %r13, 0x30(%rsp)
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x35259
movq %r12, %rcx
movq %rax, %r12
cmpl $0x0, (%rcx)
jne 0x25fed
movq 0x48(%r13), %rdi
movq 0x148(%r12), %rdx
pushq $0x43
popq %rsi
movq 0x28(%rsp), %rcx
movq 0x40(%rsp), %rbx
movq %rbx, %r8
movq 0x10(%rsp), %r14
movq %r14, %r9
callq 0x2a8c1
cmpl $0x0, (%r14)
jne 0x25fed
movq 0x48(%r13), %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
jne 0x25fed
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x255fa
cmpl $0x0, (%rbx)
jne 0x25fed
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x34e98
movq %rax, 0x20(%rsp)
cmpl $0x0, (%rbx)
jne 0x25fea
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x148(%rax), %rcx
pushq $0x1d
popq %rsi
movq 0x38(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %r8
callq 0x2a9a4
cmpl $0x0, (%rbx)
jne 0x25fea
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
pushq $0x45
popq %rsi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x2a997
cmpl $0x0, (%rbx)
jne 0x25fea
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x2b781
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x25e9f