// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/pcal.c
// Function: set_color
void set_color (char *day, int col)
{
   int i, j, max, count[NUM_COLORS];
   char tmp[STRSIZ], *p;
   
   if (ci_strncmp(day, ALL, strlen(ALL)) == 0) {   /* set all days */
      for (i = 0; i < 7; i++) day_color[i] = col;
   }
   
   else if (ci_strncmp(day, HOLIDAY, MIN_DAY_LEN) == 0) { /* set holidays */
      holiday_color = col;
   }
   
   else {   /* set range of days */
      strcpy(tmp, day);
      if ((p = strchr(tmp, '-')) != NULL) *p++ = '\0';
      
      /* parse single day or range of days - return if error */
      if ((i = get_weekday(tmp, FALSE)) == NOT_WEEKDAY ||
          (j = p ? get_weekday(p, FALSE) : i) == NOT_WEEKDAY) {
         return;
      }

      /* set day colors, wrapping around end of week */
      for (j = (i > j) ? j + 7 : j; i <= j; i++) day_color[i % 7] = col;
   }
   
   /* reset weekday_color to most prevalent color */
   
   for (i = 0; i < NUM_COLORS; i++) {   /* clear counts */
      count[i] = 0;
   }
   
   for (i = SUN; i <= SAT; i++) { /* count colors */
      count[(int)day_color[i]]++;
   }
   
   for (i = max = 0; i < NUM_COLORS; i++) { /* get most prevalent */
      if (count[i] > max) max = count[weekday_color = i];
   }
   return;   
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xe0, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x1a87f(%rip), %rsi     # 0x20211
movl $0x3, %edx
callq 0xa340
testl %eax, %eax
je 0x5a0f
leaq 0x10905(%rip), %rsi     # 0x162ac
movq %r14, %rdi
movl $0x3, %edx
callq 0xa340
testl %eax, %eax
je 0x5a29
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x50a0
movq %r15, %rdi
movl $0x2d, %esi
callq 0x5120
testq %rax, %rax
je 0x5a34
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0xd007
cmpl $-0x1, %eax
je 0x6094
movl %eax, %r14d
incq %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xd007
cmpl $-0x1, %eax
jne 0x5a4c
jmp 0x6094
movzbl %bl, %eax
imull $0x1010101, %eax, %eax  # imm = 0x1010101
movl %eax, 0x27d11(%rip)     # 0x2d72f
movl %eax, 0x27d08(%rip)     # 0x2d72c
jmp 0x6055
movl %ebx, 0x27d05(%rip)     # 0x2d734
jmp 0x6055
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0xd007
cmpl $-0x1, %eax
je 0x6094
movl %eax, %r14d
leal 0x7(%rax), %ecx
cmpl %eax, %r14d
cmovlel %eax, %ecx
cmpl %ecx, %r14d
jg 0x6055
subl %r14d, %ecx
leal 0x10(%rcx), %eax
andl $-0x10, %eax
movd %ecx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorl %ecx, %ecx
movdqa 0x10596(%rip), %xmm1    # 0x16010
movdqa 0x1059e(%rip), %xmm2    # 0x16020
movdqa 0x105a6(%rip), %xmm3    # 0x16030
movdqa 0x105ae(%rip), %xmm4    # 0x16040
movdqa 0x105b6(%rip), %xmm5    # 0x16050
pxor %xmm5, %xmm0
leaq 0x27c87(%rip), %rdx     # 0x2d72c
pcmpeqd %xmm6, %xmm6
leal (%r14,%rcx), %esi
movd %ecx, %xmm7
movdqa %xmm7, %xmm8
pxor %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
movd %xmm8, %edi
notl %edi
testb $0x1, %dil
je 0x5afd
movslq %esi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pshufd $0x0, %xmm7, %xmm7      # xmm7 = xmm7[0,0,0,0]
movdqa %xmm7, %xmm8
por %xmm4, %xmm8
pxor %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pxor %xmm6, %xmm8
movdqa %xmm8, %xmm9
psrlq $0x18, %xmm9
movd %xmm9, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5b6e
leal (%r14,%rcx), %edi
incl %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
incl %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
incl %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
psrldq $0x6, %xmm8             # xmm8 = xmm8[6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero
movd %xmm8, %edi
shrl $0x10, %edi
testb $0x1, %dil
je 0x5bbf
leal (%r14,%rcx), %edi
addl $0x2, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x2, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x2, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
packsswb %xmm8, %xmm8
movd %xmm8, %edi
shrl $0x18, %edi
testb $0x1, %dil
je 0x5c0f
leal (%r14,%rcx), %edi
addl $0x3, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x3, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x3, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
movdqa %xmm7, %xmm8
por %xmm3, %xmm8
pxor %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0x0, %xmm8, %xmm9      # xmm9 = xmm8[0,0,0,0]
pxor %xmm6, %xmm9
pextrw $0x2, %xmm9, %edi
testb $0x1, %dil
je 0x5c77
leal (%r14,%rcx), %edi
addl $0x4, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x4, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x4, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pxor %xmm6, %xmm8
movdqa %xmm8, %xmm9
pslldq $0x6, %xmm9             # xmm9 = zero,zero,zero,zero,zero,zero,xmm9[0,1,2,3,4,5,6,7,8,9]
packsswb %xmm9, %xmm9
pextrw $0x2, %xmm9, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5cd8
leal (%r14,%rcx), %edi
addl $0x5, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x5, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x5, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pextrw $0x4, %xmm8, %edi
testb $0x1, %dil
je 0x5d21
leal (%r14,%rcx), %edi
addl $0x6, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x6, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x6, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
psrldq $0x5, %xmm8             # xmm8 = xmm8[5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero
pextrw $0x3, %xmm8, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5d73
leal (%r14,%rcx), %edi
addl $0x7, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x7, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x7, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
movdqa %xmm7, %xmm8
por %xmm2, %xmm8
pxor %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0x44, %xmm8, %xmm9     # xmm9 = xmm8[0,1,0,1]
pxor %xmm6, %xmm9
pextrw $0x4, %xmm9, %edi
testb $0x1, %dil
je 0x5ddb
leal (%r14,%rcx), %edi
addl $0x8, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x8, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x8, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
movdqa %xmm8, %xmm9
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm10
pslldq $0x5, %xmm10            # xmm10 = zero,zero,zero,zero,zero,xmm10[0,1,2,3,4,5,6,7,8,9,10]
pextrw $0x4, %xmm10, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5e3c
leal (%r14,%rcx), %edi
addl $0x9, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0x9, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0x9, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pshufhw $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,1,2,3,4,4,4,4]
pxor %xmm6, %xmm8
pextrw $0x5, %xmm8, %edi
testb $0x1, %dil
je 0x5e90
leal (%r14,%rcx), %edi
addl $0xa, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xa, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0xa, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
psrldq $0x6, %xmm9             # xmm9 = xmm9[6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero
packsswb %xmm9, %xmm8
pextrw $0x5, %xmm8, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5ee7
leal (%r14,%rcx), %edi
addl $0xb, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xb, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0xb, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
por %xmm1, %xmm7
pxor %xmm5, %xmm7
pcmpgtd %xmm0, %xmm7
pshufd $0x0, %xmm7, %xmm8      # xmm8 = xmm7[0,0,0,0]
pxor %xmm6, %xmm8
pextrw $0x6, %xmm8, %edi
testb $0x1, %dil
je 0x5f47
leal (%r14,%rcx), %edi
addl $0xc, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xc, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0xc, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
movdqa %xmm7, %xmm8
pxor %xmm6, %xmm8
movdqa %xmm8, %xmm9
pslldq $0x6, %xmm9             # xmm9 = zero,zero,zero,zero,zero,zero,xmm9[0,1,2,3,4,5,6,7,8,9]
packsswb %xmm9, %xmm9
pextrw $0x6, %xmm9, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x5fad
leal (%r14,%rcx), %edi
addl $0xd, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xd, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0xd, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pshufhw $0x0, %xmm7, %xmm7      # xmm7 = xmm7[0,1,2,3,4,4,4,4]
pxor %xmm6, %xmm7
pextrw $0x7, %xmm7, %edi
testb $0x1, %dil
je 0x5ffe
leal (%r14,%rcx), %edi
addl $0xe, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xe, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %esi, %edi
addl $0xe, %edi
movslq %edi, %rdi
movb %bl, (%rdi,%rdx)
pextrw $0x7, %xmm8, %edi
shrl $0x8, %edi
testb $0x1, %dil
je 0x604a
leal (%r14,%rcx), %edi
addl $0xf, %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %esi, %edi
addl $0xf, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %edi, %esi
addl $0xf, %esi
movslq %esi, %rsi
movb %bl, (%rsi,%rdx)
addl $0x10, %ecx
cmpl %ecx, %eax
jne 0x5aa9
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
xorl %eax, %eax
leaq 0x276c5(%rip), %rcx     # 0x2d72c
movsbq (%rax,%rcx), %rdx
incl (%rsp,%rdx,4)
incq %rax
cmpq $0x7, %rax
jne 0x6067
xorl %eax, %eax
xorl %ecx, %ecx
movl (%rsp,%rax,4), %edx
cmpl %ecx, %edx
jle 0x608b
movl %eax, 0x2721f(%rip)     # 0x2d2a8
movl %edx, %ecx
incq %rax
cmpq $0x4, %rax
jne 0x607c
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %r15
retq