// File: /workspace/github_c_makefile_star2_O3/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 0x1e223(%rip), %rsi     # 0x24254
movl 0x1e221(%rip), %ecx     # 0x24258
movl 0x1e1be(%rip), %r8d     # 0x241fc
movl %ecx, %eax
subl %r8d, %eax
subl %esi, %eax
movq 0x1e1e4(%rip), %r14     # 0x24230
movq 0x1e1e5(%rip), %r11     # 0x24238
movq 0x1e1e6(%rip), %r9      # 0x24240
movq 0x8(%rdi), %r10
cmpq $0x40, %rsi
jl 0x60c0
leal -0x40(%rsi), %ecx
cmpl $0x0, 0x1e1e2(%rip)     # 0x24250
movq (%rdi), %rdx
je 0x61ac
subq %rdx, %r10
jle 0x6383
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 0x608e
jmp 0x6383
movl 0x1e18a(%rip), %ebp     # 0x24250
testl %ebp, %ebp
sete %dl
cmpl $0x40, %ecx
setge %r15b
andb %dl, %r15b
cmpb $0x1, %r15b
jne 0x6155
subl %r8d, %ecx
addl $-0x40, %ecx
movq (%rdi), %rax
js 0x621b
subq %rax, %r10
jle 0x6383
movl %ecx, %r8d
movq 0x1e14b(%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 0x6104
jmp 0x6383
movq (%rdi), %rdx
testl %ebp, %ebp
je 0x6283
testl %esi, %esi
je 0x62f3
subq %rdx, %r10
jle 0x6383
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 0x6178
jmp 0x6383
subq %rdx, %r10
jle 0x6383
movl %ecx, %esi
movl %eax, %r8d
movq 0x1e087(%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 0x61cc
jmp 0x6383
subq %rax, %r10
jle 0x6383
movq 0x1e01d(%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 0x6232
jmp 0x6383
testl %esi, %esi
je 0x632d
subq %rdx, %r10
jle 0x6383
movl %eax, %r8d
movq 0x1dfaa(%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 0x62a5
jmp 0x6383
subq %rdx, %r10
jle 0x6383
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 0x6303
jmp 0x6383
subq %rdx, %r10
jle 0x6383
movl %eax, %ecx
movq 0x1df0d(%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 0x6342
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq