// File: /workspace/github_c_makefile_star2_O0/afi-lambda[P]a_little_smalltalk/src/primitive.c
// Function: primitive
object primitive(register int primitiveNumber, object *arguments)
{
    register int primitiveGroup = primitiveNumber / 10;
    object returnedObject;

    if (primitiveNumber >= 150)
    {
        /* system dependent primitives, handled in separate module */
        returnedObject = sysPrimitive(primitiveNumber, arguments);
    }
    else
    {
        switch (primitiveGroup)
        {
        case 0:
            returnedObject = zeroaryPrims(primitiveNumber);
            break;
        case 1:
            returnedObject = unaryPrims(primitiveNumber - 10, arguments[0]);
            break;
        case 2:
            returnedObject = binaryPrims(primitiveNumber - 20, arguments[0],
                                         arguments[1]);
            break;
        case 3:
            returnedObject = trinaryPrims(primitiveNumber - 30, arguments[0],
                                          arguments[1], arguments[2]);
            break;

        case 5: /* integer unary operations */
            if (!isInteger(arguments[0]))
                returnedObject = nilobj;
            else
                returnedObject = intUnary(primitiveNumber - 50,
                                          intValue(arguments[0]));
            break;

        case 6:
        case 7: /* integer binary operations */
            if ((!isInteger(arguments[0])) || !isInteger(arguments[1]))
                returnedObject = nilobj;
            else
                returnedObject = intBinary(primitiveNumber - 60,
                                           intValue(arguments[0]), intValue(arguments[1]));
            break;

        case 8: /* string unary */
            returnedObject = strUnary(primitiveNumber - 80,
                                      charPtr(arguments[0]));
            break;

        case 10: /* float unary */
            returnedObject = floatUnary(primitiveNumber - 100, floatValue(
                                            arguments[0]));
            break;

        case 11: /* float binary */
            returnedObject = floatBinary(primitiveNumber - 110, floatValue(
                                             arguments[0]), floatValue(arguments[1]));
            break;

        case 12:
        case 13: /* file operations */

            returnedObject = ioPrimitive(primitiveNumber - 120, arguments);
            break;

        default:
            sysError("unknown primitive number", "doPrimitive");
            break;
        }
    }

    return (returnedObject);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
cmpl $0x96, -0x4(%rbp)
jl 0x668b
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x6550
movw %ax, -0x16(%rbp)
jmp 0x68ec
movl -0x14(%rbp), %eax
movq %rax, -0x20(%rbp)
subq $0xd, %rax
ja 0x68d7
movq -0x20(%rbp), %rax
leaq 0x5e39(%rip), %rcx      # 0xc4e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x4(%rbp), %edi
callq 0x6900
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %edi
subl $0xa, %edi
movq -0x10(%rbp), %rax
movswl (%rax), %esi
callq 0x6a00
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %edi
subl $0x14, %edi
movq -0x10(%rbp), %rax
movw (%rax), %cx
movq -0x10(%rbp), %rax
movswl %cx, %esi
movswl 0x2(%rax), %edx
callq 0x6df0
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %edi
subl $0x1e, %edi
movq -0x10(%rbp), %rax
movw (%rax), %dx
movq -0x10(%rbp), %rax
movw 0x2(%rax), %cx
movq -0x10(%rbp), %rax
movswl %dx, %esi
movswl %cx, %edx
movswl 0x4(%rax), %ecx
callq 0x74d0
movw %ax, -0x16(%rbp)
jmp 0x68ea
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x2fb0
cmpl $0x0, %eax
jne 0x674c
movw $0x0, -0x16(%rbp)
jmp 0x676f
movl -0x4(%rbp), %eax
subl $0x32, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x3470
movl -0x24(%rbp), %edi
movl %eax, %esi
callq 0x7940
movw %ax, -0x16(%rbp)
jmp 0x68ea
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x6797
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %edi
callq 0x2fb0
cmpl $0x0, %eax
jne 0x679f
movw $0x0, -0x16(%rbp)
jmp 0x67d5
movl -0x4(%rbp), %eax
subl $0x3c, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x3470
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %edi
callq 0x3470
movl -0x2c(%rbp), %edi
movl -0x28(%rbp), %esi
movl %eax, %edx
callq 0x79f0
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %eax
subl $0x50, %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movw (%rax), %ax
leaq 0x230bf(%rip), %rcx     # 0x298b0
movw %ax, (%rcx)
movswl %ax, %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x6828
leaq 0x230a8(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x9a49(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x684d
leaq 0x23081(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x9a22(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x30(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x7c30
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %eax
subl $0x64, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x4410
movl -0x3c(%rbp), %edi
callq 0x7d10
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %eax
subl $0x6e, %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
callq 0x4410
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %edi
callq 0x4410
movl -0x4c(%rbp), %edi
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
callq 0x7e90
movw %ax, -0x16(%rbp)
jmp 0x68ea
movl -0x4(%rbp), %edi
subl $0x78, %edi
movq -0x10(%rbp), %rsi
callq 0xb7e0
movw %ax, -0x16(%rbp)
jmp 0x68ea
leaq 0x5da2(%rip), %rdi      # 0xc680
leaq 0x5db4(%rip), %rsi      # 0xc699
callq 0x63f0
jmp 0x68ec
movw -0x16(%rbp), %ax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)