// File: solaldunckel[P]webserv/srcs/Utils/File.cpp
// Function: File::find_index(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
std::string File::find_index(std::vector<std::string> &indexes) {
  DIR *dir;
  struct dirent *ent;

  if ((dir = opendir(path_.c_str()))) {
    while ((ent = readdir(dir))) {
      for (std::vector<std::string>::iterator it = indexes.begin(); it != indexes.end(); it++) {
        if (*it == ent->d_name) {
          std::string ret = "/" + std::string(ent->d_name);
          closedir(dir);
          return ret;
        }
      }
    }
    closedir(dir);
  } else {
    Log.print(DEBUG, "opendir : " + std::string(strerror(errno)) + " of " + path_, RED, true);
    return "";
  }
  return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x148(%rbp)
movq %rdi, %rax
movq %rax, -0x140(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x138(%rbp)
addq $0x80, %rdi
callq 0x51f0
movq %rax, %rdi
callq 0x5840
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x37986
jmp 0x37817
movq -0x20(%rbp), %rdi
callq 0x5860
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x37978
movq -0x18(%rbp), %rdi
callq 0x9210
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9280
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x9240
testb $0x1, %al
jne 0x3785e
jmp 0x37973
leaq -0x30(%rbp), %rdi
callq 0x92b0
movq %rax, %rdi
movq -0x28(%rbp), %rsi
addq $0x13, %rsi
callq 0x8ff0
testb $0x1, %al
jne 0x37880
jmp 0x3795d
movb $0x0, -0x39(%rbp)
movq -0x28(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x158(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x5960
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x6be0
jmp 0x378bc
movq -0x148(%rbp), %rdi
leaq 0xbcd9(%rip), %rsi      # 0x435a3
leaq -0x60(%rbp), %rdx
callq 0x107f0
jmp 0x378d5
leaq -0x60(%rbp), %rdi
callq 0x5aa8
leaq -0x61(%rbp), %rdi
callq 0x55e0
movq -0x20(%rbp), %rdi
callq 0x58a0
jmp 0x378f2
movb $0x1, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x37958
jmp 0x3794c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37921
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5aa8
leaq -0x61(%rbp), %rdi
callq 0x55e0
jmp 0x37c39
movq -0x148(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
callq 0x5aa8
jmp 0x37c39
movq -0x148(%rbp), %rdi
callq 0x5aa8
jmp 0x37c29
jmp 0x3795f
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x13ae0
movq %rax, -0x80(%rbp)
jmp 0x3783b
jmp 0x37817
movq -0x20(%rbp), %rdi
callq 0x58a0
jmp 0x37bd2
callq 0x5060
movl (%rax), %edi
callq 0x5170
movq %rax, -0x168(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x5960
movq -0x168(%rbp), %rsi
movq -0x160(%rbp), %rdx
leaq -0x100(%rbp), %rdi
callq 0x6be0
jmp 0x379c8
leaq 0xc532(%rip), %rsi      # 0x43f01
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x107f0
jmp 0x379e4
leaq 0xc4b3(%rip), %rdx      # 0x43e9e
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x6a80
jmp 0x37a00
movq -0x138(%rbp), %rdx
subq $-0x80, %rdx
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x6a30
jmp 0x37a20
leaq -0x129(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x5960
movq -0x170(%rbp), %rdx
leaq 0xb5df(%rip), %rsi      # 0x43020
leaq -0x128(%rbp), %rdi
callq 0x6be0
jmp 0x37a4f
leaq 0x24ba2(%rip), %rdi     # 0x5c5f8
movl $0x2, %esi
leaq -0xa0(%rbp), %rdx
leaq -0x128(%rbp), %rcx
movl $0x1, %r8d
callq 0x3b240
jmp 0x37a76
leaq -0x128(%rbp), %rdi
callq 0x5aa8
leaq -0x129(%rbp), %rdi
callq 0x55e0
leaq -0xa0(%rbp), %rdi
callq 0x5aa8
leaq -0xc0(%rbp), %rdi
callq 0x5aa8
leaq -0xe0(%rbp), %rdi
callq 0x5aa8
leaq -0x100(%rbp), %rdi
callq 0x5aa8
leaq -0x101(%rbp), %rdi
callq 0x55e0
leaq -0x12a(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x5960
movq -0x148(%rbp), %rdi
movq -0x178(%rbp), %rdx
leaq 0xbf62(%rip), %rsi      # 0x43a54
callq 0x6be0
jmp 0x37af9
leaq -0x12a(%rbp), %rdi
callq 0x55e0
jmp 0x37c29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37b9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37b8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37b83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x37b6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x5aa8
leaq -0x129(%rbp), %rdi
callq 0x55e0
leaq -0xa0(%rbp), %rdi
callq 0x5aa8
leaq -0xc0(%rbp), %rdi
callq 0x5aa8
leaq -0xe0(%rbp), %rdi
callq 0x5aa8
leaq -0x100(%rbp), %rdi
callq 0x5aa8
leaq -0x101(%rbp), %rdi
callq 0x55e0
jmp 0x37c39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x12a(%rbp), %rdi
callq 0x55e0
jmp 0x37c39
leaq -0x12b(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x5960
movq -0x148(%rbp), %rdi
movq -0x180(%rbp), %rdx
leaq 0xbe5a(%rip), %rsi      # 0x43a54
callq 0x6be0
jmp 0x37c01
leaq -0x12b(%rbp), %rdi
callq 0x55e0
jmp 0x37c29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x12b(%rbp), %rdi
callq 0x55e0
jmp 0x37c39
movq -0x140(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x5950
nopw %cs:(%rax,%rax)