// File: /workspace/github_c_makefile_star2_O1/vtereshkov[P]umka-lang/src/umka_stmt.c
// Function: parseSimpleStmt
static void parseSimpleStmt(Compiler *comp)
{
    if (doShortVarDeclLookahead(comp))
        parseShortVarDecl(comp);
    else
    {
        const Type *type = NULL;
        bool isVar, isCall, isCompLit;
        parseDesignatorList(comp, &type, NULL, &isVar, &isCall, &isCompLit);

        TokenKind op = comp->lex.tok.kind;

        if (typeExprListStruct(type) && !isCall && op != TOK_EQ)
            comp->error.handler(comp->error.context, "List assignment expected");

        if (op == TOK_EQ || lexShortAssignment(op) != TOK_NONE)
        {
            // Assignment
            if (!isVar || isCall || isCompLit)
                comp->error.handler(comp->error.context, "Left side cannot be assigned to");
            lexNext(&comp->lex);

            if (op == TOK_EQ)
                parseAssignmentStmt(comp, type, NULL);
            else
                parseShortAssignmentStmt(comp, type, op);
        }
        else if (op == TOK_PLUSPLUS || op == TOK_MINUSMINUS)
        {
            // Increment/decrement
            parseIncDecStmt(comp, type, op);
        }
        else
        {
            // Call
            if (!isCall)
                comp->error.handler(comp->error.context, "Assignment or function call expected");
            if (type->kind != TYPE_VOID)
                genPop(&comp->gen);  // Manually remove result
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0x1e962
testb %al, %al
je 0x1e5fd
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x105cb
leaq 0x10(%rsp), %r14
movq $0x0, (%r14)
leaq 0xf(%rsp), %rcx
leaq 0xd(%rsp), %r8
leaq 0xe(%rsp), %r9
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x12da1
movl 0x4bd0(%rbx), %ebp
movq (%r14), %rax
cmpl $0x16, (%rax)
jne 0x1e661
cmpb $0x1, 0x14(%rax)
jne 0x1e661
cmpl $0x0, 0x10(%rax)
jle 0x1e661
cmpl $0x31, %ebp
sete %al
orb 0xd(%rsp), %al
jne 0x1e661
movq 0x5118(%rbx), %rdi
leaq 0x5a13e(%rip), %rsi     # 0x78797
xorl %eax, %eax
callq *0x50f8(%rbx)
leaq 0x4ba8(%rbx), %r14
cmpl $0x31, %ebp
je 0x1e67c
movl %ebp, %edi
callq 0x1b446
testl %eax, %eax
je 0x1e78a
cmpb $0x1, 0xf(%rsp)
jne 0x1e691
cmpb $0x0, 0xd(%rsp)
jne 0x1e691
cmpb $0x1, 0xe(%rsp)
jne 0x1e6a7
movq 0x5118(%rbx), %rdi
leaq 0x5a076(%rip), %rsi     # 0x78715
xorl %eax, %eax
callq *0x50f8(%rbx)
movq %r14, %rdi
callq 0x1a984
movq 0x10(%rsp), %r14
cmpl $0x31, %ebp
jne 0x1e6cb
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1c385
jmp 0x1e77f
movl (%r14), %eax
cmpl $0x18, %eax
ja 0x1e6eb
movl $0x1ec0000, %ecx        # imm = 0x1EC0000
btl %eax, %ecx
jb 0x1e705
cmpl $0x10, %eax
jne 0x1e6eb
movq 0x8(%r14), %rax
cmpl $0x2, (%rax)
jne 0x1e701
movq 0x5118(%rbx), %rdi
leaq 0x5a01c(%rip), %rsi     # 0x78715
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x8(%r14), %r14
leaq 0x4e70(%rbx), %r15
movq %r15, %rdi
callq 0x18271
movl (%r14), %esi
movq %r15, %rdi
callq 0x182ba
movq %r14, 0x18(%rsp)
leaq 0x20(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1617b
cmpl $0x20, %ebp
jne 0x1e74b
movq 0x18(%rsp), %rax
movl $0x20, %r9d
cmpl $0x14, (%rax)
je 0x1e755
movl %ebp, %edi
callq 0x1b446
movl %eax, %r9d
leaq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
pushq $0x0
pushq $0x1
callq 0x12aaf
addq $0x10, %rsp
movq %r15, %rdi
movq %r14, %rsi
callq 0x185e4
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2c, %eax
jne 0x1e80a
movq 0x10(%rsp), %r15
movl (%r15), %eax
cmpl $0x18, %eax
ja 0x1e7b9
movl $0x1ec0000, %ecx        # imm = 0x1EC0000
btl %eax, %ecx
jb 0x1e7d3
cmpl $0x10, %eax
jne 0x1e7b9
movq 0x8(%r15), %rax
cmpl $0x2, (%rax)
jne 0x1e7cf
movq 0x5118(%rbx), %rdi
leaq 0x59f4e(%rip), %rsi     # 0x78715
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x8(%r15), %r15
leaq 0x4e18(%rbx), %rdi
movq 0x5240(%rbx), %rsi
movq %r15, %rdx
callq 0x1f2a6
addq $0x4e70, %rbx           # imm = 0x4E70
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x1872d
movq %r14, %rdi
callq 0x1a984
jmp 0x1e77f
cmpb $0x0, 0xd(%rsp)
jne 0x1e827
movq 0x5118(%rbx), %rdi
leaq 0x59f91(%rip), %rsi     # 0x787b0
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x10(%rsp), %rax
cmpl $0x2, (%rax)
je 0x1e77f
addq $0x4e70, %rbx           # imm = 0x4E70
movq %rbx, %rdi
callq 0x181b1
jmp 0x1e77f