// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movl 0x1195a3(%rip), %eax    # 0x12dd34
xorl %ebx, %ebx
movl $0x0, %ebp
testl %eax, %eax
je 0x147d4
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, %ebp
cmovll %ecx, %ebp
incl %ebp
cmpl $0x4, %eax
movl $0x3, %ecx
cmovgel %eax, %ecx
addl $-0x3, %ecx
movl %ecx, 0x119560(%rip)    # 0x12dd34
movl 0x119556(%rip), %eax    # 0x12dd30
testl %eax, %eax
je 0x14811
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rbx # imm = 0x66666667
movq %rbx, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rbx
addl %ecx, %ebx
cmpl $0x3, %ebx
movl $0x3, %ecx
cmovgel %ecx, %ebx
incl %ebx
cmpl $0x4, %eax
cmovgel %eax, %ecx
addl $-0x3, %ecx
movl %ecx, 0x11951f(%rip)    # 0x12dd30
testl %ebx, %ebx
je 0x1482e
callq 0x4d98a
cmpl $0x3, %eax
jl 0x1486c
shlb $0x3, %bl
movzbl %bl, %ecx
movl $0x40, %edi
xorl %esi, %esi
jmp 0x14863
testl %ebp, %ebp
je 0x1488c
callq 0x4d98a
cmpl $0x3, %eax
jl 0x148b0
shll $0x6, %ebp
movslq %ebp, %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
xorl %edx, %edx
callq 0x4c470
jmp 0x148d8
leaq 0xccbef(%rip), %rax     # 0xe1462
movswl (%rax), %edi
decl %ebx
movslq %ebx, %rax
leaq (%rax,%rax,2), %rax
shlq $0x8, %rax
leaq 0x117ca6(%rip), %rsi    # 0x12c530
jmp 0x148ce
cmpb $0x0, 0x1194a5(%rip)    # 0x12dd38
je 0x148e0
callq 0x4d98a
cmpl $0x3, %eax
jl 0x148e7
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4c470
jmp 0x148da
leaq 0xccbab(%rip), %rax     # 0xe1462
movswl (%rax), %edi
decl %ebp
movslq %ebp, %rax
leaq (%rax,%rax,2), %rax
shlq $0x8, %rax
leaq 0x118862(%rip), %rsi    # 0x12d130
addq %rax, %rsi
xorl %edx, %edx
callq 0x44ae3
movb $0x1, %bl
movb %bl, 0x119458(%rip)     # 0x12dd38
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xccb74(%rip), %rax     # 0xe1462
movswl (%rax), %edi
leaq 0x415b18(%rip), %rsi    # 0x42a410
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x44ae3
jmp 0x148da