// File: /workspace/github_c_makefile_star2_O1/thegenemyers[P]DAMASKER/tandem.c
// Function: lex_thread
static void *lex_thread(void *arg)
{ Lex_Arg    *data  = (Lex_Arg *) arg;
  int64      *sptr  = data->sptr;
  int64      *tptr  = data->tptr;
  int         shift = LEX_shift;   //  Must be a multiple of 8 in [0,120]
  int        qshift = (LEX_next - LEX_shift) - NSHIFT;
  int64       zsize = LEX_zsize;
  Double     *src   = LEX_src;
  Double     *trg   = LEX_trg;
  int64       i, n, x;
  uint64      c, b;

  n = data->end;
  if (shift >= 64)
    { shift -= 64;
      if (LEX_last)
        for (i = data->beg; i < n; i++)
          { c = src[i].p2;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
          }
      else
        for (i = data->beg; i < n; i++)
          { c = src[i].p2;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
            sptr[((b >> qshift) & QMASK) + x/zsize] += 1;
          }
    }

  else if ( ! LEX_last && LEX_next >= 64)   //  && LEX_shift < 64

    { qshift = (LEX_next - 64) - NSHIFT;
      if (qshift < 0)
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
            sptr[((src[i].p2 << NSHIFT) & QMASK) + x/zsize] += 1;
          }
      else
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
            sptr[((src[i].p2 >> qshift) & QMASK) + x/zsize] += 1;
          }
    }

  else // LEX_last || LEX_next < 64
    if (LEX_last)
      if (shift == 0)
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            x = tptr[c&BMASK]++;
            trg[x] = src[i];
          }
      else
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
          }
    else
      if (shift == 0)
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            x = tptr[c&BMASK]++;
            trg[x] = src[i];
            sptr[((c >> qshift) & QMASK) + x/zsize] += 1;
          }
      else
        for (i = data->beg; i < n; i++)
          { c = src[i].p1;
            b = (c >> shift);
            x = tptr[b&BMASK]++;
            trg[x] = src[i];
            sptr[((b >> qshift) & QMASK) + x/zsize] += 1;
          }

  return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x810(%rdi), %rbx
