// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x850, %rsp            # imm = 0x850
movq %rdi, -0x10(%rbp)
movl $0x0, -0x34(%rbp)
leaq -0x834(%rbp), %rdi
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0xf7d0
leaq -0x834(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movl $0x800, %edx            # imm = 0x800
callq 0x10470
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jle 0x46fc5
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x46fb1
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xf5c0
movq %rax, -0x840(%rbp)
cmpq $0x0, -0x840(%rbp)
je 0x46f1b
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x10, %rsi
movq -0x840(%rbp), %rdx
callq 0x46190
movq %rax, -0x848(%rbp)
cmpq $0x0, %rax
je 0x46f19
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x47000
movl %eax, %ecx
movq -0x848(%rbp), %rax
orl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
jmp 0x46e80
movq -0x848(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x46ea8
movq -0x848(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x848(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x848(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x848(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, (%rax)
jmp 0x46ec3
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x848(%rbp), %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
je 0x46ef3
movq -0x848(%rbp), %rcx
addq $0x18, %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x848(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
movq -0x848(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x46f17
jmp 0x46f19
jmp 0x46f56
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x47000
movl %eax, %ecx
movq -0x10(%rbp), %rax
orl 0x4c(%rax), %ecx
movl %ecx, 0x4c(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x50(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0x0, %eax
je 0x46f54
movq -0x10(%rbp), %rax
movb $0x1, 0x51(%rax)
jmp 0x46f56
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3c0, %eax            # imm = 0x3C0
cmpl $0x0, %eax
je 0x46f8d
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
andl $0x3c0, %edi            # imm = 0x3C0
callq 0x47000
movl %eax, %ecx
movq -0x10(%rbp), %rax
orl 0x4c(%rax), %ecx
movl %ecx, 0x4c(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x50(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq -0x20(%rbp), %rcx
movl 0xc(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x46e0a
cmpl $0x20, -0x34(%rbp)
jl 0x46fc0
movl $0x0, -0x4(%rbp)
jmp 0x46fee
jmp 0x46dd4
cmpl $0x0, -0x34(%rbp)
jle 0x46fd4
movl $0x0, -0x4(%rbp)
jmp 0x46fee
cmpq $0x0, -0x30(%rbp)
jne 0x46fe4
movl $0x20, -0x4(%rbp)
jmp 0x46fee
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x850, %rsp            # imm = 0x850
popq %rbp
retq
nopw (%rax,%rax)