// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/pre-process.c
// Function: collect_arguments
static int collect_arguments(struct token *start, struct token *arglist, struct arg *args, struct token *what)
{
	int wanted = arglist->count.normal;
	struct token *next = NULL;
	int count = 0;

	arglist = arglist->next;	/* skip counter */

	if (!wanted) {
		next = collect_arg(start, 0, &what->pos, 0);
		if (eof_token(next))
			goto Eclosing;
		if (!eof_token(start->next) || !match_op(next, ')')) {
			count++;
			goto Emany;
		}
	} else {
		for (count = 0; count < wanted; count++) {
			struct argcount *p = &arglist->next->count;
			next = collect_arg(start, p->vararg, &what->pos, p->normal);
			if (eof_token(next))
				goto Eclosing;
			if (p->vararg && wanted == 1 && eof_token(start->next))
				break;
			arglist = arglist->next->next;
			args[count].arg = start->next;
			args[count].n_normal = p->normal;
			args[count].n_quoted = p->quoted;
			args[count].n_str = p->str;
			if (match_op(next, ')')) {
				count++;
				break;
			}
			start = next;
		}
		if (count == wanted && !match_op(next, ')'))
			goto Emany;
		if (count == wanted - 1) {
			struct argcount *p = &arglist->next->count;
			if (!p->vararg)
				goto Efew;
			args[count].arg = NULL;
			args[count].n_normal = p->normal;
			args[count].n_quoted = p->quoted;
			args[count].n_str = p->str;
		}
		if (count < wanted - 1)
			goto Efew;
	}
	what->next = next->next;
	return 1;

Efew:
	sparse_error(what->pos, "macro \"%s\" requires %d arguments, but only %d given",
		show_token(what), wanted, count);
	goto out;
Emany:
	while (match_op(next, ',')) {
		next = collect_arg(next, 0, &what->pos, 0);
		count++;
	}
	if (eof_token(next))
		goto Eclosing;
	sparse_error(what->pos, "macro \"%s\" passed %d arguments, but takes just %d",
		show_token(what), count, wanted);
	goto out;
Eclosing:
	sparse_error(what->pos, "unterminated argument list invoking macro \"%s\"",
		show_token(what));
out:
	what->next = next->next;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x2ef26
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x2f710
movq %rax, -0x38(%rbp)
leaq 0x7dadc(%rip), %rax     # 0xac9c0
cmpq %rax, -0x38(%rbp)
jne 0x2eeef
jmp 0x2f214
movq -0x10(%rbp), %rax
leaq 0x7dac6(%rip), %rcx     # 0xac9c0
cmpq %rcx, 0x8(%rax)
jne 0x2ef13
movq -0x38(%rbp), %rdi
movl $0x29, %esi
callq 0x2c380
cmpl $0x0, %eax
jne 0x2ef21
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2f19e
jmp 0x2f14d
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x2f06f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movl (%rax), %esi
shrl $0x1e, %esi
andl $0x1, %esi
movq -0x28(%rbp), %rdx
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
callq 0x2f710
movq %rax, -0x38(%rbp)
leaq 0x7da47(%rip), %rax     # 0xac9c0
cmpq %rax, -0x38(%rbp)
jne 0x2ef84
jmp 0x2f214
movq -0x48(%rbp), %rax
movl (%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2efb1
cmpl $0x1, -0x2c(%rbp)
jne 0x2efb1
movq -0x10(%rbp), %rax
leaq 0x7da1a(%rip), %rcx     # 0xac9c0
cmpq %rcx, 0x8(%rax)
jne 0x2efb1
jmp 0x2f06f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
shrl $0xa, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
shrl $0x14, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movq -0x38(%rbp), %rdi
movl $0x29, %esi
callq 0x2c380
cmpl $0x0, %eax
je 0x2f059
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2f06f
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2ef2d
movl -0x3c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x2f08f
movq -0x38(%rbp), %rdi
movl $0x29, %esi
callq 0x2c380
cmpl $0x0, %eax
jne 0x2f08f
jmp 0x2f19e
movl -0x3c(%rbp), %eax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2f13c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl (%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2f0c6
jmp 0x2f169
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x50(%rbp), %rax
movl (%rax), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x50(%rbp), %rax
movl (%rax), %ecx
shrl $0xa, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x50(%rbp), %rax
movl (%rax), %ecx
shrl $0x14, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movl -0x3c(%rbp), %eax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2f14b
jmp 0x2f169
jmp 0x2f14d
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2f254
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
callq 0x44420
movq %rax, %rdx
movq -0x58(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl -0x3c(%rbp), %r8d
movq (%rax), %rdi
leaq 0x389a7(%rip), %rsi     # 0x67b39
movb $0x0, %al
callq 0x16f90
jmp 0x2f23d
jmp 0x2f1a0
movq -0x38(%rbp), %rdi
movl $0x2c, %esi
callq 0x2c380
cmpl $0x0, %eax
je 0x2f1d3
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x2f710
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2f1a0
leaq 0x7d7e6(%rip), %rax     # 0xac9c0
cmpq %rax, -0x38(%rbp)
jne 0x2f1e2
jmp 0x2f214
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x44420
movq %rax, %rdx
movq -0x60(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl -0x2c(%rbp), %r8d
movq (%rax), %rdi
leaq 0x38962(%rip), %rsi     # 0x67b6d
movb $0x0, %al
callq 0x16f90
jmp 0x2f23d
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
callq 0x44420
movq %rax, %rdx
movq -0x68(%rbp), %rax
movq (%rax), %rdi
leaq 0x38969(%rip), %rsi     # 0x67b9f
movb $0x0, %al
callq 0x16f90
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)