// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_loops.c
// Function: prv_range_compound
static void prv_range_compound(subtilis_parser_t *p, subtilis_token_t *t,
			       subtilis_exp_t *e, size_t var_count,
			       bool new_locals,
			       subtilis_range_var_t *range_vars,
			       subtilis_error_t *err)
{
	subtilis_ir_operand_t var_reg;
	subtilis_ir_operand_t start_label;
	subtilis_ir_operand_t end_label;
	subtilis_ir_operand_t ptr;
	size_t i;
	unsigned int start;

	/*
	 * If they're global variables we need to create them at
	 * the top level, assuming we're at the top level of the
	 * main function. If we're declaring local variables,
	 * let's declare them one level down.  If we're just
	 * using existing local variables then we can do that here.
	 */

	if (!new_locals) {
		if (range_vars[0].name)
			prv_init_range_var(p, t, &range_vars[0].for_ctx,
					   range_vars[0].name,
					   &range_vars[0].type, err);

		else
			prv_init_tilde_var(&range_vars[0].for_ctx,
					   &range_vars[0].type, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		for (i = 1; i < var_count; i++) {
			prv_init_range_var(p, t, &range_vars[i].for_ctx,
					   range_vars[i].name,
					   &range_vars[i].type, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return;
		}
	}

	p->level++;

	subtilis_symbol_table_level_up(p->local_st, p->l, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (new_locals) {
		if (range_vars[0].name)
			prv_init_local_range_var(p, t, &range_vars[0].for_ctx,
						 range_vars[0].name,
						 &range_vars[0].type, err);
		else
			prv_init_tilde_var(&range_vars[0].for_ctx,
					   &range_vars[0].type, err);
		for (i = 1; i < var_count; i++) {
			prv_init_local_range_var(p, t, &range_vars[i].for_ctx,
						 range_vars[i].name,
						 &range_vars[i].type, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return;
		}
	}

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

	if (var_count == 1)
		ptr.reg = prv_range_loop_start(p, e, range_vars, start_label,
					       end_label, new_locals, err);
	else
		ptr.reg = prv_range_loop_start_index(
		    p, e, var_count, range_vars, new_locals, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	start = p->l->line;
	while (t->type != SUBTILIS_TOKEN_EOF) {
		if ((t->type == SUBTILIS_TOKEN_KEYWORD) &&
		    (t->tok.keyword.type == SUBTILIS_KEYWORD_ENDRANGE))
			break;
		subtilis_parser_statement(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}

	if (t->type == SUBTILIS_TOKEN_EOF) {
		subtilis_error_set_compund_not_term(err, p->l->stream->name,
						    start);
		return;
	}

	var_reg.reg = SUBTILIS_IR_REG_LOCAL;
	subtilis_reference_deallocate_refs(p, var_reg, p->local_st, p->level,
					   err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (var_count == 1)
		prv_range_loop_end(p, range_vars, ptr, start_label, end_label,
				   err);
	else
		prv_range_loop_end_index(p, var_count, range_vars, ptr, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	p->level--;
	subtilis_symbol_table_level_down(p->local_st, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	p->current->handler_list =
	    subtilis_handler_list_truncate(p->current->handler_list, p->level);

	subtilis_lexer_get(p->l, t, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %r8b, %al
movq 0x10(%rbp), %r8
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq %r9, -0x30(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x2aa11
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2a969
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $0x150, %rdx            # imm = 0x150
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %r8
addq $0x8, %r8
movq 0x10(%rbp), %r9
callq 0x2bc50
jmp 0x2a985
movq -0x30(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq -0x30(%rbp), %rsi
addq $0x8, %rsi
movq 0x10(%rbp), %rdx
callq 0x2bea0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2a993
jmp 0x2ad1e
movq $0x1, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x2aa0f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
imulq $0x2c8, -0x58(%rbp), %rax # imm = 0x2C8
addq %rax, %rdx
addq $0x150, %rdx            # imm = 0x150
movq -0x30(%rbp), %rax
imulq $0x2c8, -0x58(%rbp), %rcx # imm = 0x2C8
addq %rcx, %rax
movq (%rax), %rcx
movq -0x30(%rbp), %r8
imulq $0x2c8, -0x58(%rbp), %rax # imm = 0x2C8
addq %rax, %r8
addq $0x8, %r8
movq 0x10(%rbp), %r9
callq 0x2bc50
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2a9ff
jmp 0x2ad1e
jmp 0x2aa01
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2a99b
jmp 0x2aa11
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq 0x10(%rbp), %rdx
callq 0x3c320
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2aa47
jmp 0x2ad1e
testb $0x1, -0x21(%rbp)
je 0x2ab22
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2aa88
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $0x150, %rdx            # imm = 0x150
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %r8
addq $0x8, %r8
movq 0x10(%rbp), %r9
callq 0x2bf00
jmp 0x2aaa4
movq -0x30(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq -0x30(%rbp), %rsi
addq $0x8, %rsi
movq 0x10(%rbp), %rdx
callq 0x2bea0
movq $0x1, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x2ab20
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
imulq $0x2c8, -0x58(%rbp), %rax # imm = 0x2C8
addq %rax, %rdx
addq $0x150, %rdx            # imm = 0x150
movq -0x30(%rbp), %rax
imulq $0x2c8, -0x58(%rbp), %rcx # imm = 0x2C8
addq %rcx, %rax
movq (%rax), %rcx
movq -0x30(%rbp), %r8
imulq $0x2c8, -0x58(%rbp), %rax # imm = 0x2C8
addq %rax, %r8
addq $0x8, %r8
movq 0x10(%rbp), %r9
callq 0x2bf00
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ab10
jmp 0x2ad1e
jmp 0x2ab12
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2aaac
jmp 0x2ab22
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x48(%rbp)
cmpq $0x1, -0x20(%rbp)
jne 0x2ab7e
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
movb -0x21(%rbp), %r9b
movq 0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
andb $0x1, %r9b
movzbl %r9b, %r9d
movq %rax, (%rsp)
callq 0x2c120
movq %rax, -0x50(%rbp)
jmp 0x2aba4
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movb -0x21(%rbp), %al
movq 0x10(%rbp), %r9
andb $0x1, %al
movzbl %al, %r8d
callq 0x2c330
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2abb2
jmp 0x2ad1e
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2abfe
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2abdd
movq -0x10(%rbp), %rax
cmpl $0x29, 0x8(%rax)
jne 0x2abdd
jmp 0x2abfe
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x16bb0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2abfc
jmp 0x2ad1e
jmp 0x2abbf
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x2ac35
movq 0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdx
movl -0x5c(%rbp), %ecx
movl $0x1e, %esi
leaq 0x7fd85(%rip), %r8      # 0xaa9aa
movl $0x701, %r9d            # imm = 0x701
callq 0x15930
jmp 0x2ad1e
movq $0x2, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rcx
movq 0x10(%rbp), %r8
movq -0x38(%rbp), %rsi
callq 0x6f4e0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ac6c
jmp 0x2ad1e
cmpq $0x1, -0x20(%rbp)
jne 0x2ac92
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq 0x10(%rbp), %r9
movq -0x50(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
callq 0x2c820
jmp 0x2acab
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %r8
movq -0x50(%rbp), %rcx
callq 0x2c8e0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2acb6
jmp 0x2ad1e
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq 0x10(%rbp), %rsi
callq 0x3c390
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ace2
jmp 0x2ad1e
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x78(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x37f70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x133f0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)