// File: mbourand[P]webserv/srcs/Methods/GetMethod.cpp
// Function: GetMethod::get_last_modified_format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string GetMethod::get_last_modified_format(const std::string& realPath, const std::string& format)
{
	struct stat st;
	if (lstat(realPath.c_str(), &st) < 0)
		return "-";
	std::ostringstream convert;
	struct tm	time;
	strptime(std::string(convert.str()).c_str(), "%s", &time);
	convert << st.st_mtime;
	strptime(std::string(convert.str()).c_str(), "%s", &time);
	char		buffer[1024];
	strftime(buffer, sizeof(buffer), format.c_str(), &time);
	convert.str("");
	return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
movq %rdi, -0x6f8(%rbp)
movq %rdi, %rax
movq %rax, -0x6f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x92b0
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x9c10
cmpl $0x0, %eax
jge 0xfb5c
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x700(%rbp)
callq 0x9b10
movq -0x6f8(%rbp), %rdi
movq -0x700(%rbp), %rdx
leaq 0x5b0ac(%rip), %rsi     # 0x6abcd
callq 0xa780
jmp 0xfb28
leaq -0xb1(%rbp), %rdi
callq 0x9700
jmp 0xfd68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0x9700
jmp 0xfd78
leaq -0x240(%rbp), %rdi
movq %rdi, -0x708(%rbp)
callq 0x9890
movq -0x708(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x96a0
jmp 0xfb84
leaq -0x298(%rbp), %rdi
movq %rdi, -0x710(%rbp)
callq 0x92b0
movq %rax, %rdi
leaq 0x5a7c8(%rip), %rsi     # 0x6a369
leaq -0x278(%rbp), %rdx
callq 0x90e0
movq -0x710(%rbp), %rdi
callq 0x9c98
movq -0x58(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x9b70
jmp 0xfbcb
leaq -0x2b8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x96a0
jmp 0xfbe0
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x728(%rbp)
callq 0x92b0
movq %rax, %rdi
leaq 0x5a76c(%rip), %rsi     # 0x6a369
leaq -0x278(%rbp), %rdx
movq %rdx, -0x720(%rbp)
callq 0x90e0
movq -0x728(%rbp), %rdi
callq 0x9c98
movq -0x20(%rbp), %rdi
callq 0x92b0
movq -0x720(%rbp), %rcx
movq %rax, %rdx
leaq -0x6c0(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x9550
leaq -0x6e1(%rbp), %rdi
movq %rdi, -0x718(%rbp)
callq 0x9b10
movq -0x718(%rbp), %rdx
leaq 0x5b10f(%rip), %rsi     # 0x6ad70
leaq -0x6e0(%rbp), %rdi
callq 0xa780
jmp 0xfc6f
leaq -0x240(%rbp), %rdi
leaq -0x6e0(%rbp), %rsi
callq 0x9300
jmp 0xfc84
leaq -0x6e0(%rbp), %rdi
callq 0x9c98
leaq -0x6e1(%rbp), %rdi
callq 0x9700
leaq -0x6e2(%rbp), %rdi
movq %rdi, -0x730(%rbp)
callq 0x9b10
movq -0x6f8(%rbp), %rdi
movq -0x730(%rbp), %rdx
leaq -0x6c0(%rbp), %rsi
callq 0xa780
jmp 0xfccb
leaq -0x6e2(%rbp), %rdi
callq 0x9700
leaq -0x240(%rbp), %rdi
callq 0x91a0
jmp 0xfd68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0xfd5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0xfd2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x6e0(%rbp), %rdi
callq 0x9c98
leaq -0x6e1(%rbp), %rdi
callq 0x9700
jmp 0xfd5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x6e2(%rbp), %rdi
callq 0x9700
leaq -0x240(%rbp), %rdi
callq 0x91a0
jmp 0xfd78
movq -0x6f0(%rbp), %rax
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
movq -0xc0(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)