// File: /workspace/github_cpp_makefile_star2_O1/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 0x30a1
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
jns 0x2f75
movl $0x3, %edi
leaq 0x161f(%rip), %rsi      # 0x458d
xorl %eax, %eax
callq 0x2050
testl %r14d, %r14d
jle 0x3092
xorl %ebx, %ebx
movslq %ebx, %rax
leaq (%rsp,%rax), %r15
addq $0x40, %r15
cmpl $0x0, 0xc(%r15)
je 0x3080
testb $0x40, 0x7(%r15)
jne 0x3080
movq 0x8(%rsp), %rdi
callq 0x2280
testl %eax, %eax
jne 0x30ce
leaq 0x10(%r15), %rbp
movl $0x6, %edi
leaq 0x15f1(%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 0x2d6a
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), %r13
cmpq %r13, %rdx
je 0x302f
movq %rdx, 0x10(%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rax)
jmp 0x3037
movups (%r13), %xmm0
movups %xmm0, (%rcx)
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %r13, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %rax, %rdi
movq 0x38(%rsp), %rbp
movq %rbp, %rsi
callq 0x2040
incq 0x10(%rbp)
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x3076
callq 0x21c0
movq 0x8(%rsp), %rdi
callq 0x2170
movl 0xc(%r15), %eax
addl %eax, %ebx
addl $0x10, %ebx
cmpl %r14d, %ebx
jl 0x2f80
movq 0x30(%rsp), %rax
movb (%rax), %al
testb $0x1, %al
jne 0x2f45
movq (%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x151a(%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 0x30d7
movq %rax, %r14
jmp 0x30f5
jmp 0x30de
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x30f5
callq 0x21c0
movq 0x8(%rsp), %rdi
callq 0x2170
movq %r14, %rdi
callq 0x22e0
nop