// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/notify.c
// Function: in_step1
static int in_step1(struct notify *nfy) {
	struct inotify_event *buf, *msg, *end;
	ssize_t len;
	int count = 0;

	buf = in_msgbuf(IN_BUFSIZ);

	while ((len = read(nfy->fd, buf, IN_BUFSIZ)) > 0) {
		for (msg = buf, end = in_msgend(buf, len); msg < end; msg = in_msgnxt(msg)) {
			size_t namelen = strlen(msg->name);

			if (namelen) {
				struct file *file;

				if ((file = lookup(nfy, msg->name, namelen))) {
					file->changes |= decode(msg->mask);
					NFY_LIST_MOVE(&nfy->pending, file, le);
				}
			} else {
				nfy->changes |= decode(msg->mask);
				nfy->dirty = 1;

				if (msg->mask & (IN_Q_OVERFLOW|IN_IGNORED|IN_UNMOUNT))
					nfy->critical = 1;
			}

			if (msg->mask & (IN_CREATE|IN_DELETE|IN_MOVE)) {
				nfy->changes |= decode(msg->mask & (IN_CREATE|IN_DELETE|IN_MOVE));
				nfy->dirty = 1;
			}

			++count;
		}

		if (count >= NOTIFY_MAXSTEP)
			return 0;
	}

	if (count > 0)
		return 0;
	else if (len == 0)
		return EPIPE;
	else
		return errno;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdi, %rbx
leaq 0x18(%rsp), %r15
xorl %r12d, %r12d
movl $0x800, %edx            # imm = 0x800
movq %r15, %rdi
xorl %esi, %esi
callq 0xf750
leaq 0x18(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x5118(%rip), %r13      # 0x394f0
movl (%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
callq 0x10310
testq %rax, %rax
jle 0x3450a
addq %rsp, %rax
addq $0x18, %rax
movq %rax, 0x10(%rsp)
movl %r12d, %ebp
leaq 0x10(%r15), %r14
movq %r14, %rdi
callq 0xf560
testq %rax, %rax
je 0x34485
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x34295
testq %rax, %rax
je 0x344b4
movl 0x4(%r15), %ecx
xorl %edx, %edx
xorl %esi, %esi
testl %ecx, (%r13,%rdx,8)
je 0x3443b
orl 0x4(%r13,%rdx,8), %esi
incq %rdx
cmpq $0x8, %rdx
jne 0x3442f
orl %esi, 0x8(%rax)
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rdx
testq %rcx, %rcx
je 0x34458
movq %rdx, 0x20(%rcx)
movq %rcx, (%rdx)
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x18(%rax)
testq %rcx, %rcx
je 0x34477
movq %rax, %rdx
addq $0x18, %rdx
movq %rdx, 0x20(%rcx)
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x20(%rax)
jmp 0x344b4
movl 0x4(%r15), %eax
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, (%r13,%rcx,8)
je 0x34499
orl 0x4(%r13,%rcx,8), %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x3448d
orl %edx, 0x4c(%rbx)
movb $0x1, 0x50(%rbx)
testl $0xe000, %eax           # imm = 0xE000
je 0x344b4
movb $0x1, 0x51(%rbx)
movl 0x4(%r15), %eax
movl $0x3c0, %ecx            # imm = 0x3C0
andl %ecx, %eax
je 0x344e1
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, (%r13,%rcx,8)
je 0x344d1
orl 0x4(%r13,%rcx,8), %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x344c5
orl %edx, 0x4c(%rbx)
movb $0x1, 0x50(%rbx)
leal 0x1(%rbp), %r12d
movl 0xc(%r15), %eax
addq %rax, %r14
movq %r14, %r15
cmpq 0x10(%rsp), %r14
jb 0x343fc
cmpl $0x1e, %ebp
leaq 0x18(%rsp), %r15
jle 0x343d8
jmp 0x3450f
testl %r12d, %r12d
jle 0x34523
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rax, %rax
je 0x34531
callq 0xf0a0
movl (%rax), %eax
jmp 0x34511
movl $0x20, %eax
jmp 0x34511