// File: /workspace/github_cpp_makefile_star2_O3/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 0x2313(%rip), %rsi      # 0xda5e
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0x41f0
cmpl $0x3, %eax
jne 0xb782
movb 0x14(%rsp), %al
movb %al, (%rbx)
movb 0x10(%rsp), %al
movb %al, 0x1(%rbx)
movb 0xc(%rsp), %al
movb %al, 0x2(%rbx)
jmp 0xb8ed
xorl %eax, %eax
xorl %ebp, %ebp
cmpl $0x6b726164, (%r14)     # imm = 0x6B726164
sete %al
setne %bpl
leaq (%r14,%rax,4), %r15
leaq 0x22cd(%rip), %rsi      # 0xda6c
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb86e
leaq 0x22bc(%rip), %rsi      # 0xda72
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb879
leaq 0x22ab(%rip), %rsi      # 0xda78
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb884
leaq 0x2298(%rip), %rsi      # 0xda7c
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb88f
leaq 0x2287(%rip), %rsi      # 0xda82
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb895
leaq 0x2275(%rip), %rsi      # 0xda87
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb89b
leaq 0x2267(%rip), %rsi      # 0xda8c
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb8f8
leaq 0x2258(%rip), %rsi      # 0xda94
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
je 0xb8fe
leaq 0x2248(%rip), %rsi      # 0xda9b
movq %r15, %rdi
callq 0x4260
testl %eax, %eax
jne 0xb907
movb $0x0, 0x2(%rbx)
movw $0x96ff, (%rbx)         # imm = 0x96FF
jmp 0xb8a4
movb $0x0, 0x2(%rbx)
movw $0x0, (%rbx)
jmp 0xb8a4
movb $-0x1, 0x2(%rbx)
movw $0xffff, (%rbx)         # imm = 0xFFFF
jmp 0xb8a4
movb $0x0, 0x2(%rbx)
movw $0xff, (%rbx)
jmp 0xb8a4
movb $0x0, 0x2(%rbx)
jmp 0xb89f
movb $-0x1, 0x2(%rbx)
jmp 0xb872
movb $-0x1, 0x2(%rbx)
movw $0xff00, (%rbx)         # imm = 0xFF00
testl %ebp, %ebp
jne 0xb8ed
movzbl (%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x2149(%rip), %xmm1     # 0xda00
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, (%rbx)
movzbl 0x1(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x1(%rbx)
movzbl 0x2(%rbx), %eax
xorps %xmm0, %xmm0
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 0xb888
movb $0x0, 0x2(%rbx)
jmp 0xb87d
movq 0x76d2(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x218a(%rip), %rsi      # 0xdaa2
movq %r14, %rdx
xorl %eax, %eax
callq 0x4280
jmp 0xb8a4