LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_rec_type.c
// Function: prv_set
static void prv_set(subtilis_parser_t *p, const char *var_name,
		    const subtilis_type_t *type, size_t mem_reg, size_t loc,
		    subtilis_exp_t *e, bool check_size, subtilis_error_t *err)
{
	subtilis_type_t el_type;
	size_t sizee;
	//	size_t ptr;
	subtilis_ir_operand_t gt_zero;
	subtilis_ir_operand_t eq_zero;
	subtilis_ir_operand_t op0;

	eq_zero.label = SIZE_MAX;

	el_type.type = SUBTILIS_TYPE_VOID;
	subtilis_type_if_element_type(p, type, &el_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto free_e;

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

	sizee = subtilis_reference_type_get_size(p, mem_reg, loc, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (check_size) {
		gt_zero.label = subtilis_ir_section_new_label(p->current);
		eq_zero.label = subtilis_ir_section_new_label(p->current);
		op0.reg = sizee;
		subtilis_ir_section_add_instr_reg(p->current,
						  SUBTILIS_OP_INSTR_JMPC, op0,
						  gt_zero, eq_zero, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_ir_section_add_label(p->current, gt_zero.label, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	//	ptr = subtilis_reference_get_data(p, mem_reg, loc, err);
	//	if (err->type != SUBTILIS_ERROR_OK)
	//		goto cleanup;

	subtilis_error_set_assertion_failed(err);
	goto cleanup;

	if (check_size)
		subtilis_ir_section_add_label(p->current, eq_zero.label, err);

cleanup:
	subtilis_type_free(&el_type);

free_e:
	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %r9d, %ebp
movq %r8, %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rdi, %r15
movq 0x180(%rsp), %r14
movq %rsp, %rdx
movl $0x8, (%rdx)
movq %r14, %rcx
callq 0x360be
cmpl $0x0, (%r14)
jne 0x409ea
movq %rsp, %rdx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x37860
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x409e2
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4d8c4
cmpl $0x0, (%r14)
jne 0x409e2
testb %bpl, %bpl
je 0x409c9
movq %rax, %r12
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %r13
movq 0x48(%r15), %rdi
callq 0x2cc99
movq 0x48(%r15), %rdi
movl $0x43, %esi
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
movq %r14, %r9
callq 0x2bd42
cmpl $0x0, (%r14)
jne 0x409e2
movq 0x48(%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2cca6
cmpl $0x0, (%r14)
jne 0x409e2
leaq 0x34db8(%rip), %rdx     # 0x75788
movq %r14, %rdi
movl $0xf, %esi
movl $0xf0, %ecx
callq 0x145a4
movq %rsp, %rdi
callq 0x2f56e
movq %rbx, %rdi
callq 0x2b166
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/fn_type.c
// Function: prv_zero
static subtilis_exp_t *prv_zero(subtilis_parser_t *p,
				const subtilis_type_t *type,
				subtilis_error_t *err)
{
	subtilis_ir_operand_t op1;
	size_t reg_num;
	subtilis_exp_t *e = NULL;
	size_t call_index;

	call_index = prv_generate_zero_fn(p, type->params.fn.ret_val, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;
	op1.label = (int32_t)call_index;
	reg_num = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_GET_PROC_ADDR, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;
	e = subtilis_exp_new_int32_var(reg_num, err);

	return e;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rsi
callq 0x41142
cmpl $0x0, (%rbx)
jne 0x40a3b
movslq %eax, %rdx
movq 0x48(%r14), %rdi
movl $0x9b, %esi
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
je 0x40a45
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl %eax, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2b71f
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/fn_type.c
// Function: prv_zero_reg
static void prv_zero_reg(subtilis_parser_t *p, const subtilis_type_t *type,
			 size_t reg, subtilis_error_t *err)
{
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;
	size_t call_index;

	call_index = prv_generate_zero_fn(p, type->params.fn.ret_val, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	op0.reg = reg;
	op1.label = (int32_t)call_index;
	subtilis_ir_section_add_instr_no_reg2(
	    p->current, SUBTILIS_OP_INSTR_GET_PROC_ADDR, op0, op1, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x8(%rsi), %rsi
movq %rcx, %rdx
callq 0x41142
cmpl $0x0, (%rbx)
je 0x40a7b
popq %rbx
popq %r14
popq %r15
retq
movslq %eax, %rcx
movq 0x48(%r15), %rdi
movl $0x9b, %esi
movq %r14, %rdx
movq %rbx, %r8
popq %rbx
popq %r14
popq %r15
jmp 0x2be2c
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/fn_type.c
// Function: prv_load_from_mem
static subtilis_exp_t *prv_load_from_mem(subtilis_parser_t *p,
					 const subtilis_type_t *type,
					 size_t mem_reg, size_t loc,
					 subtilis_error_t *err)
{
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t op2;
	size_t reg;

	op1.reg = mem_reg;
	op2.integer = (int32_t)loc;
	reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I32, op1, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	return subtilis_exp_new_var(type, reg, err);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rsi, %r14
movq 0x48(%rdi), %rdi
movl %ecx, %ecx
movl $0x12, %esi
callq 0x2bc8f
cmpl $0x0, (%rbx)
je 0x40b94
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2b5fb
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/fn_type.c
// Function: prv_logical
static subtilis_exp_t *prv_logical(subtilis_parser_t *p,
				   subtilis_op_instr_type_t type,
				   subtilis_exp_t *a1, subtilis_exp_t *a2,
				   subtilis_error_t *err)
{
	size_t reg;

	if (!subtilis_type_eq(&a1->type, &a2->type)) {
		subtilis_error_set_fn_type_mismatch(err, p->l->stream->name,
						    p->l->line);
		goto cleanup;
	}

	reg = subtilis_ir_section_add_instr(p->current, type, a1->exp.ir_op,
					    a2->exp.ir_op, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	a1->exp.ir_op.reg = reg;
	subtilis_exp_delete(a2);
	return a1;

cleanup:

	subtilis_exp_delete(a1);
	subtilis_exp_delete(a2);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r12
movq %rdx, %rdi
movq %rcx, %rsi
callq 0x2f0ec
testb %al, %al
je 0x41482
movq 0x48(%r12), %rdi
movq 0x148(%rbx), %rdx
movq 0x148(%r14), %rcx
movl %ebp, %esi
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x414a7
movq %rax, 0x148(%rbx)
movq %r14, %rdi
callq 0x2b166
jmp 0x414b9
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x34494(%rip), %r8      # 0x75928
movq %r15, %rdi
movl $0x42, %esi
movl $0x149, %r9d            # imm = 0x149
callq 0x145c8
movq %rbx, %rdi
callq 0x2b166
movq %r14, %rdi
callq 0x2b166
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_create_1el
void subtilis_array_create_1el(subtilis_parser_t *p,
			       const subtilis_type_t *type, size_t mem_reg,
			       size_t loc, bool push, subtilis_error_t *err)
{
	subtilis_type_t const_type;
	size_t i;
	subtilis_exp_t **ee;
	subtilis_ir_operand_t store_reg;

	store_reg.reg = mem_reg;
	subtilis_type_init_copy(&const_type, type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	ee = malloc(sizeof(*ee) * const_type.params.array.num_dims);
	if (!ee) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}

	for (i = 0; i < const_type.params.array.num_dims; i++) {
		const_type.params.array.dims[i] = 1;
		ee[i] = subtilis_exp_new_int32(1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	subtilis_array_type_allocate(p, "temporary array", &const_type, loc, ee,
				     store_reg, push, err);
cleanup:
	for (i = 0; i < const_type.params.array.num_dims; i++)
		free(ee[i]);
	free(ee);

	subtilis_type_free(&const_type);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %r9, %r14
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %rbx
movq %rdi, %r13
leaq 0x10(%rsp), %rdi
movq %r9, %rdx
callq 0x2f457
cmpl $0x0, (%r14)
jne 0x415ee
movq %rbx, 0x8(%rsp)
movslq 0x18(%rsp), %r15
leaq (,%r15,8), %rdi
callq 0x121d0
movq %rax, %rbx
testq %rax, %rax
je 0x415a3
testl %r15d, %r15d
je 0x41577
xorl %r15d, %r15d
movl $0x1, 0x1c(%rsp,%r15,4)
movl $0x1, %edi
movq %r14, %rsi
callq 0x2b7af
movq %rax, (%rbx,%r15,8)
cmpl $0x0, (%r14)
jne 0x415bc
incq %r15
movslq 0x18(%rsp), %rax
cmpq %rax, %r15
jb 0x4154a
movzbl %bpl, %eax
leaq 0x3449a(%rip), %rsi     # 0x75a1c
leaq 0x10(%rsp), %rdx
movq %r13, %rdi
movq %r12, %rcx
movq %rbx, %r8
movq 0x8(%rsp), %r9
pushq %r14
pushq %rax
callq 0x41600
addq $0x10, %rsp
jmp 0x415bc
leaq 0x3445c(%rip), %rdx     # 0x75a06
movq %r14, %rdi
movl $0x1, %esi
movl $0x75, %ecx
callq 0x145a4
cmpl $0x0, 0x18(%rsp)
je 0x415dc
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x122c0
incq %r14
movslq 0x18(%rsp), %rax
cmpq %rax, %r14
jb 0x415c6
movq %rbx, %rdi
callq 0x122c0
leaq 0x10(%rsp), %rdi
callq 0x2f56e
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_init
void subtilis_array_type_init(subtilis_parser_t *p, const char *var_name,
			      const subtilis_type_t *element_type,
			      subtilis_type_t *type, subtilis_exp_t **e,
			      size_t dims, subtilis_error_t *err)
{
	size_t i;

	if (dims > SUBTILIS_MAX_DIMENSIONS) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	type->type = SUBTILIS_TYPE_VOID;
	subtilis_type_if_array_of(element_type, type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	type->params.array.num_dims = dims;
	for (i = 0; i < dims; i++) {
		if (e[i]->type.type == SUBTILIS_TYPE_CONST_INTEGER) {
			if (e[i]->exp.ir_op.integer < 0) {
				subtilis_error_bad_dim(err, var_name,
						       p->l->stream->name,
						       p->l->line);
				return;
			}
			type->params.array.dims[i] = e[i]->exp.ir_op.integer;
		} else {
			type->params.array.dims[i] = SUBTILIS_DYNAMIC_DIMENSION;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x40(%rsp), %r14
cmpq $0xb, %r9
jb 0x418a4
leaq 0x34182(%rip), %rdx     # 0x75a06
movq %r14, %rdi
movl $0xf, %esi
movl $0x94, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x145a4
movq %r9, %r15
movq %r8, %r12
movq %rcx, %r13
movq %rsi, %rbx
movq %rdi, %rbp
movl $0x8, (%rcx)
movq %rdx, %rdi
movq %rcx, %rsi
movq %r14, %rdx
callq 0x35fbf
cmpl $0x0, (%r14)
je 0x418dc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r15d, 0x8(%r13)
testq %r15, %r15
je 0x418cd
xorl %eax, %eax
movq (%r12,%rax,8), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, (%rdx)
jne 0x418ff
movl 0x148(%rdx), %ecx
testl %ecx, %ecx
js 0x4190e
movl %ecx, 0xc(%r13,%rax,4)
incq %rax
cmpq %rax, %r15
jne 0x418e7
jmp 0x418cd
movq (%rbp), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x340e5(%rip), %rax     # 0x75a06
leaq 0x324ed(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x38, %esi
movq %rbx, %rdx
pushq $0xa3
pushq %rax
callq 0x143da
addq $0x18, %rsp
jmp 0x418d1
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_vector_init
void subtilis_array_type_vector_init(const subtilis_type_t *element_type,
				     subtilis_type_t *type,
				     subtilis_error_t *err)
{
	type->type = SUBTILIS_TYPE_VOID;
	subtilis_type_if_vector_of(element_type, type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	type->params.array.num_dims = 1;
	type->params.array.dims[0] = SUBTILIS_DYNAMIC_DIMENSION;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movl $0x8, (%rsi)
callq 0x36014
cmpl $0x0, (%r14)
jne 0x4196d
movabsq $-0xffffffff, %rax      # imm = 0xFFFFFFFF00000001
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_vector_zero_ref
void subtilis_array_type_vector_zero_ref(subtilis_parser_t *p,
					 const subtilis_type_t *type,
					 size_t loc, size_t mem_reg, bool push,
					 subtilis_error_t *err)
{
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t base;
	subtilis_exp_t *zero = NULL;
	subtilis_exp_t *neg1 = NULL;

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

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

	neg1 = subtilis_exp_new_int32(-1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

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

	subtilis_reference_type_set_size(p, mem_reg, loc, zero->exp.ir_op.reg,
					 err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_reference_type_set_orig_size(p, mem_reg, loc,
					      zero->exp.ir_op.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op1.integer = ((int32_t)loc) + SUBTIILIS_ARRAY_DIMS_OFF;
	base.reg = mem_reg;
	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_STOREO_I32,
					  neg1->exp.ir_op, base, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (push)
		subtilis_reference_type_push_reference(p, type, mem_reg, loc,
						       err);

cleanup:

	subtilis_exp_delete(neg1);
	subtilis_exp_delete(zero);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
xorl %edi, %edi
movq %r9, %rsi
callq 0x2b7af
cmpl $0x0, (%r14)
je 0x419b4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x36119
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r14)
je 0x419ef
xorl %edi, %edi
movq 0x8(%rsp), %rbx
callq 0x2b166
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r14, %rsi
callq 0x2b7af
cmpl $0x0, (%r14)
jne 0x419a5
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x36119
movq %rax, %rdi
cmpl $0x0, (%r14)
jne 0x419cf
movq %rdi, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq 0x148(%rax), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %r8
callq 0x4d8dd
cmpl $0x0, (%r14)
jne 0x41aad
movq 0x8(%rsp), %rax
movq 0x148(%rax), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %r8
callq 0x4db31
cmpl $0x0, (%r14)
jne 0x41aad
leal 0x10(%r12), %r8d
movq 0x48(%rbx), %rdi
movq 0x10(%rsp), %rax
movq 0x148(%rax), %rdx
movl $0x17, %esi
movq %r15, %rcx
movq %r14, %r9
callq 0x2bd42
cmpl $0x0, (%r14)
setne %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x41aad
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r14, %r8
callq 0x4d4a6
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %rdi
jmp 0x419d4
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_zero_buf_i32
void subtilis_array_zero_buf_i32(subtilis_parser_t *p,
				 const subtilis_type_t *type, size_t data_reg,
				 size_t size_reg, subtilis_error_t *err)
{
	subtilis_ir_operand_t zero;
	size_t zero_reg;

	zero.integer = 0;
	zero_reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, zero, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_builtin_memset_i32(p, data_reg, size_reg, zero_reg, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %r12
movq 0x48(%rdi), %rdi
movl $0x1b, %esi
xorl %edx, %edx
movq %r8, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
je 0x41af4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rax, %rcx
movq %rbx, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x306b0
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_zero_buf_i8
void subtilis_array_zero_buf_i8(subtilis_parser_t *p,
				const subtilis_type_t *type, size_t data_reg,
				size_t size_reg, subtilis_error_t *err)
{
	subtilis_ir_operand_t zero;
	size_t zero_reg;

	zero.integer = 0;
	zero_reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, zero, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_builtin_memset_i8(p, data_reg, size_reg, zero_reg, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %r12
movq 0x48(%rdi), %rdi
movl $0x1b, %esi
xorl %edx, %edx
movq %r8, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
je 0x41b4b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rax, %rcx
movq %rbx, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x30791
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_1d_static_alloc
static void prv_1d_static_alloc(subtilis_parser_t *p, size_t loc,
				const subtilis_type_t *type, subtilis_exp_t *e,
				subtilis_ir_operand_t store_reg, bool push,
				subtilis_error_t *err)
{
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t one;
	subtilis_ir_operand_t size;
	size_t data;
	subtilis_exp_t *sizee = NULL;

	op1.integer = ((int32_t)loc) + SUBTIILIS_ARRAY_DIMS_OFF;
	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_STOREO_I32,
					  e->exp.ir_op, store_reg, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	one.integer = 1;
	size.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_ADDI_I32, e->exp.ir_op, one, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	sizee = subtilis_exp_new_int32_var(size.reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	sizee = subtilis_type_if_data_size(p, type, sizee, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	data = subtilis_reference_type_alloc(p, type, loc, store_reg.reg,
					     sizee->exp.ir_op.reg, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_clear_new_array(p, type, loc, sizee->exp.ir_op.reg, store_reg, data,
			    err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (push)
		subtilis_reference_type_push_reference(p, type, store_reg.reg,
						       loc, err);
cleanup:

	subtilis_exp_delete(sizee);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0x14(%rsp)
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r13
movq 0x50(%rsp), %r12
leal 0x10(%rsi), %r8d
movq 0x48(%rdi), %rdi
movq 0x148(%rcx), %rdx
movl $0x17, %esi
movq %rbx, %rcx
movq %r12, %r9
callq 0x2bd42
cmpl $0x0, (%r12)
jne 0x41ed9
movq 0x48(%r13), %rdi
movq 0x148(%rbp), %rdx
movl $0x1, %ecx
movl $0x9, %esi
movq %r12, %r8
callq 0x2bc8f
cmpl $0x0, (%r12)
jne 0x41ed9
movl %eax, %edi
movq %r12, %rsi
callq 0x2b71f
cmpl $0x0, (%r12)
jne 0x41ed9
movq %r13, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0x35ddb
cmpl $0x0, (%r12)
je 0x41ee8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
movq 0x148(%rax), %r8
movq %r12, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %r9d, %r9d
callq 0x4ddaa
cmpl $0x0, (%r12)
jne 0x41f50
movq 0x148(%rbp), %rcx
movq %r13, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r12, %r8
callq 0x3666c
cmpl $0x0, (%r12)
setne %al
movl 0x14(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x41f50
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x4d4a6
movq %rbp, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_check_slice_index1
static void
prv_check_slice_index1(subtilis_parser_t *p, const subtilis_type_t *type,
		       subtilis_exp_t *index1, subtilis_exp_t *index2,
		       subtilis_ir_operand_t error_label, subtilis_error_t *err)
{
	subtilis_ir_operand_t index1_ok;
	subtilis_exp_t *index1_dup = NULL;
	subtilis_exp_t *zero = NULL;
	subtilis_exp_t *condee = NULL;

	if (index1->type.type == SUBTILIS_TYPE_CONST_INTEGER) {
		if (index1->exp.ir_op.integer < 0) {
			subtilis_error_set_bad_slice(
			    err, index1->exp.ir_op.integer,
			    index2->exp.ir_op.integer, p->l->stream->name,
			    p->l->line);
			return;
		}
	} else {
		index1_ok.label = subtilis_ir_section_new_label(p->current);
		index1_dup = subtilis_type_if_dup(index1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		zero = subtilis_exp_new_int32(0, err);
		if (err->type != SUBTILIS_ERROR_OK) {
			subtilis_exp_delete(index1_dup);
			return;
		}

		condee = subtilis_type_if_gte(p, index1_dup, zero, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_instr_reg(
		    p->current, SUBTILIS_OP_INSTR_JMPC, condee->exp.ir_op,
		    index1_ok, error_label, err);
		subtilis_exp_delete(condee);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_label(p->current, index1_ok.label, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rsi, %r13
movq %rdi, %r14
cmpl $0x1, (%rsi)
jne 0x42508
movq %rdx, %rax
movl 0x148(%r13), %edx
testl %edx, %edx
jns 0x42527
movl 0x148(%rax), %ecx
movq (%r14), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x33517(%rip), %rax     # 0x75a06
movq %rbx, %rdi
movl $0x65, %esi
pushq $0x26b                  # imm = 0x26B
pushq %rax
callq 0x14486
addq $0x10, %rsp
jmp 0x42527
movq %rcx, %r12
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r15
movq %r13, %rdi
movq %rbx, %rsi
callq 0x36182
cmpl $0x0, (%rbx)
je 0x42531
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r13
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2b7af
cmpl $0x0, (%rbx)
je 0x42554
movq %r13, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2b166
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x37164
cmpl $0x0, (%rbx)
jne 0x42527
movq %rax, %r13
movq 0x48(%r14), %rdi
movq 0x148(%rax), %rdx
movl $0x43, %esi
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
callq 0x2bd42
movq %r13, %rdi
callq 0x2b166
cmpl $0x0, (%rbx)
jne 0x42527
movq 0x48(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2cca6
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_check_slice_index2
static void prv_check_slice_index2(subtilis_parser_t *p,
				   const subtilis_type_t *type,
				   subtilis_exp_t *index1,
				   subtilis_exp_t *index2, size_t ptr,
				   subtilis_ir_operand_t error_label,
				   subtilis_error_t *err)
{
	subtilis_ir_operand_t index2_ok;
	subtilis_exp_t *index2_dup = NULL;
	subtilis_exp_t *condee = NULL;
	subtilis_exp_t *max_dim = NULL;

	if ((index2->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
	    (type->params.array.dims[0] != SUBTILIS_DYNAMIC_DIMENSION)) {
		if (index2->exp.ir_op.integer >
		    type->params.array.dims[0] + 1) {
			subtilis_error_set_bad_slice(
			    err, index1->exp.ir_op.integer,
			    index2->exp.ir_op.integer, p->l->stream->name,
			    p->l->line);
			return;
		}
	} else {
		index2_ok.label = subtilis_ir_section_new_label(p->current);

		max_dim = prv_calc_max_dim(p, type, ptr, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		index2_dup = subtilis_type_if_dup(index2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		condee = subtilis_type_if_lte(p, index2_dup, max_dim, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_instr_reg(
		    p->current, SUBTILIS_OP_INSTR_JMPC, condee->exp.ir_op,
		    index2_ok, error_label, err);
		subtilis_exp_delete(condee);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_label(p->current, index2_ok.label, err);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movq %r8, %rbp
movq %rcx, %r13
movq %rsi, %r12
movq %rdi, %r14
movq 0x40(%rsp), %rbx
cmpl $0x1, (%rcx)
jne 0x42623
movl 0xc(%r12), %eax
cmpl $-0x1, %eax
je 0x42623
movl 0x148(%r13), %ecx
incl %eax
cmpl %eax, %ecx
jle 0x426a0
movl 0x148(%rdx), %edx
movq (%r14), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x333ff(%rip), %rax     # 0x75a06
movq %rbx, %rdi
movl $0x65, %esi
pushq $0x2b7                  # imm = 0x2B7
pushq %rax
callq 0x14486
addq $0x18, %rsp
jmp 0x426a4
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, (%rsp)
movl 0xc(%r12), %esi
movq %r14, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x426cd
cmpl $0x0, (%rbx)
jne 0x426a0
movq %rax, %rbp
movq %r13, %rdi
movq %rbx, %rsi
callq 0x36182
cmpl $0x0, (%rbx)
jne 0x426a0
movq %r14, %rdi
movq %rax, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x370d0
cmpl $0x0, (%rbx)
jne 0x426a0
movq %rax, %r13
movq 0x48(%r14), %rdi
movq 0x148(%rax), %rdx
movl $0x43, %esi
movq (%rsp), %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x2bd42
movq %r13, %rdi
callq 0x2b166
cmpl $0x0, (%rbx)
je 0x426af
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%r14), %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2cca6
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_calc_max_dim
static subtilis_exp_t *prv_calc_max_dim(subtilis_parser_t *p,
					const subtilis_type_t *type, size_t ptr,
					subtilis_error_t *err)
{
	subtilis_exp_t *max_dim = NULL;
	subtilis_exp_t *one;

	if (type->params.array.dims[0] != SUBTILIS_DYNAMIC_DIMENSION)
		max_dim =
		    subtilis_exp_new_int32(type->params.array.dims[0], err);
	else
		max_dim = subtilis_type_if_load_from_mem(
		    p, &subtilis_type_integer, ptr, SUBTIILIS_ARRAY_DIMS_OFF,
		    err);

	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	one = subtilis_exp_new_int32(1, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		subtilis_exp_delete(max_dim);
		return NULL;
	}

	return subtilis_type_if_add(p, max_dim, one, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdi, %r14
cmpl $-0x1, %esi
je 0x426e9
movl %esi, %edi
movq %rbx, %rsi
callq 0x2b7af
jmp 0x42700
leaq 0x32228(%rip), %rsi     # 0x74918
movl $0x10, %ecx
movq %r14, %rdi
movq %rbx, %r8
callq 0x36372
movq %rax, %r15
cmpl $0x0, (%rbx)
jne 0x42722
movl $0x1, %edi
movq %rbx, %rsi
callq 0x2b7af
cmpl $0x0, (%rbx)
je 0x4272a
movq %r15, %rdi
callq 0x2b166
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %rbx, %rcx
popq %rbx
popq %r14
popq %r15
jmp 0x36b28
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_create_ref
void subtilis_array_type_create_ref(subtilis_parser_t *p, const char *var_name,
				    const subtilis_symbol_t *s, size_t mem_reg,
				    subtilis_exp_t *e, subtilis_error_t *err)
{
	subtilis_ir_operand_t dest_op;
	subtilis_ir_operand_t source_op;

	subtilis_array_type_match(p, &s->t, &e->type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	dest_op.reg = mem_reg;
	source_op.reg = e->exp.ir_op.reg;
	prv_copy_ref_base(p, &s->t, dest_op, s->loc, source_op, 0, true, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_reference_inc_cleanup_stack(p, &s->t, err);

cleanup:

	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r13
movq %rdx, %rbp
movq %rdi, %r12
leaq 0x8(%rdx), %r15
movq %r15, %rsi
movq %r8, %rdx
movq %r9, %rcx
callq 0x42eaf
cmpl $0x0, (%r14)
jne 0x42e99
movq 0x148(%rbx), %r8
movq (%rbp), %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %r9d, %r9d
pushq %r14
pushq $0x1
callq 0x42fc0
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r14, %rcx
callq 0x4cfe9
cmpl $0x0, (%r14)
jne 0x42e99
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4d28c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_match
void subtilis_array_type_match(subtilis_parser_t *p, const subtilis_type_t *t1,
			       const subtilis_type_t *t2, subtilis_error_t *err)
{
	if (!subtilis_type_eq(t1, t2)) {
		if (subtilis_type_if_is_array(t2) ||
		    subtilis_type_if_is_vector(t2))
			subtilis_error_set_array_type_mismatch(
			    err, p->l->stream->name, p->l->line);
		else
			subtilis_error_not_array_or_vector(
			    err, subtilis_type_name(t2), p->l->stream->name,
			    p->l->line);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x2f0ec
testb %al, %al
je 0x42ed2
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
callq 0x376b5
testb %al, %al
jne 0x42eea
movq %r15, %rdi
callq 0x376d3
testb %al, %al
je 0x42f13
movq (%r14), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x32b0b(%rip), %r8      # 0x75a06
movq %rbx, %rdi
movl $0x41, %esi
movl $0x572, %r9d            # imm = 0x572
popq %rbx
popq %r14
popq %r15
jmp 0x145c8
movq %r15, %rdi
callq 0x2f5ad
movq (%r14), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x32ad9(%rip), %r10     # 0x75a06
leaq 0x30ee1(%rip), %rcx     # 0x73e15
movq %rbx, %rdi
movl $0x3d, %esi
movq %rax, %rdx
pushq $0x576                  # imm = 0x576
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x42ecc
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_init_field
void subtilis_array_type_init_field(subtilis_parser_t *p,
				    const subtilis_type_t *type, size_t mem_reg,
				    size_t loc, subtilis_exp_t *e,
				    subtilis_error_t *err)
{
	subtilis_ir_operand_t dest_reg;
	subtilis_ir_operand_t source_reg;

	dest_reg.reg = mem_reg;
	source_reg.reg = e->exp.ir_op.reg;

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

	(void)prv_new_ref_base(p, type, dest_reg, loc, source_reg, 0, true,
			       err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

cleanup:

	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %r8, %rbx
movq %rcx, (%rsp)
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
movq 0x148(%r8), %r13
movq %r8, %rdx
movq %r9, %rcx
callq 0x42eaf
cmpl $0x0, (%r14)
jne 0x42faa
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq (%rsp), %rcx
movq %r13, %r8
xorl %r9d, %r9d
pushq %r14
pushq $0x1
callq 0x42fc0
addq $0x10, %rsp
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_reset_field
void subtilis_array_type_reset_field(subtilis_parser_t *p,
				     const subtilis_type_t *type,
				     size_t mem_reg, size_t loc,
				     subtilis_exp_t *e, subtilis_error_t *err)
{
	subtilis_array_type_match(p, type, &e->type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	/*
	 * TODO: I suspect this is incorrect for arrays of RECS which need
	 * dereffing.  Check when we have initialiser for arrays of RECS.
	 */

	subtilis_array_type_assign_ref(p, type, mem_reg, loc, e->exp.ir_op.reg,
				       err);
cleanup:

	subtilis_exp_delete(e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movq %r8, %rdx
movq %r9, %rcx
callq 0x42eaf
cmpl $0x0, (%r14)
jne 0x432f8
movq 0x148(%rbx), %r8
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r9
callq 0x4330e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_assign_ref
void subtilis_array_type_assign_ref(subtilis_parser_t *p,
				    const subtilis_type_t *type,
				    size_t dest_mem_reg, size_t dest_loc,
				    size_t source_reg, subtilis_error_t *err)
{
	bool check_size = subtilis_type_if_is_vector(type);

	subtilis_reference_type_assign_ref(p, dest_mem_reg, dest_loc,
					   source_reg, check_size, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_array_type_copy_dims(p, type, dest_mem_reg, dest_loc,
				      source_reg, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movq %rsi, %rdi
callq 0x376d3
movzbl %al, %r8d
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r9
callq 0x4d5ad
cmpl $0x0, (%rbx)
je 0x4335f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r8
movq %rbx, %r9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43434
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtlis_array_type_copy_ret
void subtlis_array_type_copy_ret(subtilis_parser_t *p, const subtilis_type_t *t,
				 size_t dest_reg, size_t source_reg,
				 subtilis_error_t *err)
{
	subtilis_ir_operand_t d;
	subtilis_ir_operand_t s;

	d.reg = dest_reg;
	s.reg = source_reg;

	prv_copy_ref_base(p, t, d, 0, s, 0, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_reference_inc_cleanup_stack(p, t, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movq %rcx, %r8
movq %rsi, %r14
movq %rdi, %r15
xorl %ecx, %ecx
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x42fc0
addq $0x10, %rsp
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x4cfe9
cmpl $0x0, (%rbx)
je 0x433c2
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x4d28c
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_type_copy_dims
void subtilis_array_type_copy_dims(subtilis_parser_t *p,
				   const subtilis_type_t *type,
				   size_t dest_mem_reg, size_t dest_loc,
				   size_t source_reg, subtilis_error_t *err)
{
	size_t i;
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t op2;
	size_t copy_reg;
	const subtilis_type_array_t *dest_type = &type->params.array;

	for (i = 0; i < dest_type->num_dims; i++) {
		if (dest_type->dims[i] != SUBTILIS_DYNAMIC_DIMENSION)
			continue;

		op0.reg = source_reg;
		op1.integer = SUBTIILIS_ARRAY_DIMS_OFF + (i * sizeof(int32_t));
		copy_reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_LOADO_I32, op0, op1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		op0.reg = copy_reg;
		op1.reg = dest_mem_reg;
		op2.integer =
		    dest_loc + SUBTIILIS_ARRAY_DIMS_OFF + (i * sizeof(int32_t));
		subtilis_ir_section_add_instr_reg(p->current,
						  SUBTILIS_OP_INSTR_STOREO_I32,
						  op0, op1, op2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, (%rsp)
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0x434e1
movq %r9, %rbx
movq %rsi, %r13
movq %rdi, %rbp
movq (%rsp), %r12
shrq $0x20, %r12
movl $0x10, %r14d
xorl %r15d, %r15d
cmpl $-0x1, 0xc(%r13,%r15,4)
jne 0x434d2
movq 0x48(%rbp), %rdi
shlq $0x20, %rdx
movl %r14d, %ecx
andl $-0x4, %ecx
orq %rdx, %rcx
movl $0x12, %esi
movq 0x10(%rsp), %rdx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x434e1
movq 0x8(%rsp), %rcx
leal (%rcx,%r14), %r8d
movq 0x48(%rbp), %rdi
movl $0x17, %esi
movq %rax, %rdx
movq (%rsp), %rcx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x434e1
movl 0x8(%r13), %eax
movl %r12d, %edx
incq %r15
movslq %eax, %rcx
addq $0x4, %r14
cmpq %rcx, %r15
jb 0x43475
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_gen_index_error_code
void subtilis_array_gen_index_error_code(subtilis_parser_t *p,
					 subtilis_error_t *err)
{
	subtilis_ir_operand_t error_label;
	subtilis_exp_t *ecode = NULL;

	if (p->current->array_access == SIZE_MAX)
		return;

	error_label.label = p->current->array_access;

	subtilis_ir_section_add_label(p->current, error_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	ecode = subtilis_exp_new_int32(SUBTILIS_ERROR_CODE_BAD_DIM, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_exp_generate_error(p, ecode, err);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x48(%rdi), %rdi
movq 0xb0(%rdi), %rsi
cmpq $-0x1, %rsi
je 0x436e9
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x436e9
movl $0xa, %edi
movq %rbx, %rsi
callq 0x2b7af
cmpl $0x0, (%rbx)
je 0x436f1
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2ba50
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_get_dynamic_dim_size
static subtilis_exp_t *prv_get_dynamic_dim_size(subtilis_parser_t *p,
						int32_t dim_size,
						int32_t offset, size_t mem_reg,
						subtilis_error_t *err)
{
	subtilis_ir_operand_t op0;
	subtilis_ir_operand_t op1;
	size_t reg;
	subtilis_exp_t *maxe = NULL;

	if (dim_size == SUBTILIS_DYNAMIC_DIMENSION) {
		op0.reg = mem_reg;
		op1.integer = offset;
		reg = subtilis_ir_section_add_instr(
		    p->current, SUBTILIS_OP_INSTR_LOADO_I32, op0, op1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return NULL;
		maxe = subtilis_exp_new_int32_var(reg, err);
	} else {
		maxe = subtilis_exp_new_int32(dim_size, err);
	}

	return maxe;
}

// Assembly:
pushq %rbx
movq %r8, %rbx
cmpl $-0x1, %esi
je 0x43cb4
movl %esi, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x2b7af
movq 0x48(%rdi), %rdi
movl %edx, %eax
movl $0x12, %esi
movq %rcx, %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
je 0x43cd6
xorl %eax, %eax
popq %rbx
retq
movl %eax, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x2b71f
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_check_dynamic_index
static subtilis_exp_t *prv_check_dynamic_index(subtilis_parser_t *p,
					       subtilis_exp_t *e,
					       int32_t dim_size, int32_t offset,
					       size_t mem_reg,
					       subtilis_error_t *err)
{
	subtilis_exp_t *maxe;
	subtilis_exp_t *maxe_dup = NULL;

	maxe = prv_get_dynamic_dim_size(p, dim_size, offset, mem_reg, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	maxe_dup = subtilis_type_if_dup(maxe, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	prv_check_dynamic_dim(p, e, 0, maxe_dup, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	return maxe;

cleanup:

	subtilis_exp_delete(maxe);

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %edx, %esi
movl %ecx, %edx
movq %r8, %rcx
movq %r9, %r8
callq 0x43ca0
cmpl $0x0, (%r14)
jne 0x43d3c
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x36182
cmpl $0x0, (%r14)
jne 0x43d34
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
movq %r14, %r8
callq 0x4352b
cmpl $0x0, (%r14)
je 0x43d3e
movq %rbx, %rdi
callq 0x2b166
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_check_last_index
static void prv_check_last_index(subtilis_parser_t *p, const char *var_name,
				 subtilis_exp_t **e,
				 const subtilis_type_t *type, int32_t offset,
				 size_t mem_reg, subtilis_error_t *err)
{
	int32_t dim_size;
	size_t i = type->params.array.num_dims - 1;
	subtilis_exp_t *maxe = NULL;

	dim_size = type->params.array.dims[i];
	if ((dim_size != SUBTILIS_DYNAMIC_DIMENSION) &&
	    (e[i]->type.type == SUBTILIS_TYPE_CONST_INTEGER)) {
		if ((e[i]->exp.ir_op.integer < 0) ||
		    (e[i]->exp.ir_op.integer > dim_size)) {
			subtilis_error_bad_index(
			    err, var_name, p->l->stream->name, p->l->line);
			return;
		}
	} else {
		maxe = prv_check_dynamic_index(p, e[i], dim_size, offset,
					       mem_reg, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_exp_delete(maxe);
	}
}

// Assembly:
pushq %rbx
movq %rdx, %r10
movq %rsi, %rax
movq 0x10(%rsp), %rbx
movslq 0x8(%rcx), %rsi
movl 0x8(%rcx,%rsi,4), %edx
movq -0x8(%r10,%rsi,8), %rsi
cmpl $-0x1, %edx
je 0x43dbc
cmpl $0x1, (%rsi)
jne 0x43dc1
movl 0x148(%rsi), %ecx
testl %ecx, %ecx
setns %sil
cmpl %edx, %ecx
setle %cl
testb %cl, %sil
jne 0x43dd4
movq (%rdi), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x31c6e(%rip), %r10     # 0x75a06
leaq 0x30076(%rip), %rcx     # 0x73e15
movq %rbx, %rdi
movl $0x39, %esi
movq %rax, %rdx
pushq $0x6cd                  # imm = 0x6CD
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x43dd4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %r8d, %ecx
movq %r9, %r8
movq %rbx, %r9
callq 0x43ce1
cmpl $0x0, (%rbx)
je 0x43dd6
popq %rbx
retq
movq %rax, %rdi
popq %rbx
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_compute_element_address
static subtilis_exp_t *prv_compute_element_address(subtilis_parser_t *p,
						   const subtilis_type_t *type,
						   size_t mem_reg, size_t loc,
						   subtilis_exp_t *sizee,
						   subtilis_error_t *err)
{
	subtilis_exp_t *base;

	base =
	    subtilis_type_if_load_from_mem(p, &subtilis_type_integer, mem_reg,
					   loc + SUBTIILIS_ARRAY_DATA_OFF, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	if ((sizee->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
	    (sizee->exp.ir_op.integer == 0)) {
		subtilis_exp_delete(sizee);
		return base;
	}

	sizee = subtilis_type_if_data_size(p, type, sizee, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	return subtilis_type_if_add(p, base, sizee, err);

cleanup:

	subtilis_exp_delete(base);

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %r8, %r12
movq %rsi, %r13
movq %rdi, %r15
addq $0x4, %rcx
leaq 0x30b19(%rip), %rsi     # 0x74918
movq %r9, %r8
callq 0x36372
cmpl $0x0, (%rbx)
jne 0x43e3f
movq %rax, %r14
cmpl $0x1, (%r12)
jne 0x43e21
cmpl $0x0, 0x148(%r12)
je 0x43e69
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x35ddb
cmpl $0x0, (%rbx)
je 0x43e4f
movq %r14, %rdi
callq 0x2b166
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x36b28
movq %r12, %rdi
callq 0x2b166
jmp 0x43e42
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_write
void subtilis_array_write(subtilis_parser_t *p, const char *var_name,
			  const subtilis_type_t *type,
			  const subtilis_type_t *el_type, size_t mem_reg,
			  size_t loc, subtilis_exp_t *e,
			  subtilis_exp_t **indices, size_t index_count,
			  subtilis_error_t *err)
{
	subtilis_exp_t *offset;

	offset = subtilis_array_index_calc(p, var_name, type, mem_reg, loc,
					   indices, index_count, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (e->partial_name)
		subtilis_parser_call_add_addr(p, el_type, e, err);
	else
		e = subtilis_type_if_coerce_type(p, e, el_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_type_if_assign_to_mem(p, offset->exp.ir_op.reg, 0, e, err);
	e = NULL;

cleanup:

	subtilis_exp_delete(offset);
	subtilis_exp_delete(e);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, %rax
movq %rcx, %r13
movq %rdi, %r12
movq 0x48(%rsp), %r14
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r9
movq %r8, %rcx
movq %rax, %r8
pushq %r14
pushq 0x48(%rsp)
callq 0x43706
addq $0x10, %rsp
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x43f02
cmpq $0x0, 0x160(%rbx)
je 0x43ecf
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1d3d0
jmp 0x43ee3
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x37860
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x43f02
movq 0x148(%r15), %rsi
movq %r12, %rdi
xorl %edx, %edx
movq %rbx, %rcx
movq %r14, %r8
callq 0x362c6
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x2b166
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2b166
// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/array_type.c
// Function: subtilis_array_read
subtilis_exp_t *subtilis_array_read(subtilis_parser_t *p, const char *var_name,
				    const subtilis_type_t *type,
				    const subtilis_type_t *el_type,
				    size_t mem_reg, size_t loc,
				    subtilis_exp_t **indices,
				    size_t index_count, subtilis_error_t *err)
{
	subtilis_exp_t *offset;
	subtilis_exp_t *e;

	offset = subtilis_array_index_calc(p, var_name, type, mem_reg, loc,
					   indices, index_count, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	e = subtilis_type_if_load_from_mem(p, el_type, offset->exp.ir_op.reg, 0,
					   err);
	subtilis_exp_delete(offset);
	return e;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rax
movq %rcx, %rbx
movq %rdi, %r15
movq 0x40(%rsp), %r14
movq 0x30(%rsp), %r9
movq %r8, %rcx
movq %rax, %r8
pushq %r14
pushq 0x40(%rsp)
callq 0x43706
addq $0x10, %rsp
cmpl $0x0, (%r14)
je 0x43f55
xorl %eax, %eax
jmp 0x43f7d
movq %rax, %r12
movq 0x148(%rax), %rdx
movq %r15, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x36372
movq %rax, %rbx
movq %r12, %rdi
callq 0x2b166
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq