// File: /workspace/github_c_makefile_star2_O2/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, %ebp
leaq 0x8(%rsp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x10e0
movq 0x271f(%rip), %r13      # 0x3ff8
movq (%r13), %rcx
leaq 0x887(%rip), %rdi       # 0x216b
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x879(%rip), %rsi       # 0x2173
leaq 0x71f(%rip), %r15       # 0x2020
movq %r15, %rdx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movq %r15, %rdi
movq %r14, %rsi
callq 0x1120
cmpl $-0x1, %eax
jne 0x1a50
leaq 0x6ee(%rip), %rdi       # 0x2020
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x1060
movq (%r13), %rcx
cmpl $-0x1, %eax
je 0x1b11
leaq 0x81b(%rip), %rdi       # 0x216b
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x888(%rip), %rsi       # 0x21ee
xorl %r12d, %r12d
movl %ebp, %edx
xorl %eax, %eax
callq 0x1110
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
testl %ebp, %ebp
cmovgl %ebp, %r12d
negl %r12d
pushq $0x1
popq %r14
leaq 0x68e(%rip), %r15       # 0x2020
leal (%r12,%r14), %eax
cmpl $0x1, %eax
je 0x19ab
movq %r15, %rdi
movl %r14d, %esi
callq 0x16fe
incl %r14d
jmp 0x1992
movq (%r13), %rcx
leaq 0x7b5(%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 0x830(%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 0x824(%rip), %rdi       # 0x2231
pushq $0x19
popq %rsi
movq %r14, %rdx
callq 0x11b0
movq (%r13), %rsi
movl %ebp, %edi
callq 0x10f0
leaq 0x5f6(%rip), %rsi       # 0x2020
movl %ebx, %edi
movl $0x302, %edx            # imm = 0x302
callq 0x1140
testl %eax, %eax
js 0x1bfe
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r13), %rcx
leaq 0x761(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0x74e(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x707(%rip), %rsi       # 0x2198
leaq 0x588(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0x5a8(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x595(%rip), %rsi       # 0x2055
leaq 0x671(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0x598(%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 0x6bb(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0x6ba(%rip), %rdi       # 0x21c6
jmp 0x1bc9
leaq 0x6a4(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0x691(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x67d(%rip), %rsi       # 0x21cb
leaq 0x4cb(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0x4eb(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x4d8(%rip), %rsi       # 0x2055
leaq 0x5b4(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0x4db(%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 0x5fe(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0x61f(%rip), %rdi       # 0x21e8
callq 0x1170
movq (%r13), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0x493(%rip), %rdi       # 0x207e
pushq $0xa
popq %rsi
movq %rbx, %rdx
callq 0x11b0
pushq $0x1
popq %rdi
callq 0x11a0
movq (%r13), %rcx
leaq 0x5b3(%rip), %rdi       # 0x21bc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rcx
leaq 0x5a0(%rip), %r14       # 0x21c2
pushq $0x3
popq %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x60c(%rip), %rsi       # 0x224b
leaq 0x3da(%rip), %rdx       # 0x2020
xorl %eax, %eax
callq 0x1110
movq (%r13), %rcx
leaq 0x3fa(%rip), %rdi       # 0x2052
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x11b0
movq (%r13), %rdi
leaq 0x3e7(%rip), %rsi       # 0x2055
leaq 0x4c3(%rip), %rdx       # 0x2138
xorl %eax, %eax
callq 0x1110
movq (%r13), %rdi
leaq 0x3ea(%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 0x50d(%rip), %rdi       # 0x21b5
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x11b0
leaq 0x5b5(%rip), %rdi       # 0x226f
jmp 0x1bc9