// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_loops.c
// Function: prv_for_step_int_var
static void prv_for_step_int_var(subtilis_parser_t *p, subtilis_token_t *t,
				 subtilis_exp_t *to, subtilis_exp_t *step,
				 const subtilis_for_context_t *for_ctx,
				 subtilis_error_t *err)
{
	subtilis_ir_operand_t start_label;
	subtilis_ir_operand_t true_label;
	subtilis_ir_operand_t final_label;
	subtilis_type_t step_type_const;
	subtilis_exp_t *step_dir = NULL;
	subtilis_exp_t *step_dup = NULL;
	subtilis_exp_t *conde = NULL;
	subtilis_exp_t *var = NULL;
	subtilis_exp_t *eor_var = NULL;
	subtilis_exp_t *eor_var_dup = NULL;
	subtilis_exp_t *zero = NULL;
	subtilis_exp_t *sub = NULL;

	step_type_const.type = SUBTILIS_TYPE_VOID;

	/*
	 * TODO: Add a runtime check for step variable of 0.
	 * and generate an error.
	 */

	step = subtilis_type_if_coerce_type(p, step, &for_ctx->type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	step_dup = subtilis_type_if_dup(step, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_type_if_const_of(&step->type, &step_type_const, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	step_dir = subtilis_type_if_top_bit(p, &step_type_const, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	step_dir = subtilis_type_if_and(p, step_dup, step_dir, err);
	step_dup = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_for_loop_start(p, t, &start_label, &true_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	var = prv_increment_var(p, step, for_ctx, err);
	step = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (!subtilis_type_if_is_integer(&var->type)) {
		subtilis_error_set_assertion_failed(err);
		goto cleanup;
	}

	sub = subtilis_type_if_sub(p, to, var, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	var = NULL;
	to = NULL;

	step_dup = subtilis_type_if_dup(step_dir, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	eor_var = subtilis_type_if_eor(p, sub, step_dup, err);
	step_dup = NULL;
	sub = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	eor_var_dup = subtilis_type_if_dup(eor_var, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	zero = subtilis_type_if_zero(p, &step_type_const, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	conde = subtilis_exp_lt(p, eor_var, zero, err);
	eor_var = NULL;

	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  conde->exp.ir_op, true_label,
					  start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_exp_delete(conde);
	conde = subtilis_type_if_neq(p, eor_var_dup, step_dir, err);
	eor_var_dup = NULL;
	step_dir = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	final_label.reg = subtilis_ir_section_new_label(p->current);
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  conde->exp.ir_op, final_label,
					  start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, final_label.reg, err);

cleanup:

	subtilis_exp_delete(sub);
	subtilis_exp_delete(eor_var_dup);
	subtilis_exp_delete(eor_var);
	subtilis_exp_delete(conde);
	subtilis_exp_delete(var);
	subtilis_exp_delete(to);
	subtilis_exp_delete(step_dir);
	subtilis_exp_delete(step_dup);
	subtilis_exp_delete(step);
	subtilis_type_free(&step_type_const);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x198(%rbp)
movq $0x0, -0x1a0(%rbp)
movq $0x0, -0x1a8(%rbp)
movq $0x0, -0x1b0(%rbp)
movq $0x0, -0x1b8(%rbp)
movq $0x0, -0x1c0(%rbp)
movq $0x0, -0x1c8(%rbp)
movq $0x0, -0x1d0(%rbp)
movl $0x8, -0x190(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x18, %rdx
movq -0x30(%rbp), %rcx
callq 0x4a2e0
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29490
jmp 0x297fd
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x47d20
movq %rax, -0x1a0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x294b2
jmp 0x297fd
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq -0x190(%rbp), %rsi
callq 0x47ae0
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x294d4
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq -0x190(%rbp), %rsi
callq 0x478c0
movq %rax, -0x198(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x294fd
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x198(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x49090
movq %rax, -0x198(%rbp)
movq $0x0, -0x1a0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29538
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %r8
leaq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x2b5e0
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2955f
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x2b690
movq %rax, -0x1b0(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29591
jmp 0x297fd
movq -0x1b0(%rbp), %rdi
callq 0x499a0
testb $0x1, %al
jne 0x295c0
movq -0x30(%rbp), %rdi
movl $0xf, %esi
leaq 0x813f9(%rip), %rdx     # 0xaa9aa
movl $0x298, %ecx            # imm = 0x298
callq 0x158e0
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x1b0(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x492c0
movq %rax, -0x1d0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x295ed
jmp 0x297fd
movq $0x0, -0x1b0(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x198(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x47d20
movq %rax, -0x1a0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29625
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x49150
movq %rax, -0x1b8(%rbp)
movq $0x0, -0x1a0(%rbp)
movq $0x0, -0x1d0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2966b
jmp 0x297fd
movq -0x1b8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x47d20
movq %rax, -0x1c0(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29690
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq -0x190(%rbp), %rsi
callq 0x47580
movq %rax, -0x1c8(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x296b9
jmp 0x297fd
movq -0x8(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq -0x1c8(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x37c90
movq %rax, -0x1a8(%rbp)
movq $0x0, -0x1b8(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x296f4
jmp 0x297fd
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x1a8(%rbp), %rax
movq -0x30(%rbp), %r9
movq 0x148(%rax), %rdx
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2972e
jmp 0x297fd
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x39960
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x29751
jmp 0x297fd
movq -0x1a8(%rbp), %rdi
callq 0x36ee0
movq -0x8(%rbp), %rdi
movq -0x1c0(%rbp), %rsi
movq -0x198(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x49260
movq %rax, -0x1a8(%rbp)
movq $0x0, -0x1c0(%rbp)
movq $0x0, -0x198(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x297a0
jmp 0x297fd
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x1a8(%rbp), %rax
movq -0x30(%rbp), %r9
movq 0x148(%rax), %rdx
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x297e8
jmp 0x297fd
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x39960
movq -0x1d0(%rbp), %rdi
callq 0x36ee0
movq -0x1c0(%rbp), %rdi
callq 0x36ee0
movq -0x1b8(%rbp), %rdi
callq 0x36ee0
movq -0x1a8(%rbp), %rdi
callq 0x36ee0
movq -0x1b0(%rbp), %rdi
callq 0x36ee0
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x198(%rbp), %rdi
callq 0x36ee0
movq -0x1a0(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
leaq -0x190(%rbp), %rdi
callq 0x3e100
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopl (%rax,%rax)