// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_expr.c
// Function: parseBuiltinMathCall
static void parseBuiltinMathCall(Compiler *comp, const Type **type, Const *constant, BuiltinFunc builtin)
{
    const Type *argType = (builtin == BUILTIN_ABS) ? comp->intType : comp->realType;

    *type = argType;
    parseExpr(comp, type, constant);
    doAssertImplicitTypeConv(comp, argType, type, constant);

    Const constant2Val = {.realVal = 0};
    Const *constant2 = NULL;

    // fn atan2(y, x: real): real
    if (builtin == BUILTIN_ATAN2)
    {
        lexEat(&comp->lex, TOK_COMMA);

        const Type *type2 = comp->realType;
        if (constant)
            constant2 = &constant2Val;

        parseExpr(comp, &type2, constant2);
        doAssertImplicitTypeConv(comp, comp->realType, &type2, constant2);
    }

    if (constant)
        constCallBuiltin(&comp->consts, constant, constant2, argType->kind, builtin);
    else
        genCallBuiltin(&comp->gen, argType->kind, builtin);

    if (builtin == BUILTIN_ROUND || builtin == BUILTIN_TRUNC || builtin == BUILTIN_CEIL || builtin == BUILTIN_FLOOR || builtin == BUILTIN_ABS)
        *type = comp->intType;
    else
        *type = comp->realType;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpl $0xc, -0x1c(%rbp)
jne 0x1137e
movq -0x8(%rbp), %rax
movq 0x5240(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x1138d
movq -0x8(%rbp), %rax
movq 0x5280(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xe8c0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0xd6e0
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x3190
movq $0x0, -0x38(%rbp)
cmpl $0x12, -0x1c(%rbp)
jne 0x11444
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
movl $0x3f, %esi
callq 0x1b150
movq -0x8(%rbp), %rax
movq 0x5280(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x11417
leaq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %rsi
callq 0xe8c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x5280(%rax), %rsi
movq -0x38(%rbp), %rcx
leaq -0x40(%rbp), %rdx
callq 0xd6e0
cmpq $0x0, -0x18(%rbp)
je 0x1146f
movq -0x8(%rbp), %rdi
addq $0x4e68, %rdi           # imm = 0x4E68
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movl -0x1c(%rbp), %r8d
callq 0x9390
jmp 0x11488
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
movq -0x28(%rbp), %rax
movl (%rax), %esi
movl -0x1c(%rbp), %edx
callq 0x18040
cmpl $0x8, -0x1c(%rbp)
je 0x114a6
cmpl $0x9, -0x1c(%rbp)
je 0x114a6
cmpl $0xa, -0x1c(%rbp)
je 0x114a6
cmpl $0xb, -0x1c(%rbp)
je 0x114a6
cmpl $0xc, -0x1c(%rbp)
jne 0x114ba
movq -0x8(%rbp), %rax
movq 0x5240(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x114cc
movq -0x8(%rbp), %rax
movq 0x5280(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)