// File: /workspace/github_cpp_makefile_star2_O2/metopa[P]HTTP_Server/src/content/CDirContent.cpp
// Function: CDirContent::load()
void CDirContent::load() {
	int rc;
	DIR * dir;
	dirent entry;
	dirent * result;
	Log.ger<>( DEBUG_REQUEST, "Directory:", realPath_m, userPath_m );
	vector<CHTMLGenerator> files_m;

	if ( !( dir = opendir( realPath_m.c_str() ) ) ) {
		int errNo = errno;

		switch ( errNo ) {
			case EACCES:
				throw PermissionDeniedException( userPath_m );
			case ENOENT:
				throw FileNotFoundException( userPath_m );
			default:
				throw FileErrorException( userPath_m );
		}
	}

	while ( !( rc = readdir_r( dir, &entry, &result ) ) ) {
		if ( result == nullptr )
			break;
		files_m.push_back( CHTMLGenerator( result->d_name ) );
		Log.ger<>( DEBUG_REQUEST, "Directory", result->d_name, (int)result->d_type );
		if ( result->d_type == DT_DIR || result->d_type == DT_REG )
			files_m.back().makeHyperlink( makeLink( result->d_name ) );
		files_m.back().enlarge();
		if ( !strcmp( result->d_name, ".." ) )
			files_m.back().setPriority( -2 );
		else if ( !strcmp( result->d_name, "." ) )
			files_m.back().setPriority( -1 );
	}

	stable_sort( files_m.begin(), files_m.end() );

	CHTMLGenerator table( string( "Index of " ) + userPath_m );
	table.enlarge( 2 ).makeTable( files_m );
	if ( rc )
		table.append( "\nAn error occured while reading directory content. Try to refresh page\n" );
	string rawHTML = table.wrap( string( "Index of " ) + userPath_m.c_str() );
	data_m.insert( data_m.begin(), rawHTML.begin(), rawHTML.end() );

	closedir( dir );

	size_m = data_m.size();

	modificationTime();
	creationTime();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, %rbx
leaq 0x40(%rdi), %rcx
leaq 0x20(%rdi), %r8
leaq 0x172e1(%rip), %rdi     # 0x215f0
leaq 0xa0b8(%rip), %rdx      # 0x143ce
pushq $0x7
popq %rsi
movq %r8, 0x10(%rsp)
callq 0xa814
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq %rbx, %r13
movq 0x40(%rbx), %rdi
callq 0x5660
testq %rax, %rax
je 0xa604
movq %rax, %r14
leaq 0x20(%rsp), %rbp
leaq 0x58(%rsp), %r15
leaq 0x78(%rsp), %rbx
movq %r14, %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x51d0
movl %eax, %r12d
testl %eax, %eax
jne 0xa48b
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0xa48b
addq $0x13, %rsi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x712a
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xcb4c
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0xacea
movq %rbx, %rdi
callq 0x5210
movq %rbp, %rdi
callq 0x5210
movq 0x18(%rsp), %rcx
movzbl 0x12(%rcx), %eax
addq $0x13, %rcx
movl %eax, 0x78(%rsp)
leaq 0x17219(%rip), %rdi     # 0x215f0
pushq $0x7
popq %rsi
leaq 0x9ff8(%rip), %rdx      # 0x143d9
movq %rbx, %r8
callq 0xa95e
movq 0x18(%rsp), %rsi
movzbl 0x12(%rsi), %eax
cmpl $0x8, %eax
je 0xa3fc
cmpl $0x4, %eax
jne 0xa43d
movq 0x48(%rsp), %r12
addq $0x13, %rsi
movq %rbp, %rdi
movq %r15, %rdx
callq 0x712a
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xa720
addq $-0x28, %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xceda
movq %rbx, %rdi
callq 0x5210
movq %rbp, %rdi
callq 0x5210
movq 0x48(%rsp), %rdi
addq $-0x28, %rdi
xorl %esi, %esi
callq 0xd160
movq 0x18(%rsp), %rax
cmpb $0x2e, 0x13(%rax)
jne 0xa358
cmpb $0x2e, 0x14(%rax)
jne 0xa46b
cmpb $0x0, 0x15(%rax)
pushq $-0x2
popq %rsi
je 0xa478
cmpb $0x0, 0x14(%rax)
pushq $-0x1
popq %rsi
jne 0xa358
movq 0x48(%rsp), %rdi
addq $-0x28, %rdi
callq 0xd36c
jmp 0xa358
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xaf9a
leaq 0x9f42(%rip), %rsi      # 0x143e3
leaq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x712a
movq 0x10(%rsp), %rbx
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq 0xaa11
leaq 0x78(%rsp), %rdi
leaq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0xcb4c
leaq 0x20(%rsp), %rdi
callq 0x5210
leaq 0x58(%rsp), %rdi
callq 0x5210
leaq 0x78(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0xd160
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xcfb2
testl %r12d, %r12d
je 0xa53d
leaq 0x9ed8(%rip), %rsi      # 0x143ed
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x712a
leaq 0x78(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xcebe
leaq 0x20(%rsp), %rdi
callq 0x5210
leaq 0x9e9f(%rip), %rsi      # 0x143e3
leaq 0xa0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x712a
movq (%rbx), %rdx
leaq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xaa30
leaq 0x20(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xd2b8
leaq 0x58(%rsp), %rdi
callq 0x5210
leaq 0xa0(%rsp), %rdi
callq 0x5210
leaq 0x8(%r13), %rdi
movq 0x8(%r13), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
addq %rdx, %rcx
callq 0xaa50
movq %r14, %rdi
callq 0x56d0
movq 0x10(%r13), %rax
subq 0x8(%r13), %rax
movq %rax, 0x60(%r13)
movq %r13, %rdi
callq 0xa7c4
movq %r13, %rdi
callq 0xa234
leaq 0x20(%rsp), %rdi
callq 0x5210
leaq 0x78(%rsp), %rdi
callq 0x5210
leaq 0x40(%rsp), %rdi
callq 0xaa70
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5060
movl (%rax), %ebx
pushq $0x48
popq %rdi
callq 0x5230
movq %rax, %r14
cmpl $0x2, %ebx
je 0xa636
cmpl $0xd, %ebx
jne 0xa64c
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0xa8c8
leaq 0x1602c(%rip), %rsi     # 0x20660
jmp 0xa660
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0xa8de
leaq 0x15e16(%rip), %rsi     # 0x20460
jmp 0xa660
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0xa948
leaq 0x16018(%rip), %rsi     # 0x20678
leaq -0x34eb(%rip), %rdx     # 0x717c
movq %r14, %rdi
callq 0x5740
jmp 0xa673
jmp 0xa673
movq %rax, %rbx
movq %r14, %rdi
callq 0x5300
jmp 0xa70d
jmp 0xa70a
jmp 0xa68e
jmp 0xa6d8
jmp 0xa68e
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0xa6b2
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5210
jmp 0xa6aa
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x5210
jmp 0xa6db
jmp 0xa6d8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5210
jmp 0xa6cd
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
jmp 0xa6ff
jmp 0xa70a
jmp 0xa70a
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0xa6ff
jmp 0xa6ed
jmp 0xa70a
jmp 0xa6e8
movq %rax, %rbx
jmp 0xa6fa
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x5210
leaq 0x20(%rsp), %rdi
callq 0x5210
jmp 0xa70d
jmp 0xa70a
jmp 0xa70a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xaa70
movq %rbx, %rdi
callq 0x5770
nop