// File: /workspace/github_c_makefile_star2_O1/cirocosta[P]stress/src/file-watcher.c
// Function: create_files_and_watch
void
create_files_and_watch(int n, int fd)
{
	struct stat st = { 0 };
	int i = 0;
	int wd;

	_STRESS_INFO("creating directory for files at '%s'", files_directory);

	_STRESS_MUST_P(stat(files_directory, &st) == -1,
	               "stat",
	               "Directory %s already exists.",
	               files_directory);

	_STRESS_MUST_P(mkdir(files_directory, 0700) != -1,
	               "mkdir",
	               "Couldn't create %s directory",
	               files_directory);

	_STRESS_INFO("%d files will be created", n);

	while (i++ < n) {
		create_file(files_directory, i);
	}

	_STRESS_INFO("Finished creating files and their watches");
	_STRESS_INFO("Adding watch to directory");

	_STRESS_MUST_P(
	  (wd = inotify_add_watch(
	     fd, files_directory, IN_CREATE | IN_MODIFY | IN_DELETE)) >= 0,
	  "inotify_add_watch",
	  "couldn't add watch for directory %s",
	  files_directory);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %esi, %ebx
movl %edi, %r14d
leaq 0x8(%rsp), %r15
movl $0x90, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10e0
movq 0x2dd7(%rip), %r13      # 0x3ff8
movq (%r13), %rcx
leaq 0xf3f(%rip), %rdi       # 0x216b
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xf31(%rip), %rsi       # 0x2173
leaq 0xdd7(%rip), %r12       # 0x2020
movq %r12, %rdx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movq %r12, %rdi
movq %r15, %rsi
callq 0x1120
cmpl $-0x1, %eax
jne 0x139a
leaq 0xda6(%rip), %rdi       # 0x2020
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x1060
movq (%r13), %rcx
cmpl $-0x1, %eax
je 0x145b
leaq 0xed3(%rip), %rdi       # 0x216b
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xf40(%rip), %rsi       # 0x21ee
movl %r14d, %edx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
testl %r14d, %r14d
jle 0x12f5
negl %r14d
pushq $0x1
popq %r12
leaq 0xd49(%rip), %r15       # 0x2020
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e2b
leal (%r14,%r12), %eax
incl %eax
movl %r12d, %ecx
incl %ecx
movl %ecx, %r12d
cmpl $0x1, %eax
jne 0x12d7
movq (%r13), %rcx
leaq 0xe6b(%rip), %r15       # 0x216b
pushq $0x7
popq %r12
pushq $0x1
popq %r14
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xee6(%rip), %rdi       # 0x2207
pushq $0x29
popq %rsi
movq %r14, %rdx
callq 0x11b0
movq (%r13), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0x10f0
movq (%r13), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xeda(%rip), %rdi       # 0x2231
pushq $0x19
popq %rsi
movq %r14, %rdx
callq 0x11b0
movq (%r13), %rsi
movl %ebp, %edi
callq 0x10f0
leaq 0xcac(%rip), %rsi       # 0x2020
movl %ebx, %edi
movl $0x302, %edx            # imm = 0x302
callq 0x1140
testl %eax, %eax
js 0x1548
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r13), %rcx
leaq 0xe17(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xe04(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xdbd(%rip), %rsi       # 0x2198
leaq 0xc3e(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0xc5e(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xc4b(%rip), %rsi       # 0x2055
leaq 0xd27(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0xc4e(%rip), %rsi       # 0x2071
pushq $0x33
popq %rdx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movq (%r13), %rcx
leaq 0xd71(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0xd70(%rip), %rdi       # 0x21c6
jmp 0x1513
leaq 0xd5a(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xd47(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xd33(%rip), %rsi       # 0x21cb
leaq 0xb81(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0xba1(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xb8e(%rip), %rsi       # 0x2055
leaq 0xc6a(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0xb91(%rip), %rsi       # 0x2071
pushq $0x38
popq %rdx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movq (%r13), %rcx
leaq 0xcb4(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0xcd5(%rip), %rdi       # 0x21e8
callq 0x1170
movq (%r13), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xb49(%rip), %rdi       # 0x207e
pushq $0xa
popq %rsi
movq %rbx, %rdx
callq 0x11b0
pushq $0x1
popq %rdi
callq 0x11a0
movq (%r13), %rcx
leaq 0xc69(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0xc56(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xcc2(%rip), %rsi       # 0x224b
leaq 0xa90(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0xab0(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0xa9d(%rip), %rsi       # 0x2055
leaq 0xb79(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0xaa0(%rip), %rsi       # 0x2071
pushq $0x48
popq %rdx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movq (%r13), %rcx
leaq 0xbc3(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0xc6b(%rip), %rdi       # 0x226f
jmp 0x1513