// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rsi, %rdx
movq %rdi, %r13
movq 0x8(%rdi), %rsi
movq 0x18(%rdi), %rax
movq 0x38(%rax), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1703b
movq %rax, %rbp
movq (%r13), %r12
cmpl $0x3, 0x8(%rax)
jne 0x1c26c
movsd (%rbp), %xmm0
addsd 0x40fa(%rip), %xmm0     # 0x20330
movsd %xmm0, 0x10(%rsp)
movslq 0x10(%rsp), %r15
movq 0x10(%r12), %rsi
movq %r15, %rax
shlq $0x4, %rax
movl 0x8(%rsi,%rax), %ecx
cmpl 0x8(%r14), %ecx
jne 0x1c26c
addq %rax, %rsi
xorl %edi, %edi
movq %r14, %rdx
callq 0x19042
testl %eax, %eax
jne 0x1c419
movslq 0x54(%r12), %rbx
movl 0x34(%r13), %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, (%rbp)
movl $0x3, 0x8(%rbp)
movl 0x54(%r12), %edx
cmpl %edx, %r15d
jl 0x1c2c3
leaq 0x54(%r12), %rdx
movq 0x10(%r12), %rsi
leaq 0x60f6(%rip), %r9       # 0x2239a
movl $0x10, %ecx
movq 0x8(%rsp), %rdi
movl $0x3ffffff, %r8d        # imm = 0x3FFFFFF
callq 0xfaf0
movq %rax, 0x10(%r12)
movl 0x54(%r12), %edx
movslq %r15d, %rax
movq 0x10(%r12), %rcx
cmpl %edx, %ebx
jge 0x1c3df
movslq %edx, %rsi
subq %rbx, %rsi
leaq 0x3(%rsi), %rdx
andq $-0x4, %rdx
decq %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shlq $0x4, %rbx
leaq (%rbx,%rcx), %rsi
addq $0x38, %rsi
xorl %edi, %edi
movdqa 0x3ffc(%rip), %xmm1     # 0x20300
movdqa 0x4004(%rip), %xmm2     # 0x20310
movdqa 0x400c(%rip), %xmm3     # 0x20320
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdi, %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, %r8d
notl %r8d
testb $0x1, %r8b
je 0x1c368
movl $0x0, -0x30(%rsi)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x1c37f
movl $0x0, -0x20(%rsi)
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, %r8d
testb $0x1, %r8b
je 0x1c3bc
movl $0x0, -0x10(%rsi)
pextrw $0x4, %xmm5, %r8d
testb $0x1, %r8b
je 0x1c3ce
movl $0x0, (%rsi)
addq $0x4, %rdi
addq $0x40, %rsi
cmpq %rdi, %rdx
jne 0x1c31c
shlq $0x4, %rax
movq (%r14), %rdx
movq %rdx, (%rcx,%rax)
movl 0x8(%r14), %edx
movl %edx, 0x8(%rcx,%rax)
incl 0x34(%r13)
testb $0x40, %dl
je 0x1c419
movq (%r14), %rdx
testb $0x3, 0x9(%rdx)
je 0x1c419
testb $0x4, 0x9(%r12)
je 0x1c419
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0xc950
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq