// File: /workspace/github_cpp_makefile_star2_O1/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 0x24ff(%rip), %rsi      # 0xd9e6
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0x4200
cmpl $0x3, %eax
jne 0xb51e
movb 0x14(%rsp), %al
movb %al, (%rbx)
movb 0x10(%rsp), %al
movb %al, 0x1(%rbx)
movb 0xc(%rsp), %al
movb %al, 0x2(%rbx)
jmp 0xb689
xorl %eax, %eax
xorl %ebp, %ebp
cmpl $0x6b726164, (%r14)     # imm = 0x6B726164
sete %al
setne %bpl
leaq (%r14,%rax,4), %r15
leaq 0x24b9(%rip), %rsi      # 0xd9f4
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb60a
leaq 0x24a8(%rip), %rsi      # 0xd9fa
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb615
leaq 0x2497(%rip), %rsi      # 0xda00
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb620
leaq 0x2484(%rip), %rsi      # 0xda04
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb62b
leaq 0x2473(%rip), %rsi      # 0xda0a
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb631
leaq 0x2461(%rip), %rsi      # 0xda0f
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb637
leaq 0x2453(%rip), %rsi      # 0xda14
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb694
leaq 0x2444(%rip), %rsi      # 0xda1c
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
je 0xb69a
leaq 0x2434(%rip), %rsi      # 0xda23
movq %r15, %rdi
callq 0x4270
testl %eax, %eax
jne 0xb6a3
movb $0x0, 0x2(%rbx)
movw $0x96ff, (%rbx)         # imm = 0x96FF
jmp 0xb640
movb $0x0, 0x2(%rbx)
movw $0x0, (%rbx)
jmp 0xb640
movb $-0x1, 0x2(%rbx)
movw $0xffff, (%rbx)         # imm = 0xFFFF
jmp 0xb640
movb $0x0, 0x2(%rbx)
movw $0xff, (%rbx)
jmp 0xb640
movb $0x0, 0x2(%rbx)
jmp 0xb63b
movb $-0x1, 0x2(%rbx)
jmp 0xb60e
movb $-0x1, 0x2(%rbx)
movw $0xff00, (%rbx)         # imm = 0xFF00
testl %ebp, %ebp
jne 0xb689
movzbl (%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x233d(%rip), %xmm1     # 0xd990
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 0xb624
movb $0x0, 0x2(%rbx)
jmp 0xb619
movq 0x7936(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x2376(%rip), %rsi      # 0xda2a
movq %r14, %rdx
xorl %eax, %eax
callq 0x4290
jmp 0xb640