// File: 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
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x468(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x7690
movq -0x468(%rbp), %rdi
addq $0x8, %rdi
callq 0x77e0
testb $0x1, %al
jne 0x1e18c
movq -0x468(%rbp), %rsi
addq $0x8, %rsi
leaq -0x98(%rbp), %rdi
callq 0x71e0
jmp 0x1e118
movq -0x18(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x2b680
jmp 0x1e12e
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x75f0
leaq -0x78(%rbp), %rdi
callq 0x72e0
leaq -0x98(%rbp), %rdi
callq 0x72e0
jmp 0x1e19d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1e36f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x72e0
jmp 0x1e36f
movq -0x18(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x7050
jmp 0x1e19b
jmp 0x1e19d
leaq -0x58(%rbp), %rdi
callq 0x71c0
movq %rax, %rsi
leaq -0x2b0(%rbp), %rdi
movl $0x8, %edx
callq 0x78c0
jmp 0x1e1bc
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x2b0(%rbp,%rax), %rdi
callq 0x7220
movb %al, -0x469(%rbp)
jmp 0x1e1dc
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x1e1eb
jmp 0x1e314
leaq -0x438(%rbp), %rdi
callq 0x7360
jmp 0x1e1f9
leaq -0x428(%rbp), %rdi
leaq 0x60562(%rip), %rsi     # 0x7e769
callq 0x74e0
movq %rax, -0x478(%rbp)
jmp 0x1e215
movq -0x478(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x7450
movq %rax, -0x480(%rbp)
jmp 0x1e22e
movq -0x480(%rbp), %rdi
leaq 0x6053e(%rip), %rsi     # 0x7e77a
callq 0x74e0
movq %rax, -0x488(%rbp)
jmp 0x1e24a
movq -0x488(%rbp), %rdi
movq 0x91d18(%rip), %rsi     # 0xaff70
callq 0x7540
jmp 0x1e25f
cmpq $0x0, -0x30(%rbp)
je 0x1e2ea
leaq -0x458(%rbp), %rdi
leaq -0x438(%rbp), %rsi
callq 0x74d0
jmp 0x1e27f
movq -0x30(%rbp), %rdi
leaq -0x458(%rbp), %rsi
callq 0x7620
jmp 0x1e291
leaq -0x458(%rbp), %rdi
callq 0x72e0
jmp 0x1e2ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1e363
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1e306
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x458(%rbp), %rdi
callq 0x72e0
jmp 0x1e306
movb $0x0, -0x1(%rbp)
movl $0x1, -0x45c(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x73b0
jmp 0x1e340
leaq -0x438(%rbp), %rdi
callq 0x73b0
jmp 0x1e363
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq -0x2b0(%rbp), %rdx
callq 0x1c180
jmp 0x1e332
movb $0x1, -0x1(%rbp)
movl $0x1, -0x45c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x70f0
leaq -0x58(%rbp), %rdi
callq 0x72e0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
leaq -0x2b0(%rbp), %rdi
callq 0x70f0
leaq -0x58(%rbp), %rdi
callq 0x72e0
movq -0xa0(%rbp), %rdi
callq 0x7860
nopw %cs:(%rax,%rax)