// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
callq 0x14cd9
testb %al, %al
je 0x14949
movq %rbx, %rdi
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x77f1
leaq 0x18(%rsp), %r15
andq $0x0, (%r15)
leaq 0x17(%rsp), %rcx
leaq 0x15(%rsp), %r8
leaq 0x16(%rsp), %r9
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xa211
leaq 0x4ba8(%rbx), %r14
movl 0x4bd0(%rbx), %ebp
movq (%r15), %rax
cmpl $0x16, (%rax)
jne 0x1499f
cmpb $0x1, 0x14(%rax)
jne 0x1499f
cmpl $0x0, 0x10(%rax)
jle 0x1499f
cmpl $0x31, %ebp
sete %al
orb 0x15(%rsp), %al
je 0x14b49
movb $0x1, %r12b
cmpl $0x31, %ebp
je 0x149b9
movl %ebp, %edi
callq 0x118fa
testl %eax, %eax
je 0x14a67
xorl %r12d, %r12d
cmpb $0x1, 0x17(%rsp)
jne 0x149ce
cmpb $0x0, 0x15(%rsp)
jne 0x149ce
cmpb $0x1, 0x16(%rsp)
jne 0x149e4
movq 0x5118(%rbx), %rdi
leaq 0x56d01(%rip), %rsi     # 0x6b6dd
xorl %eax, %eax
callq *0x50f8(%rbx)
movq %r14, %rdi
callq 0x10f6e
movq 0x18(%rsp), %r15
testb %r12b, %r12b
je 0x14a08
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x127a5
jmp 0x14b04
movl (%r15), %eax
cmpl $0x18, %eax
ja 0x14b77
movl $0x1ec0000, %ecx        # imm = 0x1EC0000
btl %eax, %ecx
jae 0x14b64
movq %r15, %r14
leaq 0x4e70(%rbx), %r15
movq %r15, %rdi
callq 0xedd1
movl (%r14), %esi
movq %r15, %rdi
callq 0xee17
movq %r14, 0x28(%rsp)
leaq 0x20(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
callq 0xd3a5
cmpl $0x20, %ebp
jne 0x14acc
cmpl $0x14, (%r14)
jne 0x14acc
pushq $0x20
popq %r9
jmp 0x14ad6
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2c, %eax
jne 0x14b11
movq 0x18(%rsp), %r12
movl (%r12), %eax
cmpl $0x18, %eax
ja 0x14baa
movl $0x1ec0000, %ecx        # imm = 0x1EC0000
btl %eax, %ecx
jae 0x14b96
movq %r12, %r15
leaq 0x4e18(%rbx), %rdi
movq 0x5240(%rbx), %rsi
movq %r15, %rdx
callq 0x15600
addq $0x4e70, %rbx           # imm = 0x4E70
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0xf1d3
movq %r14, %rdi
callq 0x10f6e
jmp 0x14b04
movl %ebp, %edi
callq 0x118fa
movl %eax, %r9d
andl $0x0, 0x8(%rsp)
movl $0x1, (%rsp)
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x9f5c
movq %r15, %rdi
movq %r14, %rsi
callq 0xf0c9
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x15(%rsp)
jne 0x14b2e
movq 0x5118(%rbx), %rdi
leaq 0x56c52(%rip), %rsi     # 0x6b778
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x18(%rsp), %rax
cmpl $0x2, (%rax)
je 0x14b04
addq $0x4e70, %rbx           # imm = 0x4E70
movq %rbx, %rdi
callq 0xed28
jmp 0x14b04
movq 0x5118(%rbx), %rdi
leaq 0x56c08(%rip), %rsi     # 0x6b75f
xorl %eax, %eax
callq *0x50f8(%rbx)
jmp 0x149a7
cmpl $0x10, %eax
jne 0x14b77
movq 0x8(%r15), %r14
cmpl $0x2, (%r14)
jne 0x14a25
movq 0x5118(%rbx), %rdi
leaq 0x56b58(%rip), %rsi     # 0x6b6dd
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x8(%r15), %r14
jmp 0x14a25
cmpl $0x10, %eax
jne 0x14baa
movq 0x8(%r12), %r15
cmpl $0x2, (%r15)
jne 0x14a98
movq 0x5118(%rbx), %rdi
leaq 0x56b25(%rip), %rsi     # 0x6b6dd
xorl %eax, %eax
callq *0x50f8(%rbx)
movq 0x8(%r12), %r15
jmp 0x14a98