// File: /workspace/github_c_makefile_star2_O0/afi-lambda[P]a_little_smalltalk/src/primitive.c
// Function: unaryPrims
static int unaryPrims(int number, object firstarg)
{
    int i, j, saveLinkPointer;
    object returnedObject, saveProcessStack;

    returnedObject = firstarg;
    switch (number)
    {
    case 1: /* class of object */
        returnedObject = getClass(firstarg);
        break;

    case 2: /* basic size of object */
        if (isInteger(firstarg))
            i = 0;
        else
        {
            i = sizeField(firstarg);
            /* byte objects have negative size */
            if (i < 0)
                i = (-i);
        }
        returnedObject = newInteger(i);
        break;

    case 3: /* hash value of object */
        if (isInteger(firstarg))
            returnedObject = firstarg;
        else
            returnedObject = newInteger(firstarg);
        break;

    case 4: /* debugging print */
        fprintf(stderr, "primitive 14 %d\n", firstarg);
        break;

    case 8: /* change return point - block return */
        /* first get previous link pointer */
        i = intValue(basicAt(processStack, linkPointer));
        /* then creating context pointer */
        j = intValue(basicAt(firstarg, 1));
        if (basicAt(processStack, j+1) != firstarg)
        {
            returnedObject = falseobj;
            break;
        }
        /* first change link pointer to that of creator */
        fieldAtPut(processStack, i,
                   basicAt(processStack, j))
        ;
        /* then change return point to that of creator */
        fieldAtPut(processStack, i+2,
                   basicAt(processStack, j+2))
        ;
        returnedObject = trueobj;
        break;

    case 9: /* process execute */
        /* first save the values we are about to clobber */
        saveProcessStack = processStack;
        saveLinkPointer = linkPointer;
        /* trap control-C */
        signal(SIGINT, brkfun);
        if (setjmp(jb))
        {
            returnedObject = falseobj;
        }
        else if (execute(firstarg, 5000))
            returnedObject = trueobj;
        else
            returnedObject = falseobj;
        /* then restore previous environment */
        processStack = saveProcessStack;
        linkPointer = saveLinkPointer;
        signal(SIGINT, brkdum);
        break;

    default: /* unknown primitive */
        sysError("unknown primitive", "unaryPrims");
        break;
    }
    return (returnedObject);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movl %edi, -0x4(%rbp)
movw %ax, -0x6(%rbp)
movw -0x6(%rbp), %ax
movw %ax, -0x16(%rbp)
movl -0x4(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x8, %eax
ja 0x6dc6
movq -0x20(%rbp), %rax
leaq 0x5b03(%rip), %rcx      # 0xc53c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movswl -0x6(%rbp), %edi
callq 0x3ce0
movw %ax, -0x16(%rbp)
jmp 0x6dd9
movswl -0x6(%rbp), %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x6a6b
movl $0x0, -0xc(%rbp)
jmp 0x6a99
movswl -0x6(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x97e5(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movswl 0x4(%rax), %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x6a97
xorl %eax, %eax
subl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x6a99
movl -0xc(%rbp), %edi
callq 0x34a0
movw %ax, -0x16(%rbp)
jmp 0x6dd9
movswl -0x6(%rbp), %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x6ac2
movw -0x6(%rbp), %ax
movw %ax, -0x16(%rbp)
jmp 0x6acf
movswl -0x6(%rbp), %edi
callq 0x34a0
movw %ax, -0x16(%rbp)
jmp 0x6dd9
movq 0x851d(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movswl -0x6(%rbp), %edx
leaq 0x5beb(%rip), %rsi      # 0xc6d4
movb $0x0, %al
callq 0x2170
jmp 0x6dd9
leaq 0x234ec(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x9755(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq 0x234cf(%rip), %rcx     # 0x29fec
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %edi
callq 0x3470
movl %eax, -0xc(%rbp)
movswl -0x6(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x971f(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movswl (%rax), %edi
callq 0x3470
movl %eax, -0x10(%rbp)
leaq 0x2348a(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x96f3(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %eax
movswl -0x6(%rbp), %ecx
cmpl %ecx, %eax
je 0x6ba3
leaq 0x2345d(%rip), %rax     # 0x29ff4
movw (%rax), %ax
movw %ax, -0x16(%rbp)
jmp 0x6dd9
movl -0xc(%rbp), %ecx
leaq 0x22d0b(%rip), %rax     # 0x298b8
movl %ecx, (%rax)
leaq 0x23432(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x969b(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq 0x22ce1(%rip), %rcx     # 0x298b8
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %edi
callq 0x3020
leaq 0x233f9(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x9662(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %ax
leaq 0x233cb(%rip), %rcx     # 0x29fe8
movswl (%rcx), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0x9634(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
leaq 0x22c7a(%rip), %rdx     # 0x298b8
movl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movw %ax, (%rcx,%rdx,2)
movswl %ax, %edi
callq 0x2fd0
movl -0xc(%rbp), %ecx
addl $0x2, %ecx
leaq 0x22c59(%rip), %rax     # 0x298b8
movl %ecx, (%rax)
leaq 0x23380(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x95e9(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq 0x22c2f(%rip), %rcx     # 0x298b8
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %edi
callq 0x3020
leaq 0x23347(%rip), %rax     # 0x29fe8
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x95b0(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0x2, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %ax
leaq 0x23316(%rip), %rcx     # 0x29fe8
movswl (%rcx), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0x957f(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
leaq 0x22bc5(%rip), %rdx     # 0x298b8
movl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movw %ax, (%rcx,%rdx,2)
movswl %ax, %edi
callq 0x2fd0
leaq 0x232e4(%rip), %rax     # 0x29ff2
movw (%rax), %ax
movw %ax, -0x16(%rbp)
jmp 0x6dd9
leaq 0x232c7(%rip), %rax     # 0x29fe8
movw (%rax), %ax
movw %ax, -0x18(%rbp)
leaq 0x232bd(%rip), %rax     # 0x29fec
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x2, %edi
leaq -0x730(%rip), %rsi      # 0x6610
callq 0x2160
leaq 0x232b4(%rip), %rdi     # 0x2a000
callq 0x2130
cmpl $0x0, %eax
je 0x6d66
leaq 0x23297(%rip), %rax     # 0x29ff4
movw (%rax), %ax
movw %ax, -0x16(%rbp)
jmp 0x6d99
movl $0x1388, %esi           # imm = 0x1388
movswl -0x6(%rbp), %edi
callq 0x4690
cmpl $0x0, %eax
je 0x6d89
leaq 0x23272(%rip), %rax     # 0x29ff2
movw (%rax), %ax
movw %ax, -0x16(%rbp)
jmp 0x6d97
leaq 0x23264(%rip), %rax     # 0x29ff4
movw (%rax), %ax
movw %ax, -0x16(%rbp)
jmp 0x6d99
movw -0x18(%rbp), %cx
leaq 0x23244(%rip), %rax     # 0x29fe8
movw %cx, (%rax)
movl -0x14(%rbp), %ecx
leaq 0x2323b(%rip), %rax     # 0x29fec
movl %ecx, (%rax)
movl $0x2, %edi
leaq -0x78f(%rip), %rsi      # 0x6630
callq 0x2160
jmp 0x6dd9
leaq 0x56f2(%rip), %rdi      # 0xc4bf
leaq 0x5911(%rip), %rsi      # 0xc6e5
callq 0x63f0
movswl -0x16(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)