// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/colorspace.c
// Function: gt_colorspace_decode_string
int gt_colorspace_decode_string(GtStr *color_string, GtStr *result,
                                GtError *err)
{
  int had_err = 0;
  GtUword str_len, idx;
  char *input;
  GtColorSpaceDecoder *cd;

  cd = gt_colorspace_decoder_new();

  gt_assert(cd);
  gt_assert(color_string && result);
  gt_assert(gt_str_length(result) == 0);

  input = gt_str_get(color_string);
  str_len = gt_str_length(color_string);

  had_err = set_first_state(cd, input[0], err);
  if (!had_err)
  {
    gt_str_append_char(result, cd->current->self);

    for (idx = 1UL; !had_err && idx < str_len; idx++)
    {
      had_err = set_next_state(cd, input[idx], err);
      gt_str_append_char(result, cd->current->self);
    }
    gt_assert(gt_str_length(result) == str_len);
  }
  gt_colorspace_decoder_delete(cd);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %r12
leaq 0x44580(%rip), %rsi     # 0x10220c
movl $0xf8, %edi
movl $0x2a, %edx
callq 0x35ee2
movq %rax, %rbx
movq $0x0, (%rax)
leaq 0x8(%rax), %r14
movb $0x61, 0x8(%rax)
leaq 0x38(%rax), %rcx
movb $0x63, 0x38(%rax)
leaq 0x68(%rax), %rbp
movb $0x67, 0x68(%rax)
leaq 0x98(%rax), %r15
movb $0x74, 0x98(%rax)
leaq 0xc8(%rax), %rax
movb $0x6e, 0xc8(%rbx)
movq %r14, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
movq %rbp, 0x20(%rbx)
movq %r15, 0x28(%rbx)
movq %rax, 0x30(%rbx)
movq %rcx, 0x40(%rbx)
movq %r14, 0x48(%rbx)
movq %r15, 0x50(%rbx)
movq %rbp, 0x58(%rbx)
movq %rax, 0x60(%rbx)
movq %rbp, 0x70(%rbx)
movq %r15, 0x78(%rbx)
movq %r14, 0x80(%rbx)
movq %rcx, 0x88(%rbx)
movq %rax, 0x90(%rbx)
movq %r15, 0xa0(%rbx)
movq %rbp, 0xa8(%rbx)
movq %rcx, 0xb0(%rbx)
movq %r14, 0xb8(%rbx)
movq %rax, 0xc0(%rbx)
movq %rax, 0xf0(%rbx)
movq %rax, 0xe8(%rbx)
movq %rax, 0xe0(%rbx)
movq %rax, 0xd8(%rbx)
movq %rax, 0xd0(%rbx)
testq %rbx, %rbx
je 0xbdf29
movq %rcx, 0x10(%rsp)
testq %r12, %r12
je 0xbdf2e
testq %r13, %r13
je 0xbdf2e
movq %r13, (%rsp)
movq %r13, %rdi
callq 0x3c434
testq %rax, %rax
jne 0xbdf33
movq %r12, %rdi
callq 0x3c40b
movq %rax, %r13
movq %r12, %rdi
callq 0x3c434
cmpq $0x0, (%rbx)
jne 0xbdf38
movq %rax, %r12
movsbl (%r13), %edx
movzbl %dl, %eax
cmpl $0x60, %eax
jg 0xbddd7
cmpl $0x46, %eax
jg 0xbddf0
cmpl $0x41, %eax
je 0xbde26
cmpl $0x43, %eax
je 0xbdde6
jmp 0xbddfa
cmpl $0x66, %eax
jg 0xbde17
cmpl $0x61, %eax
je 0xbde26
cmpl $0x63, %eax
jne 0xbddfa
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
jmp 0xbde2e
cmpl $0x47, %eax
je 0xbde2b
cmpl $0x54, %eax
je 0xbde21
leaq 0x4452f(%rip), %rsi     # 0x102330
xorl %r14d, %r14d
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x3559f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xbde33
cmpl $0x67, %eax
je 0xbde2b
cmpl $0x74, %eax
jne 0xbddfa
movq %r15, (%rbx)
jmp 0xbde2e
movq %r14, (%rbx)
jmp 0xbde2e
movq %rbp, (%rbx)
xorl %ebp, %ebp
movb $0x1, %r14b
testb %r14b, %r14b
je 0xbdeff
movq (%rbx), %rax
movsbl (%rax), %esi
movq (%rsp), %rdi
callq 0x3c28d
xorl %ebp, %ebp
cmpq $0x2, %r12
jb 0xbdef1
movl $0x2, %r14d
movq (%rbx), %rax
testq %rax, %rax
je 0xbdf24
movzbl -0x1(%r13,%r14), %ecx
cmpq $0x35, %rcx
ja 0xbded1
movabsq $0xf000000000000, %rdx  # imm = 0xF000000000000
btq %rcx, %rdx
jae 0xbde93
movsbq %cl, %rcx
movq -0x178(%rax,%rcx,8), %rax
jmp 0xbdea7
movabsq $0x30400000000000, %rdx # imm = 0x30400000000000
btq %rcx, %rdx
jae 0xbded1
movq 0x28(%rax), %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
movb $0x1, %r15b
movq (%rbx), %rax
movsbl (%rax), %esi
movq (%rsp), %rdi
callq 0x3c28d
testb %r15b, %r15b
je 0xbdef1
leaq 0x1(%r14), %rax
cmpq %r12, %r14
movq %rax, %r14
jb 0xbde5d
jmp 0xbdef1
movsbl %cl, %edx
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x444ba(%rip), %rsi     # 0x10239d
xorl %eax, %eax
callq 0x3559f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xbdeaf
movq (%rsp), %rdi
callq 0x3c434
cmpq %r12, %rax
jne 0xbdf3d
leaq 0x44306(%rip), %rsi     # 0x10220c
movq %rbx, %rdi
movl $0x50, %edx
callq 0x362a0
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x29ab2
callq 0x29ae9
callq 0x299d0
callq 0x29a09
callq 0x29a42
callq 0x29a79