// File: /workspace/github_cpp_makefile_star2_O3/mrGoncharuk[P]foldermonitor/src/DirectoryMonitor.cpp
// Function: DirectoryMonitor::startWatching(std::mutex&, std::__cxx11::list<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::atomic<bool>&)
void	DirectoryMonitor::startWatching(std::mutex &p_mutex, std::list<std::string> &filenames, std::atomic<bool> &isRunning)
{
	char buffer[BufferSize];
	int i;
	int total_read;
	while (isRunning)
	{
		i = 0;
		total_read = read(fileDescriptor, buffer, BufferSize);
		if (total_read < 0)
			syslog (LOG_ERR, "DM> Error while reading folder events.");
		while (i < total_read)
		{
			inotify_event *event = reinterpret_cast<inotify_event *>(buffer + i);
			if (event->len)
			{
				if (!(event->mask & IN_ISDIR))
				{
					std::lock_guard<std::mutex> lock(p_mutex);
					syslog (LOG_INFO, "DM> File created <%s>", event->name);

					filenames.push_back(fname + event->name);
				}
			}
			i += MonitorEventSize + event->len;
		}
	}
	syslog(LOG_NOTICE, "DM> Monitoring of <%s> stops.", fname.c_str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3048, %rsp           # imm = 0x3048
movq %rdx, 0x38(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, (%rsp)
movq %rcx, 0x30(%rsp)
movb (%rcx), %al
testb $0x1, %al
je 0x30a8
leaq 0x10(%rsp), %r12
movq (%rsp), %rax
movl (%rax), %edi
movl $0x3000, %edx           # imm = 0x3000
leaq 0x40(%rsp), %rsi
callq 0x2260
movq %rax, %r14
testl %r14d, %r14d
js 0x3086
je 0x3099
xorl %ebx, %ebx
movslq %ebx, %rdx
movl 0x4c(%rsp,%rdx), %ecx
movl $0x0, %eax
testl %ecx, %ecx
je 0x3076
leaq (%rsp,%rdx), %r15
addq $0x40, %r15
testb $0x40, 0x7(%r15)
movl %ecx, %eax
jne 0x3076
movq 0x8(%rsp), %rdi
callq 0x2280
testl %eax, %eax
jne 0x30d5
leaq 0x10(%r15), %rbp
movl $0x6, %edi
leaq 0x1603(%rip), %rsi      # 0x45b4
movq %rbp, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
movq %r12, %r13
movq %r12, %rdi
callq 0x2d5e
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2350
movl $0x30, %edi
callq 0x21e0
movq %rax, %rcx
addq $0x20, %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rsi
cmpq %rsi, %rdx
je 0x301d
movq %rdx, 0x10(%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rax)
jmp 0x3023
movups (%rsi), %xmm0
movups %xmm0, (%rcx)
movq %rsi, %rdx
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rsi, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %rax, %rdi
movq 0x38(%rsp), %rbp
movq %rbp, %rsi
movq %rdx, %r13
callq 0x2040
incq 0x10(%rbp)
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x3068
callq 0x21c0
movq 0x8(%rsp), %rdi
callq 0x2170
movl 0xc(%r15), %eax
addl %eax, %ebx
addl $0x10, %ebx
cmpl %r14d, %ebx
jl 0x2f66
jmp 0x3099
movl $0x3, %edi
leaq 0x14fb(%rip), %rsi      # 0x458d
xorl %eax, %eax
callq 0x2050
movq 0x30(%rsp), %rax
movb (%rax), %al
testb $0x1, %al
jne 0x2f3d
movq (%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x1513(%rip), %rsi      # 0x45ca
movl $0x5, %edi
xorl %eax, %eax
callq 0x2050
addq $0x3048, %rsp           # imm = 0x3048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x2140
jmp 0x30de
movq %rax, %r14
jmp 0x30fc
jmp 0x30e5
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x30fc
callq 0x21c0
movq 0x8(%rsp), %rdi
callq 0x2170
movq %r14, %rdi
callq 0x22e0
nop