// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_expr.c
// Function: parseDesignatorList
void parseDesignatorList(Compiler *comp, const Type **type, Const *constant, bool *isVar, bool *isCall, bool *isCompLit)
{
    parseDesignator(comp, type, constant, isVar, isCall, isCompLit);

    if (comp->lex.tok.kind == TOK_COMMA && (*isVar) && !(*isCall) && !(*isCompLit))
    {
        // Designator list (types formally encoded as structure field types - not a real structure)
        if (constant)
            comp->error.handler(comp->error.context, "Designator lists are not allowed for constants");

        const Type *fieldType = *type;

        Type *designatorListType = typeAdd(&comp->types, &comp->blocks, TYPE_STRUCT);
        designatorListType->isExprList = true;

        while (1)
        {
            typeAddField(&comp->types, designatorListType, fieldType, NULL);

            if (comp->lex.tok.kind != TOK_COMMA)
                break;

            lexNext(&comp->lex);

            bool fieldIsVar, fieldIsCall, fieldIsCompLit;
            parseDesignator(comp, &fieldType, NULL, &fieldIsVar, &fieldIsCall, &fieldIsCompLit);

            if (!fieldIsVar || fieldIsCall || fieldIsCompLit)
                comp->error.handler(comp->error.context, "Inconsistent designator list");
        }

        *type = designatorListType;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0xe790
movq -0x8(%rbp), %rax
cmpl $0x3f, 0x4bd0(%rax)
jne 0xe77f
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0xe77f
movq -0x28(%rbp), %rax
testb $0x1, (%rax)
jne 0xe77f
movq -0x30(%rbp), %rax
testb $0x1, (%rax)
jne 0xe77f
cmpq $0x0, -0x18(%rbp)
je 0xe6ad
movq -0x8(%rbp), %rax
movq 0x50f8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x5118(%rax), %rdi
leaq 0x1ca1ee(%rip), %rsi    # 0x1d8897
movb $0x0, %al
callq *%rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4e18, %rdi           # imm = 0x4E18
movq -0x8(%rbp), %rsi
addq $0x4220, %rsi           # imm = 0x4220
movl $0x16, %edx
callq 0x21950
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movb $0x1, 0x14(%rax)
movq -0x8(%rbp), %rdi
addq $0x4e18, %rdi           # imm = 0x4E18
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x23070
movq -0x8(%rbp), %rax
cmpl $0x3f, 0x4bd0(%rax)
je 0xe70f
jmp 0xe774
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
callq 0x1ad90
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x41(%rbp), %rcx
leaq -0x42(%rbp), %r8
leaq -0x43(%rbp), %r9
callq 0xe790
testb $0x1, -0x41(%rbp)
je 0xe74e
testb $0x1, -0x42(%rbp)
jne 0xe74e
testb $0x1, -0x43(%rbp)
je 0xe76f
movq -0x8(%rbp), %rax
movq 0x50f8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x5118(%rax), %rdi
leaq 0x1ca15b(%rip), %rsi    # 0x1d88c6
movb $0x0, %al
callq *%rcx
jmp 0xe6e4
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)