// File: solaldunckel[P]webserv/srcs/Utils/File.cpp
// Function: File::parseExtensionsNegociation()
void File::parseExtensionsNegociation() {
  std::string file = path_.substr(path_.find_last_of("/") + 1);

  if (file.empty())
    return;

  file_name_full_ = file;

  file_name_ = file.substr(0, file.find("."));
  file.erase(0, file.find("."));
  if (file.find_last_of(".") != std::string::npos) {
    int last = file.find_last_of(".");
    mime_ext_ = file.substr(last);
    while (!g_mimes.getType(mime_ext_).compare("application/octet-stream")) {
      int last2 = last;
      if ((file.find_last_of(".", last - 1) != std::string::npos)) {
        last = file.find_last_of(".", last - 1);
        mime_ext_ = file.substr(last, last2 - last) ;
      }
      else
        break ;
      if (last <= 0)
        break ;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x100(%rbp)
movq %rdi, %rax
addq $0x80, %rax
movq %rax, -0xf8(%rbp)
addq $0x80, %rdi
leaq 0xdbcb(%rip), %rsi      # 0x435a3
movq $-0x1, %rdx
callq 0x5500
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
leaq -0x28(%rbp), %rdi
movq $-0x1, %rcx
callq 0x55a0
leaq -0x28(%rbp), %rdi
callq 0x5900
testb $0x1, %al
jne 0x35a11
jmp 0x35a1d
movl $0x1, -0x2c(%rbp)
jmp 0x35cb4
movq -0x100(%rbp), %rdi
addq $0x28, %rdi
leaq -0x28(%rbp), %rsi
callq 0x5050
jmp 0x35a33
leaq 0xdf69(%rip), %rsi      # 0x439a3
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x108(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x5a70
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq %rax, %rcx
leaq -0x60(%rbp), %rdi
callq 0x55a0
jmp 0x35a71
movq -0x100(%rbp), %rdi
addq $0x8, %rdi
leaq -0x60(%rbp), %rsi
movq %rsi, -0x128(%rbp)
callq 0x56d0
movq -0x128(%rbp), %rdi
callq 0x5aa8
leaq 0xdf04(%rip), %rsi      # 0x439a3
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x118(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x5a70
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq %rax, %rdx
callq 0x50d0
jmp 0x35ad2
leaq -0x28(%rbp), %rdi
leaq 0xdec6(%rip), %rsi      # 0x439a3
movq $-0x1, %rdx
callq 0x5500
cmpq $-0x1, %rax
je 0x35cad
leaq 0xdea9(%rip), %rsi      # 0x439a3
leaq -0x28(%rbp), %rdi
movq %rdi, -0x138(%rbp)
movq $-0x1, %rdx
movq %rdx, -0x130(%rbp)
callq 0x5500
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rcx
movl %eax, -0x64(%rbp)
movslq -0x64(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x55a0
jmp 0x35b3b
movq -0x100(%rbp), %rdi
addq $0x48, %rdi
leaq -0x88(%rbp), %rsi
callq 0x56d0
leaq -0x88(%rbp), %rdi
callq 0x5aa8
movq -0x100(%rbp), %rsi
addq $0x48, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x5200
jmp 0x35b77
leaq 0x26afa(%rip), %rsi     # 0x5c678
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x403d0
jmp 0x35b93
leaq -0xa8(%rbp), %rdi
leaq 0xe373(%rip), %rsi      # 0x43f14
callq 0x5140
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x139(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5aa8
leaq -0xc8(%rbp), %rdi
callq 0x5aa8
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x35bdb
jmp 0x35cab
movl -0x64(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl -0x64(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
leaq -0x28(%rbp), %rdi
leaq 0xddab(%rip), %rsi      # 0x439a3
callq 0x5500
cmpq $-0x1, %rax
je 0x35c9c
movl -0x64(%rbp), %eax
decl %eax
movslq %eax, %rdx
leaq 0xdd8d(%rip), %rsi      # 0x439a3
leaq -0x28(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x5500
movq -0x148(%rbp), %rsi
movl %eax, -0x64(%rbp)
movslq -0x64(%rbp), %rdx
movl %edx, %ecx
movl -0xcc(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq -0xf0(%rbp), %rdi
callq 0x55a0
jmp 0x35c4f
movq -0x100(%rbp), %rdi
addq $0x48, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x56d0
leaq -0xf0(%rbp), %rdi
callq 0x5aa8
jmp 0x35c9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x35cc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x5aa8
jmp 0x35cc6
jmp 0x35cab
cmpl $0x0, -0x64(%rbp)
jg 0x35ca6
jmp 0x35cab
jmp 0x35b5e
jmp 0x35cad
movl $0x0, -0x2c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5aa8
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x5aa8
movq -0x38(%rbp), %rdi
callq 0x5950
nopl (%rax,%rax)