// File: /workspace/github_c_makefile_star2_O3/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 0x2cc99
movq %rax, %r13
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r12
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x36119
movq %r15, 0x10(%rsp)
cmpl $0x0, (%r15)
movq %rax, 0x20(%rsp)
jne 0x26f89
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 0x2cca6
cmpl $0x0, (%r12)
je 0x26fd7
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2b166
movq %r13, %rdi
callq 0x2b166
movq %r15, %rdi
callq 0x2b166
movq %r14, %rdi
callq 0x2b166
movq %rbp, %rdi
callq 0x2b166
movq 0x20(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
movq %r14, 0x18(%rsp)
movq %r15, 0x38(%rsp)
movq %rbp, 0x28(%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
movq %r12, %rsi
callq 0x2b7af
movq %rax, %rbp
cmpl $0x0, (%r12)
jne 0x26f8e
movl $0x1, %edi
movq %r12, %rsi
callq 0x2b7af
movq %rax, %r15
cmpl $0x0, (%r12)
jne 0x26f8e
movl $0x20, %edi
movq %r12, %rsi
callq 0x2b7af
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
je 0x27039
xorl %r12d, %r12d
xorl %r14d, %r14d
jmp 0x27051
movq %rbx, %rdi
movq %r12, %rsi
callq 0x36182
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x2705b
xorl %r12d, %r12d
movq 0x8(%rsp), %r13
jmp 0x26f97
movq %r13, 0x30(%rsp)
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x37164
movq %r12, %rcx
movq %rax, %r12
cmpl $0x0, (%rcx)
jne 0x27188
movq 0x48(%r13), %rdi
movq 0x148(%r12), %rdx
movl $0x43, %esi
movq 0x28(%rsp), %rcx
movq 0x40(%rsp), %rbx
movq %rbx, %r8
movq 0x10(%rsp), %r14
movq %r14, %r9
callq 0x2bd42
cmpl $0x0, (%r14)
jne 0x27188
movq 0x48(%r13), %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x27188
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2670b
cmpl $0x0, (%rbx)
jne 0x27188
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x36de4
movq %rax, 0x20(%rsp)
cmpl $0x0, (%rbx)
jne 0x27185
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x148(%rax), %rcx
movl $0x1d, %esi
movq 0x38(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %r8
callq 0x2be2c
cmpl $0x0, (%rbx)
jne 0x27185
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x45, %esi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x27185
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x2cca6
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x27034
nop