// File: /workspace/github_cpp_makefile_star2_O3/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::ParseTextureNameAndOption(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, tinyobj::texture_option_t*, char const*)
bool ParseTextureNameAndOption(std::string *texname, texture_option_t *texopt,
                               const char *linebuf) {
  // @todo { write more robust lexer and parser. }
  bool found_texname = false;
  std::string texture_name;

  const char *token = linebuf;  // Assume line ends with NULL

  while (!IS_NEW_LINE((*token))) {
    token += strspn(token, " \t");  // skip space
    if ((0 == strncmp(token, "-blendu", 7)) && IS_SPACE((token[7]))) {
      token += 8;
      texopt->blendu = parseOnOff(&token, /* default */ true);
    } else if ((0 == strncmp(token, "-blendv", 7)) && IS_SPACE((token[7]))) {
      token += 8;
      texopt->blendv = parseOnOff(&token, /* default */ true);
    } else if ((0 == strncmp(token, "-clamp", 6)) && IS_SPACE((token[6]))) {
      token += 7;
      texopt->clamp = parseOnOff(&token, /* default */ true);
    } else if ((0 == strncmp(token, "-boost", 6)) && IS_SPACE((token[6]))) {
      token += 7;
      texopt->sharpness = parseReal(&token, 1.0);
    } else if ((0 == strncmp(token, "-bm", 3)) && IS_SPACE((token[3]))) {
      token += 4;
      texopt->bump_multiplier = parseReal(&token, 1.0);
    } else if ((0 == strncmp(token, "-o", 2)) && IS_SPACE((token[2]))) {
      token += 3;
      parseReal3(&(texopt->origin_offset[0]), &(texopt->origin_offset[1]),
                 &(texopt->origin_offset[2]), &token);
    } else if ((0 == strncmp(token, "-s", 2)) && IS_SPACE((token[2]))) {
      token += 3;
      parseReal3(&(texopt->scale[0]), &(texopt->scale[1]), &(texopt->scale[2]),
                 &token, 1.0, 1.0, 1.0);
    } else if ((0 == strncmp(token, "-t", 2)) && IS_SPACE((token[2]))) {
      token += 3;
      parseReal3(&(texopt->turbulence[0]), &(texopt->turbulence[1]),
                 &(texopt->turbulence[2]), &token);
    } else if ((0 == strncmp(token, "-type", 5)) && IS_SPACE((token[5]))) {
      token += 5;
      texopt->type = parseTextureType((&token), TEXTURE_TYPE_NONE);
    } else if ((0 == strncmp(token, "-imfchan", 8)) && IS_SPACE((token[8]))) {
      token += 9;
      token += strspn(token, " \t");
      const char *end = token + strcspn(token, " \t\r");
      if ((end - token) == 1) {  // Assume one char for -imfchan
        texopt->imfchan = (*token);
      }
      token = end;
    } else if ((0 == strncmp(token, "-mm", 3)) && IS_SPACE((token[3]))) {
      token += 4;
      parseReal2(&(texopt->brightness), &(texopt->contrast), &token, 0.0, 1.0);
    } else if ((0 == strncmp(token, "-colorspace", 11)) &&
               IS_SPACE((token[11]))) {
      token += 12;
      texopt->colorspace = parseString(&token);
    } else {
// Assume texture filename
#if 0
      size_t len = strcspn(token, " \t\r");  // untile next space
      texture_name = std::string(token, token + len);
      token += len;

      token += strspn(token, " \t");  // skip space
#else
      // Read filename until line end to parse filename containing whitespace
      // TODO(syoyo): Support parsing texture option flag after the filename.
      texture_name = std::string(token);
      token += texture_name.length();
#endif

      found_texname = true;
    }
  }

  if (found_texname) {
    (*texname) = texture_name;
    return true;
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, 0x80(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x40(%rsi), %rax
movq %rax, 0x78(%rsp)
leaq 0x30393(%rip), %r12     # 0x3c7e8
leaq 0x3038f(%rip), %rbx     # 0x3c7eb
movq $0x0, 0x48(%rsp)
movzbl (%r13), %eax
cmpl $0xd, %eax
ja 0xc47d
movl $0x2401, %ecx           # imm = 0x2401
btl %eax, %ecx
jb 0xce09
movq %r13, %rdi
movq %r12, %rsi
callq 0x6190
movq %rax, %r15
addq %r13, %r15
movl $0x7, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x61c0
testl %eax, %eax
je 0xc591
movl $0x7, %edx
movq %r15, %rdi
leaq 0x3033e(%rip), %rsi     # 0x3c7f3
callq 0x61c0
testl %eax, %eax
je 0xc5eb
movl $0x6, %edx
movq %r15, %rdi
leaq 0x3032a(%rip), %rsi     # 0x3c7fb
callq 0x61c0
testl %eax, %eax
je 0xc645
movl $0x6, %edx
movq %r15, %rdi
leaq 0x30315(%rip), %rsi     # 0x3c802
callq 0x61c0
testl %eax, %eax
je 0xc69f
movb (%r15), %bl
cmpb $0x2d, %bl
jne 0xca13
cmpb $0x62, 0x1(%r15)
jne 0xc70d
cmpb $0x6d, 0x2(%r15)
jne 0xc70d
movzbl 0x3(%r15), %eax
cmpl $0x20, %eax
je 0xc52f
cmpl $0x9, %eax
jne 0xc70d
leaq 0x4(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x4, %r15
movq %r15, %rdi
leaq 0x30891(%rip), %rsi     # 0x3cddd
callq 0x6060
movq %rax, %r13
addq %r15, %r13
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x38(%r14)
leaq 0x3025f(%rip), %rbx     # 0x3c7eb
jmp 0xc465
movzbl 0x7(%r15), %eax
cmpl $0x20, %eax
je 0xc5a4
cmpl $0x9, %eax
jne 0xc4a6
leaq 0x8(%r15), %rdi
movq %r12, %rsi
callq 0x6190
leaq (%r15,%rax), %r13
addq $0x8, %r13
movq %r13, %rdi
leaq 0x3081b(%rip), %rsi     # 0x3cddd
callq 0x6060
movb $0x1, %cl
cmpb $0x6f, (%r13)
jne 0xc5df
cmpb $0x66, 0x1(%r13)
jne 0xc5df
cmpb $0x66, 0x2(%r13)
setne %cl
addq %rax, %r13
movb %cl, 0x36(%r14)
jmp 0xc465
movzbl 0x7(%r15), %eax
cmpl $0x20, %eax
je 0xc5fe
cmpl $0x9, %eax
jne 0xc4c2
leaq 0x8(%r15), %rdi
movq %r12, %rsi
callq 0x6190
leaq (%r15,%rax), %r13
addq $0x8, %r13
movq %r13, %rdi
leaq 0x307c1(%rip), %rsi     # 0x3cddd
callq 0x6060
movb $0x1, %cl
cmpb $0x6f, (%r13)
jne 0xc639
cmpb $0x66, 0x1(%r13)
jne 0xc639
cmpb $0x66, 0x2(%r13)
setne %cl
addq %rax, %r13
movb %cl, 0x37(%r14)
jmp 0xc465
movzbl 0x6(%r15), %eax
cmpl $0x20, %eax
je 0xc658
cmpl $0x9, %eax
jne 0xc4de
leaq 0x7(%r15), %rdi
movq %r12, %rsi
callq 0x6190
leaq (%r15,%rax), %r13
addq $0x7, %r13
movq %r13, %rdi
leaq 0x30767(%rip), %rsi     # 0x3cddd
callq 0x6060
movb $0x1, %cl
cmpb $0x6f, (%r13)
jne 0xc693
cmpb $0x66, 0x1(%r13)
jne 0xc693
cmpb $0x66, 0x2(%r13)
setne %cl
addq %rax, %r13
movb %cl, 0x34(%r14)
jmp 0xc465
movzbl 0x6(%r15), %eax
cmpl $0x20, %eax
je 0xc6b2
cmpl $0x9, %eax
jne 0xc4fa
leaq 0x7(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x7, %r15
movq %r15, %rdi
leaq 0x3070e(%rip), %rsi     # 0x3cddd
callq 0x6060
movq %rax, %r13
addq %r15, %r13
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x4(%r14)
jmp 0xc465
cmpb $0x6f, 0x1(%r15)
jne 0xc80d
movzbl 0x2(%r15), %eax
cmpl $0x20, %eax
je 0xc72b
cmpl $0x9, %eax
jne 0xc80d
leaq 0x3(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x3, %r15
movq %r15, %rdi
leaq 0x30695(%rip), %rbp     # 0x3cddd
movq %rbp, %rsi
callq 0x6060
leaq (%rax,%r15), %r13
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x10(%r14)
movq %r13, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6060
leaq (%rax,%r13), %r15
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x14(%r14)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6060
movq %rax, %r13
addq %r15, %r13
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x18(%r14)
leaq 0x2ffe3(%rip), %rbx     # 0x3c7eb
jmp 0xc465
cmpb $0x73, 0x1(%r15)
jne 0xc916
movzbl 0x2(%r15), %eax
cmpl $0x20, %eax
je 0xc82b
cmpl $0x9, %eax
jne 0xc916
leaq 0x3(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x3, %r15
movq %r15, %rdi
leaq 0x30595(%rip), %rsi     # 0x3cddd
callq 0x6060
leaq (%rax,%r15), %r13
movabsq $0x3ff0000000000000, %rbx # imm = 0x3FF0000000000000
movq %rbx, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rbp
movq %rbp, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x1c(%r14)
movq %r13, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r13
movq %r13, %rdi
leaq 0x30543(%rip), %rsi     # 0x3cddd
callq 0x6060
leaq (%rax,%r13), %r15
movq %rbx, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x20(%r14)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
movq %r15, %rdi
leaq 0x30500(%rip), %rsi     # 0x3cddd
callq 0x6060
movq %rax, %r13
addq %r15, %r13
movq %rbx, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x24(%r14)
leaq 0x2feda(%rip), %rbx     # 0x3c7eb
jmp 0xc465
cmpb $0x74, 0x1(%r15)
jne 0xca13
movzbl 0x2(%r15), %eax
cmpl $0x20, %eax
je 0xc934
cmpl $0x9, %eax
jne 0xca13
leaq 0x3(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x3, %r15
movq %r15, %rdi
leaq 0x3048c(%rip), %rbp     # 0x3cddd
movq %rbp, %rsi
callq 0x6060
leaq (%rax,%r15), %r13
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x1a505
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x28(%r14)
movq %r13, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6060
leaq (%rax,%r13), %r15
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x2c(%r14)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6060
movq %rax, %r13
addq %r15, %r13
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x30(%r14)
leaq 0x2fddd(%rip), %rbx     # 0x3c7eb
jmp 0xc465
movl $0x5, %edx
movq %r15, %rdi
leaq 0x2fde7(%rip), %rsi     # 0x3c809
callq 0x61c0
testl %eax, %eax
je 0xcb9a
movl $0x8, %edx
movq %r15, %rdi
leaq 0x2fdd1(%rip), %rsi     # 0x3c80f
callq 0x61c0
testl %eax, %eax
je 0xcca3
cmpb $0x2d, %bl
jne 0xcb25
cmpb $0x6d, 0x1(%r15)
jne 0xcb25
cmpb $0x6d, 0x2(%r15)
jne 0xcb25
movzbl 0x3(%r15), %eax
cmpl $0x20, %eax
je 0xca7d
cmpl $0x9, %eax
jne 0xcb25
leaq 0x4(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x4, %r15
movq %r15, %rdi
leaq 0x30343(%rip), %r13     # 0x3cddd
movq %r13, %rsi
callq 0x6060
leaq (%rax,%r15), %rbx
movq $0x0, 0x8(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x1a505
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0x8(%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6060
movq %rax, %r13
addq %rbx, %r13
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1a505
xorps %xmm0, %xmm0
cvtsd2ss 0x8(%rsp), %xmm0
movss %xmm0, 0xc(%r14)
leaq 0x2fccb(%rip), %rbx     # 0x3c7eb
jmp 0xc465
movl $0xb, %edx
movq %r15, %rdi
leaq 0x2fce4(%rip), %rsi     # 0x3c818
callq 0x61c0
testl %eax, %eax
je 0xccf9
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x28(%rsp), %rdx
callq 0x1a75c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x64a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x2fc74(%rip), %rbx     # 0x3c7eb
je 0xcb86
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
addq 0x58(%rsp), %r15
movb $0x1, %al
movq %rax, 0x48(%rsp)
movq %r15, %r13
jmp 0xc465
movzbl 0x5(%r15), %eax
cmpl $0x20, %eax
je 0xcbad
cmpl $0x9, %eax
jne 0xca2f
addq $0x5, %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x6190
movq %rax, %r13
addq %r15, %r13
movq %r13, %rdi
leaq 0x30211(%rip), %rsi     # 0x3cddd
callq 0x6060
movq %rax, %r15
movl $0x8, %edx
movq %r13, %rdi
leaq 0x30189(%rip), %rsi     # 0x3cd6c
callq 0x61c0
testl %eax, %eax
je 0xcdcf
movl $0xb, %edx
movq %r13, %rdi
leaq 0x30176(%rip), %rsi     # 0x3cd75
callq 0x61c0
testl %eax, %eax
leaq 0x2fbde(%rip), %rbx     # 0x3c7eb
je 0xcddd
movl $0x9, %edx
movq %r13, %rdi
leaq 0x3015f(%rip), %rsi     # 0x3cd81
callq 0x61c0
testl %eax, %eax
je 0xcde4
movl $0xa, %edx
movq %r13, %rdi
leaq 0x3014d(%rip), %rsi     # 0x3cd8b
callq 0x61c0
testl %eax, %eax
je 0xcdeb
movl $0xa, %edx
movq %r13, %rdi
leaq 0x3013c(%rip), %rsi     # 0x3cd96
callq 0x61c0
testl %eax, %eax
je 0xcdf2
movl $0x9, %edx
movq %r13, %rdi
leaq 0x3012b(%rip), %rsi     # 0x3cda1
callq 0x61c0
testl %eax, %eax
je 0xcdf9
movl $0x6, %edx
movq %r13, %rdi
leaq 0x30119(%rip), %rsi     # 0x3cdab
callq 0x61c0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
jmp 0xcdfe
movzbl 0x8(%r15), %eax
cmpl $0x20, %eax
je 0xccb6
cmpl $0x9, %eax
jne 0xca4b
leaq 0x9(%r15), %rdi
movq %r12, %rsi
callq 0x6190
addq %rax, %r15
addq $0x9, %r15
movq %r15, %rdi
leaq 0x3010a(%rip), %rsi     # 0x3cddd
callq 0x6060
leaq (%r15,%rax), %r13
cmpq $0x1, %rax
leaq 0x2fb04(%rip), %rbx     # 0x3c7eb
jne 0xc465
movb (%r15), %al
movb %al, 0x35(%r14)
jmp 0xc465
movzbl 0xb(%r15), %eax
cmpl $0x20, %eax
je 0xcd0c
cmpl $0x9, %eax
jne 0xcb41
movq %r14, 0x70(%rsp)
leaq 0xc(%r15), %rdi
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %r12, %rsi
callq 0x6190
leaq (%r15,%rax), %rbx
addq $0xc, %rbx
movq %rbx, %rdi
leaq 0x30096(%rip), %rsi     # 0x3cddd
callq 0x6060
movq %rax, %r13
addq %rbx, %r13
leaq 0x18(%rsp), %r15
movq %r15, 0x8(%rsp)
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1b32e
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x64a0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
leaq 0x2fa60(%rip), %rbx     # 0x3c7eb
je 0xcd9a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x64a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcdc5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x70(%rsp), %r14
jmp 0xc465
movl $0x2, %ecx
leaq 0x2fa10(%rip), %rbx     # 0x3c7eb
jmp 0xcdfe
movl $0x3, %ecx
jmp 0xcdfe
movl $0x6, %ecx
jmp 0xcdfe
movl $0x7, %ecx
jmp 0xcdfe
movl $0x4, %ecx
jmp 0xcdfe
movl $0x5, %ecx
addq %r15, %r13
movl %ecx, (%r14)
jmp 0xc465
movq 0x48(%rsp), %rbx
testb $0x1, %bl
je 0xce25
leaq 0x50(%rsp), %rsi
movq 0x80(%rsp), %rdi
callq 0x6200
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xce41
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6400
andb $0x1, %bl
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xce7e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6400
jmp 0xce7e
jmp 0xce7b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xce9a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6400
movq %rbx, %rdi
callq 0x66e0