// File: /workspace/github_cpp_makefile_star2_O2/matthewarcus[P]mmps/image.cpp
// Function: Rgb::Rgb(char const*)
Rgb::Rgb(const char *s)
{
  int r_,g_,b_;
  if (sscanf(s,"%d:%d:%d",&r_,&g_,&b_) == 3){
    r = r_;
    g = g_;
    b = b_;
    // Should use a lookup table here really.
  } else {
    const char *p = s;
    const char *d = "dark";
    bool dark = false;
    if (memcmp(p,d,strlen(d)) == 0) {
      p += strlen(d);
      dark = true;
    }
    if (strcmp(p,"black") == 0) *this = black;
    else if (strcmp(p,"white") == 0) *this = white;
    else if (strcmp(p,"red") == 0) *this = red;
    else if (strcmp(p,"green") == 0) *this = green;
    else if (strcmp(p,"blue") == 0) *this = blue;
    else if (strcmp(p,"cyan") == 0) *this = cyan;
    else if (strcmp(p,"magenta") == 0) *this = magenta;
    else if (strcmp(p,"yellow") == 0) *this = yellow;
    else if (strcmp(p,"orange") == 0) *this = orange;
    else fprintf(stderr,"Invalid color specification: %s\n",s);
    if (dark) {
      double f = 0.6;
      r = (unsigned char)(r * f);
      g = (unsigned char)(g * f);
      b = (unsigned char)(b * f);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20e3(%rip), %rsi      # 0xc9fe
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0x4200
cmpl $0x3, %eax
jne 0xa952
movb 0x14(%rsp), %al
movb %al, (%rbx)
movb 0x10(%rsp), %al
movb %al, 0x1(%rbx)
movb 0xc(%rsp), %al
movb %al, 0x2(%rbx)
jmp 0xaab5
xorl %ebp, %ebp
xorl %eax, %eax
cmpl $0x6b726164, (%r14)     # imm = 0x6B726164
setne %bpl
sete %al
leaq (%r14,%rax,4), %r15
leaq 0x209d(%rip), %rsi      # 0xca0c
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa3e
leaq 0x208c(%rip), %rsi      # 0xca12
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa48
leaq 0x207b(%rip), %rsi      # 0xca18
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa52
leaq 0x2068(%rip), %rsi      # 0xca1c
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa5d
leaq 0x2057(%rip), %rsi      # 0xca22
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa63
leaq 0x2045(%rip), %rsi      # 0xca27
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaa69
leaq 0x2037(%rip), %rsi      # 0xca2c
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaac0
leaq 0x2028(%rip), %rsi      # 0xca34
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
je 0xaac6
leaq 0x2018(%rip), %rsi      # 0xca3b
movq %r15, %rdi
callq 0x4290
testl %eax, %eax
jne 0xaacc
movb $0x0, 0x2(%rbx)
movw $0x96ff, (%rbx)         # imm = 0x96FF
jmp 0xaa72
movb $0x0, 0x2(%rbx)
andw $0x0, (%rbx)
jmp 0xaa72
movb $-0x1, 0x2(%rbx)
orw $-0x1, (%rbx)
jmp 0xaa72
movb $0x0, 0x2(%rbx)
movw $0xff, (%rbx)
jmp 0xaa72
movb $0x0, 0x2(%rbx)
jmp 0xaa6d
movb $-0x1, 0x2(%rbx)
jmp 0xaa42
movb $-0x1, 0x2(%rbx)
movw $0xff00, (%rbx)         # imm = 0xFF00
testl %ebp, %ebp
jne 0xaab5
movzbl (%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x1f23(%rip), %xmm1     # 0xc9a8
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, (%rbx)
movzbl 0x1(%rbx), %eax
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x1(%rbx)
movzbl 0x2(%rbx), %eax
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x2(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movb $-0x1, 0x2(%rbx)
jmp 0xaa56
movb $0x0, 0x2(%rbx)
jmp 0xaa4c
movq 0x750d(%rip), %rax      # 0x11fe0
movq (%rax), %rdi
leaq 0x1f65(%rip), %rsi      # 0xca42
movq %r14, %rdx
xorl %eax, %eax
callq 0x42b0
jmp 0xaa72
nop