// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::MaterialFileReader::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<tinyobj::material_t, std::allocator<tinyobj::material_t>>*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
bool MaterialFileReader::operator()(const std::string &matId,
                                    std::vector<material_t> *materials,
                                    std::map<std::string, int> *matMap,
                                    std::string *warn, std::string *err) {
  std::string filepath;

  if (!m_mtlBaseDir.empty()) {
    filepath = std::string(m_mtlBaseDir) + matId;
  } else {
    filepath = matId;
  }

  std::ifstream matIStream(filepath.c_str());
  if (!matIStream) {
    std::stringstream ss;
    ss << "Material file [ " << filepath << " ] not found." << std::endl;
    if (warn) {
      (*warn) += ss.str();
    }
    return false;
  }

  LoadMtl(matMap, materials, &matIStream, warn, err);

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0x10(%rdi), %rdx
testq %rdx, %rdx
je 0xf115
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x8(%rdi), %rsi
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x1cfe4
movq (%r12), %rsi
movq 0x8(%r12), %rdx
leaq 0x48(%rsp), %rdi
callq 0x60f0
leaq 0x1e0(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xf124
movq %rdx, 0x1d0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x1e0(%rsp)
jmp 0xf12c
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x6200
jmp 0xf18e
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x1d0(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x64a0
movq (%r12), %rdi
cmpq %r13, %rdi
je 0xf172
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x18(%rsp), %r13
je 0xf18e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x8(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
movl $0x8, %edx
callq 0x6720
movq 0x1d0(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x1f0(%rsp,%rax), %ebp
testb $0x5, %bpl
je 0xf296
leaq 0x48(%rsp), %rdi
callq 0x62a0
leaq 0x58(%rsp), %r14
leaq 0x2d639(%rip), %rsi     # 0x3c811
movl $0x10, %edx
movq %r14, %rdi
callq 0x6470
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x6470
movq %rax, %r14
leaq 0x2d621(%rip), %rsi     # 0x3c822
movl $0xd, %edx
movq %rax, %rdi
callq 0x6470
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6280
testq %rbx, %rbx
je 0xf276
leaq 0x60(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x6620
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x60f0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf276
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x3fce3(%rip), %rsi     # 0x4ef60
leaq 0x48(%rsp), %rdi
callq 0x62e0
leaq 0xc8(%rsp), %rdi
callq 0x6100
jmp 0xf2ac
leaq 0x1d0(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0xd142
leaq 0x1d0(%rsp), %rdi
callq 0x60b0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xf2d0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
testb $0x5, %bpl
sete %al
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf30f
jmp 0xf332
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf33a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6400
jmp 0xf33a
jmp 0xf337
movq %rax, %rbx
jmp 0xf358
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xf365
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6400
jmp 0xf365
jmp 0xf332
movq %rax, %rbx
jmp 0xf365
movq %rax, %rbx
movq 0x3fc1f(%rip), %rsi     # 0x4ef60
leaq 0x48(%rsp), %rdi
callq 0x62e0
leaq 0xc8(%rsp), %rdi
callq 0x6100
leaq 0x1d0(%rsp), %rdi
callq 0x60b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xf381
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
movq %rbx, %rdi
callq 0x66e0
nop