// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lcode.c
// Function: addk
static int addk (FuncState *fs, TValue *key, TValue *v) {
  lua_State *L = fs->ls->L;
  TValue *idx = luaH_set(L, fs->h, key);
  Proto *f = fs->f;
  int k, oldsize;
  if (ttisnumber(idx)) {
    lua_Number n = nvalue(idx);
    lua_number2int(k, n);
    if (luaV_rawequalobj(&f->k[k], v))
      return k;
    /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
       go through and create a new entry for this value */
  }
  /* constant not found; create a new entry */
  oldsize = f->sizek;
  k = fs->nk;
  /* numerical value does not need GC barrier;
     table has no metatable, so it does not need to invalidate cache */
  setnvalue(idx, cast_num(k));
  luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
  while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
  setobj(L, &f->k[k], v);
  fs->nk++;
  luaC_barrier(L, f, v);
  return k;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %rdx
movq %rdi, %r13
movq 0x8(%rdi), %rsi
movq 0x18(%rdi), %rax
movq 0x38(%rax), %rdi
movq %rdi, 0x8(%rsp)
callq 0x16f5c
movq %rax, %rbp
movq (%r13), %r12
cmpl $0x3, 0x8(%rax)
jne 0x1c244
movsd (%rbp), %xmm0
addsd 0x4100(%rip), %xmm0     # 0x20308
movsd %xmm0, 0x10(%rsp)
movslq 0x10(%rsp), %r8
movq 0x10(%r12), %rsi
movq %r8, %rax
shlq $0x4, %rax
movl 0x8(%rsi,%rax), %ecx
cmpl 0x8(%r15), %ecx
jne 0x1c244
addq %rax, %rsi
xorl %edi, %edi
movq %r15, %rdx
movq %r8, %r14
callq 0x18fda
movq %r14, %r9
testl %eax, %eax
jne 0x1c3fb
leaq 0x54(%r12), %rbx
movslq 0x54(%r12), %r14
movl 0x34(%r13), %r9d
xorps %xmm0, %xmm0
cvtsi2sd %r9d, %xmm0
movsd %xmm0, (%rbp)
movl $0x3, 0x8(%rbp)
cmpl 0x54(%r12), %r9d
jl 0x1c29c
movq 0x10(%r12), %rsi
movq %r9, %rbp
leaq 0x611e(%rip), %r9       # 0x2239a
movl $0x10, %ecx
movq 0x8(%rsp), %rdi
movq %rbx, %rdx
movl $0x3ffffff, %r8d        # imm = 0x3FFFFFF
callq 0xf9b0
movq %rbp, %r9
movq %rax, 0x10(%r12)
movslq %r9d, %rax
movslq (%rbx), %rdx
cmpl %edx, %r14d
jge 0x1c3b4
movq 0x10(%r12), %rsi
subq %r14, %rdx
leaq 0x3(%rdx), %rcx
andq $-0x4, %rcx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shlq $0x4, %r14
leaq (%r14,%rsi), %rdx
addq $0x38, %rdx
xorl %esi, %esi
movdqa 0x4582(%rip), %xmm1     # 0x20860
movdqa 0x458a(%rip), %xmm2     # 0x20870
movdqa 0x4592(%rip), %xmm3     # 0x20880
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rsi, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edi
notl %edi
testb $0x1, %dil
je 0x1c340
movl $0x0, -0x30(%rdx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x1c356
movl $0x0, -0x20(%rdx)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %edi
testb $0x1, %dil
je 0x1c392
movl $0x0, -0x10(%rdx)
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x1c3a3
movl $0x0, (%rdx)
addq $0x4, %rsi
addq $0x40, %rdx
cmpq %rsi, %rcx
jne 0x1c2f6
movq 0x10(%r12), %rcx
shlq $0x4, %rax
movq (%r15), %rdx
movq %rdx, (%rcx,%rax)
movl 0x8(%r15), %edx
movl %edx, 0x8(%rcx,%rax)
incl 0x34(%r13)
testb $0x40, 0x8(%r15)
je 0x1c3fb
movq (%r15), %rdx
testb $0x3, 0x9(%rdx)
je 0x1c3fb
testb $0x4, 0x9(%r12)
je 0x1c3fb
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r9, %rbx
callq 0xc83c
movq %rbx, %r9
movl %r9d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq