// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_expr.c
// Function: parseBuiltinSizeofCall
static void parseBuiltinSizeofCall(Compiler *comp, const Type **type, Const *constant)
{
    *type = NULL;

    // sizeof(T)
    if (comp->lex.tok.kind == TOK_IDENT)
    {
        const Ident *ident = identFind(&comp->idents, &comp->modules, &comp->blocks, comp->blocks.module, comp->lex.tok.name, NULL, false);
        if (ident && ident->kind == IDENT_TYPE)
        {
            Lexer lookaheadLex = comp->lex;
            lexNext(&lookaheadLex);
            if (lookaheadLex.tok.kind == TOK_RPAR)
            {
                lexNext(&comp->lex);
                *type = ident->type;
                identSetUsed(ident);
            }
        }
    }

    // sizeof(a: T)
    if (!(*type))
    {
        *type = NULL;
        parseExpr(comp, type, constant);
        if ((*type)->kind != TYPE_VOID)
            genPop(&comp->gen);
    }

    int size = typeSize(&comp->types, *type);

    if (constant)
        constant->intVal = size;
    else
        genPushIntConst(&comp->gen, size);

    *type = comp->intType;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x45, 0x4bd0(%rax)
jne 0x12948
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x8(%rbp), %rax
movl 0x4b88(%rax), %ecx
movq -0x8(%rbp), %r8
addq $0x4ba8, %r8            # imm = 0x4BA8
addq $0x28, %r8
addq $0x8, %r8
xorl %eax, %eax
movl %eax, %r9d
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x19580
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x12946
movq -0x20(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x12946
movq -0x8(%rbp), %rsi
addq $0x4ba8, %rsi           # imm = 0x4BA8
leaq -0x290(%rbp), %rdi
movl $0x270, %edx            # imm = 0x270
callq 0x3270
leaq -0x290(%rbp), %rdi
callq 0x1ad90
cmpl $0x39, -0x268(%rbp)
jne 0x12944
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
callq 0x1ad90
movq -0x20(%rbp), %rax
movq 0x108(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x13440
jmp 0x12946
jmp 0x12948
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1298c
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xe8c0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x2, (%rax)
je 0x1298a
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
callq 0x16d30
jmp 0x1298c
movq -0x8(%rbp), %rdi
addq $0x4e18, %rdi           # imm = 0x4E18
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21fe0
movl %eax, -0x294(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x129c0
movslq -0x294(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x129d7
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
movslq -0x294(%rbp), %rsi
callq 0x16850
movq -0x8(%rbp), %rax
movq 0x5240(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
nopw %cs:(%rax,%rax)