// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq 0x810(%rdi), %rbx
movslq 0x1d8eb(%rip), %rsi     # 0x22254
movl 0x1d8e9(%rip), %ecx     # 0x22258
movl 0x1d886(%rip), %r8d     # 0x221fc
movl %ecx, %eax
subl %r8d, %eax
subl %esi, %eax
movq 0x1d8ac(%rip), %r14     # 0x22230
movq 0x1d8ad(%rip), %r11     # 0x22238
movq 0x1d8ae(%rip), %r9      # 0x22240
movq 0x8(%rdi), %r10
cmpq $0x40, %rsi
jl 0x49f5
addl $-0x40, %esi
cmpl $0x0, 0x1d8aa(%rip)     # 0x22250
movq (%rdi), %r15
je 0x4b0e
movq %r15, %rax
shlq $0x4, %rax
addq %r11, %rax
addq $0x8, %rax
cmpq %r10, %r15
jge 0x4b01
movq (%rax), %rdx
movl %esi, %ecx
shrq %cl, %rdx
movzbl %dl, %ecx
movq 0x10(%rdi,%rcx,8), %rdx
leaq 0x1(%rdx), %r8
movq %r8, 0x10(%rdi,%rcx,8)
shlq $0x4, %rdx
movups -0x8(%rax), %xmm0
movups %xmm0, (%r9,%rdx)
incq %r15
addq $0x10, %rax
jmp 0x49bd
movl 0x1d855(%rip), %edx     # 0x22250
testl %edx, %edx
sete %bpl
cmpl $0x40, %ecx
setge %r15b
andb %bpl, %r15b
cmpb $0x1, %r15b
jne 0x4a89
subl %r8d, %ecx
addl $-0x40, %ecx
movq (%rdi), %r15
movq 0x1d827(%rip), %r12     # 0x22248
js 0x4b75
movl %ecx, %r8d
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
cmpq %r10, %r15
jge 0x4b01
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), %r13
movl %r8d, %ecx
shrq %cl, %r13
andq %r12, %r13
cqto
idivq %r14
leaq (%rbx,%r13,8), %rcx
incq (%rcx,%rax,8)
incq %r15
addq $0x10, %r11
jmp 0x4a34
movq (%rdi), %r15
testl %edx, %edx
je 0x4bd4
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
testl %esi, %esi
je 0x4afc
cmpq %r10, %r15
jge 0x4b01
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)
incq %r15
addq $0x10, %r11
jmp 0x4aa2
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)
incq %r15
addq $0x10, %r11
cmpq %r10, %r15
jl 0x4ad6
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r8d
movq 0x1d730(%rip), %r12     # 0x22248
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
addq $0x8, %r11
cmpq %r10, %r15
jge 0x4b01
movq (%r11), %r13
movl %esi, %ecx
shrq %cl, %r13
movzbl %r13b, %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, %r13
andq %r12, %r13
cqto
idivq %r14
leaq (%rbx,%r13,8), %rcx
incq (%rcx,%rax,8)
incq %r15
addq $0x10, %r11
jmp 0x4b26
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
cmpq %r10, %r15
jge 0x4b01
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), %r13
movl %r8d, %ecx
shlq %cl, %r13
andq %r12, %r13
cqto
idivq %r14
leaq (%rbx,%r13,8), %rcx
incq (%rcx,%rax,8)
incq %r15
addq $0x10, %r11
jmp 0x4b7f
testl %esi, %esi
je 0x4c3e
movl %eax, %r8d
movq 0x1d666(%rip), %r12     # 0x22248
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
cmpq %r10, %r15
jge 0x4b01
movq (%r11), %r13
movl %esi, %ecx
shrq %cl, %r13
movzbl %r13b, %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, %r13
andq %r12, %r13
cqto
idivq %r14
leaq (%rbx,%r13,8), %rcx
incq (%rcx,%rax,8)
incq %r15
addq $0x10, %r11
jmp 0x4bec
movl %eax, %ecx
movq 0x1d601(%rip), %rsi     # 0x22248
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %r11
cmpq %r10, %r15
jge 0x4b01
movq (%r11), %r8
movzbl %r8b, %edx
movq 0x10(%rdi,%rdx,8), %rax
leaq 0x1(%rax), %r12
movq %r12, 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)
incq %r15
addq $0x10, %r11
jmp 0x4c51