// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekmsc.c
// Function: updatepaletteshifts
void
updatepaletteshifts(void)
{
     int   red,white;

     if (whitecount)
     {
          white = whitecount/WHITETICS +1;
          if (white>NUMWHITESHIFTS)
               white = NUMWHITESHIFTS;
          whitecount -= TICSPERFRAME;
          if (whitecount < 0)
               whitecount = 0;
     }
     else {
          white = 0;
     }

     if (redcount)
     {
          red = redcount/10 +1;
          if (red>NUMREDSHIFTS)
               red = NUMREDSHIFTS;
          redcount -= TICSPERFRAME;
          if (redcount < 0)
               redcount = 0;
     }
     else {
          red = 0;
     }


     if( red ) {
#if USE_POLYMOST && USE_OPENGL
          if (getrendermode() >= 3)
               setpalettefade(64,0,0,64 * red / REDSTEPS);
          else
#endif
               setbrightness(brightness,&redshifts[red-1][0],0);
          palshifted = 1;
     }
     else if( white ) {
#if USE_POLYMOST && USE_OPENGL
          if (getrendermode() >= 3)
               setpalettefade(64,62,0,64 * white / WHITESTEPS);
          else
#endif
               setbrightness(brightness,&whiteshifts[white-1][0],0);
          palshifted = 1;
     }
     else if( palshifted ) {
#if USE_POLYMOST && USE_OPENGL
          if (getrendermode() >= 3)
               setpalettefade(0,0,0,0);
          else
#endif
               setbrightness(brightness,&palette[0],0);  // back to normal
          palshifted = 0;
     }

 return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x11c522(%rip), %eax    # 0x130d34
testl %eax, %eax
je 0x14850
movslq %eax, %rcx
imulq $0x2aaaaaab, %rcx, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
cmpl $0x2, %ecx
movl $0x2, %ebx
cmovll %ecx, %ebx
incl %ebx
cmpl $0x4, %eax
movl $0x3, %ecx
cmovgel %eax, %ecx
addl $-0x3, %ecx
movl %ecx, 0x11c4e6(%rip)    # 0x130d34
jmp 0x14852
xorl %ebx, %ebx
movl 0x11c4d8(%rip), %eax    # 0x130d30
testl %eax, %eax
je 0x14897
movslq %eax, %rcx
imulq $0x66666667, %rcx, %r14 # imm = 0x66666667
movq %r14, %rcx
shrq $0x3f, %rcx
sarq $0x22, %r14
addl %ecx, %r14d
cmpl $0x3, %r14d
movl $0x3, %ecx
cmovgel %ecx, %r14d
cmpl $0x4, %eax
cmovgel %eax, %ecx
addl $-0x3, %ecx
movl %r14d, %ebp
movl %ecx, 0x11c49d(%rip)    # 0x130d30
incl %ebp
jne 0x148ce
testl %ebx, %ebx
je 0x148f0
callq 0x4fb14
cmpl $0x3, %eax
jl 0x14914
shll $0x6, %ebx
movslq %ebx, %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x23, %rax
addl %ecx, %eax
movzbl %al, %ecx
movl $0x40, %edi
movl $0x3e, %esi
jmp 0x148e7
callq 0x4fb14
cmpl $0x3, %eax
jl 0x14934
shlb $0x3, %bpl
movzbl %bpl, %ecx
movl $0x40, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4e44a
jmp 0x1495a
cmpb $0x0, 0x11c441(%rip)    # 0x130d38
je 0x14962
callq 0x4fb14
cmpl $0x3, %eax
jl 0x14967
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4e44a
jmp 0x1495c
leaq 0xcfb47(%rip), %rax     # 0xe4462
movswl (%rax), %edi
decl %ebx
movslq %ebx, %rax
leaq (%rax,%rax,2), %rax
shlq $0x8, %rax
leaq 0x11b7fe(%rip), %rsi    # 0x130130
jmp 0x14950
leaq 0xcfb27(%rip), %rax     # 0xe4462
movswl (%rax), %edi
movslq %r14d, %rax
leaq (%rax,%rax,2), %rax
shlq $0x8, %rax
leaq 0x11abe0(%rip), %rsi    # 0x12f530
addq %rax, %rsi
xorl %edx, %edx
callq 0x46954
movb $0x1, %bl
movb %bl, 0x11c3d6(%rip)     # 0x130d38
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xcfaf4(%rip), %rax     # 0xe4462
movswl (%rax), %edi
leaq 0x418ab8(%rip), %rsi    # 0x42d430
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x46954
jmp 0x1495c