// File: /workspace/github_c_makefile_star2_O1/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 0x2d00a
movq %rax, %r13
movq 0x48(%r14), %rdi
callq 0x2d00a
movq %rax, %r12
movq 0x48(%r14), %rdi
callq 0x2d00a
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x36269
movq %r15, 0x10(%rsp)
cmpl $0x0, (%r15)
movq %rax, 0x20(%rsp)
jne 0x27134
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 0x2d017
cmpl $0x0, (%r12)
je 0x27182
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2b4c3
movq %r13, %rdi
callq 0x2b4c3
movq %r15, %rdi
callq 0x2b4c3
movq %r14, %rdi
callq 0x2b4c3
movq %rbp, %rdi
callq 0x2b4c3
movq 0x20(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b4c3
movq %r14, 0x18(%rsp)
movq %r15, 0x38(%rsp)
movq %rbp, 0x28(%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
movq %r12, %rsi
callq 0x2bb29
movq %rax, %rbp
cmpl $0x0, (%r12)
jne 0x27139
movl $0x1, %edi
movq %r12, %rsi
callq 0x2bb29
movq %rax, %r15
cmpl $0x0, (%r12)
jne 0x27139
movl $0x20, %edi
movq %r12, %rsi
callq 0x2bb29
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
je 0x271e4
xorl %r12d, %r12d
xorl %r14d, %r14d
jmp 0x271fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x362d2
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x27206
xorl %r12d, %r12d
movq 0x8(%rsp), %r13
jmp 0x27142
movq %r13, 0x30(%rsp)
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x372a2
movq %r12, %rcx
movq %rax, %r12
cmpl $0x0, (%rcx)
jne 0x27333
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 0x2c0c2
cmpl $0x0, (%r14)
jne 0x27333
movq 0x48(%r13), %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x2d017
cmpl $0x0, (%rbx)
jne 0x27333
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0x268a1
cmpl $0x0, (%rbx)
jne 0x27333
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x36f23
movq %rax, 0x20(%rsp)
cmpl $0x0, (%rbx)
jne 0x27330
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 0x2c1ac
cmpl $0x0, (%rbx)
jne 0x27330
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x45, %esi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x2c19f
cmpl $0x0, (%rbx)
jne 0x27330
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x2d017
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x271df
nop