// File: /workspace/github_c_makefile_star2_O0/afi-lambda[P]a_little_smalltalk/src/names.c
// Function: nameTableInsert
void nameTableInsert(object dict, int hash, object key, object value)
{
    object table, link, nwLink, nextLink, tablentry;

    /* first get the hash table */
    table = basicAt(dict, 1);

    if (sizeField(table) < 3)
        sysError("attempt to insert into", "too small name table");
    else
    {
        hash = 3 * (hash % (sizeField(table) / 3));
        tablentry = basicAt(table, hash+1);
        if ((tablentry == nilobj) || (tablentry == key))
        {
            basicAtPut(table, hash+1, key);
            basicAtPut(table, hash+2, value);
        }
        else
        {
            nwLink = newLink(key, value);
            incr(nwLink);
            link = basicAt(table, hash+3);
            if (link == nilobj)
            {
                basicAtPut(table, hash+3, nwLink);
            }
            else
                while (1)
                    if (basicAt(link,1) == key)
                    {
                        basicAtPut(link, 2, value);
                        break;
                    }
                    else if ((nextLink = basicAt(link, 3)) == nilobj)
                    {
                        basicAtPut(link, 3, nwLink);
                        break;
                    }
                    else
                        link = nextLink;
            decr(nwLink);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %cx, %ax
movw %dx, %cx
movw %di, %dx
movw %dx, -0x2(%rbp)
movl %esi, -0x8(%rbp)
movw %cx, -0xa(%rbp)
movw %ax, -0xc(%rbp)
movswl -0x2(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcd60(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movw (%rax), %ax
movw %ax, -0xe(%rbp)
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcd3e(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movswl 0x4(%rax), %eax
cmpl $0x3, %eax
jge 0x354a
leaq 0x8c91(%rip), %rdi      # 0xc1ca
leaq 0x8ca1(%rip), %rsi      # 0xc1e1
callq 0x63f0
jmp 0x3790
movl -0x8(%rbp), %eax
movl %eax, -0x1c(%rbp)
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcd00(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movswl 0x4(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x1c(%rbp), %eax
cltd
idivl %ecx
imull $0x3, %edx, %eax
movl %eax, -0x8(%rbp)
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcccf(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %ax
movw %ax, -0x16(%rbp)
movswl -0x16(%rbp), %eax
cmpl $0x0, %eax
je 0x35c5
movswl -0x16(%rbp), %eax
movswl -0xa(%rbp), %ecx
cmpl %ecx, %eax
jne 0x3638
movw -0xa(%rbp), %ax
movswl -0xe(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0xcc87(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl -0x8(%rbp), %edx
addl $0x1, %edx
subl $0x1, %edx
movslq %edx, %rdx
movw %ax, (%rcx,%rdx,2)
movswl %ax, %edi
callq 0x2fd0
movw -0xc(%rbp), %ax
movswl -0xe(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0xcc50(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl -0x8(%rbp), %edx
addl $0x2, %edx
subl $0x1, %edx
movslq %edx, %rdx
movw %ax, (%rcx,%rdx,2)
movswl %ax, %edi
callq 0x2fd0
jmp 0x378e
movw -0xa(%rbp), %ax
movswl %ax, %edi
movswl -0xc(%rbp), %esi
callq 0x44b0
movw %ax, -0x12(%rbp)
movswl -0x12(%rbp), %edi
callq 0x2fd0
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcbfb(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x8(%rbp), %ecx
addl $0x3, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %ax
movw %ax, -0x10(%rbp)
movswl -0x10(%rbp), %eax
cmpl $0x0, %eax
jne 0x36c9
movw -0x12(%rbp), %ax
movswl -0xe(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0xcbbf(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl -0x8(%rbp), %edx
addl $0x3, %edx
subl $0x1, %edx
movslq %edx, %rdx
movw %ax, (%rcx,%rdx,2)
movswl %ax, %edi
callq 0x2fd0
jmp 0x3785
jmp 0x36cb
movswl -0x10(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcb85(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movswl (%rax), %eax
movswl -0xa(%rbp), %ecx
cmpl %ecx, %eax
jne 0x371e
movw -0xc(%rbp), %ax
movswl -0x10(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0xcb5b(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movw %ax, 0x2(%rcx)
movswl %ax, %edi
callq 0x2fd0
jmp 0x3783
movswl -0x10(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0xcb32(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movw 0x4(%rax), %ax
movw %ax, -0x14(%rbp)
cwtl
cmpl $0x0, %eax
jne 0x3774
movw -0x12(%rbp), %ax
movswl -0x10(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0xcb05(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movw %ax, 0x4(%rcx)
movswl %ax, %edi
callq 0x2fd0
jmp 0x3783
movw -0x14(%rbp), %ax
movw %ax, -0x10(%rbp)
jmp 0x377e
jmp 0x36cb
jmp 0x3785
movswl -0x12(%rbp), %edi
callq 0x3020
jmp 0x3790
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)