// File: /workspace/github_c_makefile_star2_O1/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 0x4b4b(%rip), %r13      # 0x39530
movl (%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
callq 0x10310
testq %rax, %rax
jle 0x34b1b
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 0x34a96
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x34891
testq %rax, %rax
je 0x34ac5
movl 0x4(%r15), %ecx
xorl %edx, %edx
xorl %esi, %esi
testl %ecx, (%r13,%rdx,8)
je 0x34a48
orl 0x4(%r13,%rdx,8), %esi
incq %rdx
cmpq $0x8, %rdx
jne 0x34a3c
orl %esi, 0x8(%rax)
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x34a65
movq 0x20(%rax), %rdx
movq %rdx, 0x20(%rcx)
movq 0x20(%rax), %rdx
movq %rcx, (%rdx)
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x18(%rax)
testq %rcx, %rcx
je 0x34a88
movq %rax, %rdx
addq $0x18, %rdx
movq %rdx, 0x20(%rcx)
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x20(%rax)
jmp 0x34ac5
movl 0x4(%r15), %eax
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, (%r13,%rcx,8)
je 0x34aaa
orl 0x4(%r13,%rcx,8), %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x34a9e
orl %edx, 0x4c(%rbx)
movb $0x1, 0x50(%rbx)
testl $0xe000, %eax           # imm = 0xE000
je 0x34ac5
movb $0x1, 0x51(%rbx)
movl 0x4(%r15), %eax
movl $0x3c0, %ecx            # imm = 0x3C0
andl %ecx, %eax
je 0x34af2
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, (%r13,%rcx,8)
je 0x34ae2
orl 0x4(%r13,%rcx,8), %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x34ad6
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 0x34a09
cmpl $0x1e, %ebp
leaq 0x18(%rsp), %r15
jle 0x349e5
jmp 0x34b20
testl %r12d, %r12d
jle 0x34b34
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 0x34b42
callq 0xf0a0
movl (%rax), %eax
jmp 0x34b22
movl $0x20, %eax
jmp 0x34b22