// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/pcalutil.c
// Function: define_shading
void define_shading (char *orig_shading, char *new_shading, char *dflt_shading)
{
   char *odate, *ndate, *ddate, *ofill, *nfill, *dfill;
   char tmp1[STRSIZ], tmp2[STRSIZ], tmp3[STRSIZ];
   double v;
   
   /* use default date/fill if new _shading is null */
   if (new_shading == NULL || new_shading[0] == '\0') {
      strcpy(orig_shading, dflt_shading);
      return;
   }

   /* split old, new, and default shadings into date/fill components */
   SPLIT(orig_shading, odate, ofill, '/');
   
   new_shading = strcpy(tmp1, new_shading);
   SPLIT(new_shading, ndate, nfill, '/');
   
   dflt_shading = strcpy(tmp2, dflt_shading);
   SPLIT(dflt_shading, ddate, dfill, '/');

   /* replace invalid fields from new shading with default values */
   if (nfill[0] && strchr(nfill, RGB_CHAR) == NULL && ((v = atof(nfill)) <= 0.0 || v > 1.0)) {
      nfill = dfill;
   }
   if (ndate[0] && strchr(ndate, RGB_CHAR) == NULL && ((v = atof(ndate)) <= 0.0 || v > 1.0)) {
      ndate = ddate;
   }
   
   /* replace fields of old shading with specified fields from new */
   
   strcpy(tmp3, ndate[0] ? ndate : odate);
   strcat(tmp3, "/");
   strcat(tmp3, nfill[0] ? nfill : ofill);
   
   strcpy(orig_shading, tmp3);

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdx, %r13
movq %rdi, %rbx
testq %rsi, %rsi
je 0xa52e
movq %rsi, %r15
cmpb $0x0, (%rsi)
je 0xa52e
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x5150
testq %rax, %rax
je 0xa54a
movq %rax, %r14
movb $0x0, (%rax)
incq %r14
jmp 0xa551
movq %rbx, %rdi
movq %r13, %rsi
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50a0
leaq 0x1625c(%rip), %r14     # 0x207ad
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x5120
testq %rax, %rax
je 0xa566
movb $0x0, (%rax)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x50a0
movq %r12, %rdi
movl $0x2f, %esi
callq 0x5150
testq %rax, %rax
je 0xa591
movq %rax, %r15
movb $0x0, (%rax)
incq %r15
jmp 0xa598
leaq 0x16215(%rip), %r15     # 0x207ad
movq %rsp, %r12
movq %r12, %rdi
movl $0x2f, %esi
callq 0x5120
testq %rax, %rax
je 0xa5b0
movb $0x0, (%rax)
leaq 0x1a0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x50a0
movq %rbp, %rdi
movl $0x2f, %esi
callq 0x5150
testq %rax, %rax
je 0xa5e0
movq %rax, %rbp
movb $0x0, (%rax)
incq %rbp
jmp 0xa5e7
leaq 0x161c6(%rip), %rbp     # 0x207ad
leaq 0x1a0(%rsp), %r13
movq %r13, %rdi
movl $0x2f, %esi
callq 0x5120
testq %rax, %rax
je 0xa604
movb $0x0, (%rax)
cmpb $0x0, (%r15)
je 0xa63c
movq %r15, %rdi
movl $0x3a, %esi
callq 0x5120
testq %rax, %rax
jne 0xa63c
movq %r15, %rdi
callq 0x50c0
ucomisd 0xba34(%rip), %xmm0     # 0x16060
cmovaq %rbp, %r15
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovaeq %rbp, %r15
cmpb $0x0, (%rsp)
movq %rbx, %rbp
je 0xa685
movq %r12, %rdi
movl $0x3a, %esi
callq 0x5120
movq %r12, %rbp
testq %rax, %rax
jne 0xa685
movq %rsp, %rbp
movq %rbp, %rdi
callq 0x50c0
ucomisd 0xb9f3(%rip), %xmm0     # 0x16060
cmovaq %r13, %rbp
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovaeq %r13, %rbp
cmpb $0x0, (%rbp)
cmoveq %rbx, %rbp
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x50a0
movq %r12, %rdi
callq 0x5100
movw $0x2f, 0xd0(%rsp,%rax)
cmpb $0x0, (%r15)
cmovneq %r15, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x52e0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x50a0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq