// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movl $0x0, (%rcx)
testq %rdx, %rdx
movq %rdx, 0x10(%rsp)
je 0x27ab0
movq %rcx, %rbp
movq $0x0, (%rsp)
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r13
testq %r13, %r13
je 0x27a6f
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
orl %eax, (%rbp)
movq %r13, %rdi
callq 0x37676
testb %al, %al
je 0x279ec
movq (%rbx,%r15,8), %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rdx
callq 0x3691f
movq %rax, (%rbx,%r15,8)
cmpl $0x0, (%r12)
jne 0x27abf
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x36269
movq %rax, (%rbx,%r15,8)
jmp 0x27a6f
movl (%r13), %eax
cmpl $0x16, %eax
ja 0x27a7d
movl $0x61800, %ecx          # imm = 0x61800
btl %eax, %ecx
jae 0x27a4a
movq %rbp, %r14
movq 0x148(%r13), %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
movq %r12, %rcx
callq 0x4d29c
cmpl $0x0, (%r12)
jne 0x27abf
movq %rax, %rbp
movq %r13, %rdi
callq 0x2b4c3
movl %ebp, %edi
movq %r12, %rsi
callq 0x2ba99
movq %rax, (%rbx,%r15,8)
movq %r14, %rbp
movq 0x10(%rsp), %r14
jmp 0x27a6f
cmpl $0x7, %eax
je 0x27a9b
cmpl $0x16, %eax
jne 0x27a7d
movl 0x148(%r13), %edi
movq %r12, %rsi
callq 0x2ba99
movq %rax, (%rbx,%r15,8)
movq %r13, %rdi
callq 0x2b4c3
incq %r15
cmpq %r15, %r14
jne 0x2798c
jmp 0x27ab0
cmpl $0x3, %eax
jne 0x27b5a
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4871c
jmp 0x279e3
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x48b02
jmp 0x279e3
cmpl $0x0, (%r12)
je 0x27af8
movq $0x0, (%rsp)
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x27add
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rdi
callq 0x2b4c3
incq %r15
cmpq %r15, %r14
jne 0x27acc
movq %rbx, %rdi
callq 0x122c0
movq (%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %esi
movq %r14, %rdi
callq 0x12150
testq %rax, %rax
je 0x27b3c
testq %r14, %r14
movq %rax, (%rsp)
je 0x27abf
xorl %edx, %edx
movq (%rbx,%rdx,8), %rcx
testq %rcx, %rcx
je 0x27b27
movq 0x148(%rcx), %rcx
jmp 0x27b2e
movq $-0x1, %rcx
movq %rcx, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %r14
jne 0x27b15
jmp 0x27abf
leaq 0x4bf30(%rip), %rdx     # 0x73a73
movq %r12, %rdi
movl $0x1, %esi
movl $0x8b, %ecx
callq 0x145f4
jmp 0x27ab7
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x4bf03(%rip), %r8      # 0x73a73
movq %r12, %rdi
movl $0x4d, %esi
movl $0x81, %r9d
callq 0x14618
jmp 0x27ab7