// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/parser_os.c
// Function: prv_process_input_args
static size_t *prv_process_input_args(subtilis_parser_t *p,
				      subtilis_exp_t **args, size_t no_args,
				      uint32_t *reg_mask, subtilis_error_t *err)
{
	size_t ptr;
	subtilis_exp_t *e;
	size_t *in_regs = NULL;
	size_t i = 0;

	*reg_mask = 0;

	for (i = 0; i < no_args; i++) {
		e = args[i];
		if (!e)
			continue;
		*reg_mask |= 1 << i;
		if (subtilis_type_if_is_numeric(&e->type)) {
			args[i] = subtilis_type_if_to_int(p, args[i], err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;
			args[i] = subtilis_type_if_exp_to_var(p, args[i], err);
		} else if (e->type.type == SUBTILIS_TYPE_STRING) {
			args[i] = subtilis_string_zt_non_const(p, e, err);
		} else if (e->type.type == SUBTILIS_TYPE_CONST_STRING) {
			args[i] = subtilis_string_lca_const_zt(p, e, err);
		} else if ((e->type.type == SUBTILIS_TYPE_ARRAY_BYTE) ||
			   (e->type.type == SUBTILIS_TYPE_ARRAY_INTEGER) ||
			   (e->type.type == SUBTILIS_TYPE_VECTOR_BYTE) ||
			   (e->type.type == SUBTILIS_TYPE_VECTOR_INTEGER)) {
			ptr = subtilis_reference_get_data(p, e->exp.ir_op.reg,
							  0, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;
			subtilis_exp_delete(e);
			args[i] = subtilis_exp_new_int32_var(ptr, err);
		} else if (e->type.type == SUBTILIS_TYPE_REC) {
			args[i] =
			    subtilis_exp_new_int32_var(e->exp.ir_op.reg, err);
			subtilis_exp_delete(e);
		} else {
			subtilis_error_set_sys_bad_args(err, p->l->stream->name,
							p->l->line);
			goto cleanup;
		}
	}

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

	in_regs = calloc(no_args, sizeof(*in_regs));
	if (!in_regs) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}

	for (i = 0; i < no_args; i++)
		if (!args[i])
			in_regs[i] = SIZE_MAX;
		else
			in_regs[i] = args[i]->exp.ir_op.reg;

cleanup:

	for (i = 0; i < no_args; i++)
		subtilis_exp_delete(args[i]);
	free(args);

	return in_regs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r15
movq %rsi, %rbx
movq %rcx, 0x10(%rsp)
movl $0x0, (%rcx)
testq %rdx, %rdx
movq %rdx, 0x8(%rsp)
je 0x278bd
movq %rdx, %r14
movq %rdi, %r13
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %r12
testq %r12, %r12
je 0x2785a
movl $0x1, %eax
movl %ebp, %ecx
shll %cl, %eax
movq 0x10(%rsp), %rcx
orl %eax, (%rcx)
movq %r12, %rdi
callq 0x37534
testb %al, %al
je 0x277ff
movq (%rbx,%rbp,8), %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x367cf
movq %rax, (%rbx,%rbp,8)
cmpl $0x0, (%r15)
jne 0x278c3
movq %r13, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x36119
movq %rax, (%rbx,%rbp,8)
jmp 0x27855
movl (%r12), %eax
cmpl $0x16, %eax
ja 0x27890
movl $0x61800, %ecx          # imm = 0x61800
btl %eax, %ecx
jae 0x27868
movq 0x148(%r12), %rsi
movq %r13, %rdi
xorl %edx, %edx
movq %r15, %rcx
callq 0x4d258
cmpl $0x0, (%r15)
jne 0x278c3
movq %r13, %r14
movq %rax, %r13
movq %r12, %rdi
callq 0x2b166
movl %r13d, %edi
movq %r15, %rsi
callq 0x2b71f
movq %rax, (%rbx,%rbp,8)
movq %r14, %r13
movq 0x8(%rsp), %r14
incq %rbp
cmpq %rbp, %r14
jne 0x277a5
jmp 0x278bd
cmpl $0x7, %eax
je 0x278a9
cmpl $0x16, %eax
jne 0x27890
movl 0x148(%r12), %edi
movq %r15, %rsi
callq 0x2b71f
movq %rax, (%rbx,%rbp,8)
movq %r12, %rdi
callq 0x2b166
jmp 0x2785a
cmpl $0x3, %eax
jne 0x2796a
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4869c
jmp 0x278b7
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x48a82
movq %rax, (%rbx,%rbp,8)
jmp 0x2785a
cmpl $0x0, (%r15)
je 0x278fe
xorl %r12d, %r12d
movq 0x8(%rsp), %r14
testq %r14, %r14
je 0x278e4
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rdi
callq 0x2b166
incq %r15
cmpq %r15, %r14
jne 0x278d3
movq %rbx, %rdi
callq 0x122c0
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %r14
movl $0x8, %esi
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x12150
testq %rax, %rax
je 0x2794c
movq %rax, %r12
testq %r15, %r15
je 0x278e4
movq %r15, %r14
xorl %eax, %eax
movq (%rbx,%rax,8), %rcx
testq %rcx, %rcx
je 0x27937
movq 0x148(%rcx), %rcx
jmp 0x2793e
movq $-0x1, %rcx
movq %rcx, (%r12,%rax,8)
incq %rax
cmpq %rax, %r14
jne 0x27925
jmp 0x278d0
leaq 0x4c13e(%rip), %rdx     # 0x73a91
movq %r14, %rdi
movl $0x1, %esi
movl $0x8b, %ecx
callq 0x145a4
jmp 0x278c3
movq (%r13), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x4c115(%rip), %r8      # 0x73a91
movq %r15, %rdi
movl $0x4d, %esi
movl $0x81, %r9d
callq 0x145c8
jmp 0x278c3