movslq 0x1e59c(%rip), %rsi     # 0x24254
movl 0x1e59a(%rip), %ecx     # 0x24258
movl 0x1e537(%rip), %r8d     # 0x241fc
movl %ecx, %eax
subl %r8d, %eax
subl %esi, %eax
movq 0x1e55d(%rip), %r14     # 0x24230
movq 0x1e55e(%rip), %r11     # 0x24238
movq 0x1e55f(%rip), %r9      # 0x24240
movq 0x8(%rdi), %r10
cmpq $0x40, %rsi
jl 0x5d47
leal -0x40(%rsi), %ecx
cmpl $0x0, 0x1e55b(%rip)     # 0x24250
movq (%rdi), %rdx
je 0x5e33
subq %rdx, %r10
jle 0x600a
movl %ecx, %ecx
shlq $0x4, %rdx
leaq (%rdx,%r11), %rax
addq $0x8, %rax
movq (%rax), %rdx
shrq %cl, %rdx
movzbl %dl, %edx
movq 0x10(%rdi,%rdx,8), %rsi
leaq 0x1(%rsi), %r8
movq %r8, 0x10(%rdi,%rdx,8)
shlq $0x4, %rsi
movups -0x8(%rax), %xmm0
movups %xmm0, (%r9,%rsi)
addq $0x10, %rax
decq %r10
jne 0x5d15
jmp 0x600a
movl 0x1e503(%rip), %ebp     # 0x24250
testl %ebp, %ebp
sete %dl
cmpl $0x40, %ecx
setge %r15b
andb %dl, %r15b
cmpb $0x1, %r15b
jne 0x5ddc
subl %r8d, %ecx
addl $-0x40, %ecx
movq (%rdi), %rax
js 0x5ea2
subq %rax, %r10
jle 0x600a
movl %ecx, %r8d
movq 0x1e4c4(%rip), %r15     # 0x24248
shlq $0x4, %rax
addq %rax, %r11
movq (%r11), %rax
movl %esi, %ecx
shrq %cl, %rax
movzbl %al, %ecx
movq 0x10(%rdi,%rcx,8), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rdi,%rcx,8)
movq %rax, %rcx
shlq $0x4, %rcx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rcx)
movq 0x8(%r11), %r12
movl %r8d, %ecx
shrq %cl, %r12
andq %r15, %r12
cqto
idivq %r14
leaq (%rbx,%r12,8), %rcx
incq (%rcx,%rax,8)
addq $0x10, %r11
decq %r10
jne 0x5d8b
jmp 0x600a
movq (%rdi), %rdx
testl %ebp, %ebp
je 0x5f0a
testl %esi, %esi
je 0x5f7a
subq %rdx, %r10
jle 0x600a
shlq $0x4, %rdx
addq %rdx, %r11
movq (%r11), %rax
movl %esi, %ecx
shrq %cl, %rax
movzbl %al, %eax
movq 0x10(%rdi,%rax,8), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rdi,%rax,8)
shlq $0x4, %rcx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rcx)
addq $0x10, %r11
decq %r10
jne 0x5dff
jmp 0x600a
subq %rdx, %r10
jle 0x600a
movl %ecx, %esi
movl %eax, %r8d
movq 0x1e400(%rip), %r15     # 0x24248
shlq $0x4, %rdx
addq %rdx, %r11
addq $0x8, %r11
movq (%r11), %r12
movl %esi, %ecx
shrq %cl, %r12
movzbl %r12b, %ecx
movq 0x10(%rdi,%rcx,8), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rdi,%rcx,8)
movq %rax, %rcx
shlq $0x4, %rcx
movups -0x8(%r11), %xmm0
movups %xmm0, (%r9,%rcx)
movl %r8d, %ecx
shrq %cl, %r12
andq %r15, %r12
cqto
idivq %r14
leaq (%rbx,%r12,8), %rcx
incq (%rcx,%rax,8)
addq $0x10, %r11
decq %r10
jne 0x5e53
jmp 0x600a
subq %rax, %r10
jle 0x600a
movq 0x1e396(%rip), %r15     # 0x24248
shlq $0x4, %rax
addq %rax, %r11
movq (%r11), %rax
movl %esi, %ecx
shrq %cl, %rax
movzbl %al, %ecx
movq 0x10(%rdi,%rcx,8), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rdi,%rcx,8)
movq %rax, %rcx
shlq $0x4, %rcx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rcx)
movq 0x8(%r11), %r12
movl %r8d, %ecx
shlq %cl, %r12
andq %r15, %r12
cqto
idivq %r14
leaq (%rbx,%r12,8), %rcx
incq (%rcx,%rax,8)
addq $0x10, %r11
decq %r10
jne 0x5eb9
jmp 0x600a
testl %esi, %esi
je 0x5fb4
subq %rdx, %r10
jle 0x600a
movl %eax, %r8d
movq 0x1e323(%rip), %r15     # 0x24248
shlq $0x4, %rdx
addq %rdx, %r11
movq (%r11), %r12
movl %esi, %ecx
shrq %cl, %r12
movzbl %r12b, %ecx
movq 0x10(%rdi,%rcx,8), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rdi,%rcx,8)
movq %rax, %rcx
shlq $0x4, %rcx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rcx)
movl %r8d, %ecx
shrq %cl, %r12
andq %r15, %r12
cqto
idivq %r14
leaq (%rbx,%r12,8), %rcx
incq (%rcx,%rax,8)
addq $0x10, %r11
decq %r10
jne 0x5f2c
jmp 0x600a
subq %rdx, %r10
jle 0x600a
shlq $0x4, %rdx
addq %rdx, %r11
movzbl (%r11), %eax
movq 0x10(%rdi,%rax,8), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rdi,%rax,8)
shlq $0x4, %rcx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rcx)
addq $0x10, %r11
decq %r10
jne 0x5f8a
jmp 0x600a
subq %rdx, %r10
jle 0x600a
movl %eax, %ecx
movq 0x1e286(%rip), %rsi     # 0x24248
shlq $0x4, %rdx
addq %rdx, %r11
movq (%r11), %r8
movzbl %r8b, %edx
movq 0x10(%rdi,%rdx,8), %rax
leaq 0x1(%rax), %r15
movq %r15, 0x10(%rdi,%rdx,8)
movq %rax, %rdx
shlq $0x4, %rdx
movups (%r11), %xmm0
movups %xmm0, (%r9,%rdx)
shrq %cl, %r8
andq %rsi, %r8
cqto
idivq %r14
leaq (%rbx,%r8,8), %rdx
incq (%rdx,%rax,8)
addq $0x10, %r11
decq %r10
jne 0x5fc9
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq