// File: /workspace/github_c_makefile_star2_O2/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 0x11396f(%rip), %ecx    # 0x126d34
pushq $0x3
popq %rsi
testl %ecx, %ecx
je 0x133f0
pushq $0x6
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
cmpl $0x2, %eax
pushq $0x2
popq %rbx
cmovll %eax, %ebx
incl %ebx
cmpl $0x4, %ecx
cmovll %esi, %ecx
addl $-0x3, %ecx
movl %ecx, 0x113946(%rip)    # 0x126d34
jmp 0x133f2
xorl %ebx, %ebx
movl 0x113938(%rip), %ecx    # 0x126d30
testl %ecx, %ecx
je 0x13423
pushq $0xa
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
movl %eax, %ebp
cmpl $0x3, %eax
cmovgel %esi, %ebp
cmpl $0x4, %ecx
cmovgel %ecx, %esi
addl $-0x3, %esi
movl %ebp, %r14d
movl %esi, 0x113912(%rip)    # 0x126d30
incl %r14d
jne 0x13447
testl %ebx, %ebx
je 0x13467
callq 0x4a914
cmpl $0x3, %eax
jl 0x1348b
shll $0x6, %ebx
pushq $0x14
popq %rcx
movl %ebx, %eax
cltd
idivl %ecx
movzbl %al, %ecx
pushq $0x40
popq %rdi
pushq $0x3e
popq %rsi
jmp 0x1345e
callq 0x4a914
cmpl $0x3, %eax
jl 0x134aa
shlb $0x3, %r14b
movzbl %r14b, %ecx
pushq $0x40
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x495e5
jmp 0x134cf
cmpb $0x0, 0x1138ca(%rip)    # 0x126d38
je 0x134d7
callq 0x4a914
cmpl $0x3, %eax
jl 0x134dc
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x495e5
jmp 0x134d1
leaq 0xc6fd0(%rip), %rax     # 0xda462
movswl (%rax), %edi
decl %ebx
movslq %ebx, %rax
imulq $0x300, %rax, %rax      # imm = 0x300
leaq 0x112c88(%rip), %rsi    # 0x126130
jmp 0x134c5
leaq 0xc6fb1(%rip), %rax     # 0xda462
movswl (%rax), %edi
movslq %ebp, %rax
imulq $0x300, %rax, %rax      # imm = 0x300
leaq 0x11206b(%rip), %rsi    # 0x125530
addq %rax, %rsi
xorl %edx, %edx
callq 0x41f79
movb $0x1, %bl
movb %bl, 0x113861(%rip)     # 0x126d38
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xc6f7f(%rip), %rax     # 0xda462
movswl (%rax), %edi
leaq 0x40ff43(%rip), %rsi    # 0x423430
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x41f79
jmp 0x134d1