// File: /workspace/github_c_makefile_star2_O2/redis-force[P]rpm/module/rpm.c
// Function: rpm_worker_log_read
static void rpm_worker_log_read(RedisModuleCtx *ctx, int fd, void *client_data, int mask, const char *level) {
  int rd;
  worker_pipe *pipe = client_data;
  worker_process *worker = pipe->worker;
  char *buf = worker->buf, *start, *end, *linefeed = NULL;
  REDISMODULE_NOT_USED(mask);
  while ((rd = read(fd, buf, sizeof(worker->buf))) > 0) {
    linefeed = start = buf;
    end = buf + rd;
scan_for_lf:
    if (start < end && (linefeed = memchr(start, '\n', end - start)) != NULL) {
      rpm_worker_log_flush(ctx, pipe, start, linefeed - start, level);
      start = linefeed + 1;
      goto scan_for_lf;
    }
    /* check if there are more data without linefeed left in read buffer */
    if (linefeed == NULL && start < end) {
      rpm_worker_pipe_buffer_data(pipe, start, end - start);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rcx, 0x48(%rsp)
movl %esi, 0x14(%rsp)
movl $0xa8, %eax
addq (%rdx), %rax
movq %rax, 0x28(%rsp)
movq %rdi, 0x40(%rsp)
leaq 0x20(%rdx), %r13
leaq 0x8(%rdx), %rax
movq %rax, 0x8(%rsp)
leaq 0x10(%rdx), %rax
movq %rax, 0x18(%rsp)
addq $0x18, %rdx
movq %rdx, 0x20(%rsp)
movq %r13, 0x30(%rsp)
movl $0x100000, %edx         # imm = 0x100000
movl 0x14(%rsp), %edi
movq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0x5180
movq %rax, %rbp
testl %ebp, %ebp
jle 0x7682
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
addq %rbx, %rbp
movq %rbp, 0x38(%rsp)
cmpq %rbp, %rbx
jae 0x74c2
movq %rbp, %r12
subq %rbx, %r12
movq %rbx, %rdi
pushq $0xa
popq %rsi
movq %r12, %rdx
callq 0x5170
testq %rax, %rax
je 0x763c
movq %rax, %r15
movslq (%r13), %r12
testq %r12, %r12
jle 0x75a7
xorl %ebp, %ebp
movq 0x8(%rsp), %r14
movl $0x3e8, %eax            # imm = 0x3E8
subq %rbp, %rax
movq (%r14), %r14
testq %r14, %r14
je 0x756f
movslq 0xc(%r14), %rcx
leaq (%rcx,%rbp), %rdx
movq %rax, %r13
cmpq $0x3e8, %rdx            # imm = 0x3E8
jae 0x7551
movq %rcx, %r13
testq %r13, %r13
je 0x7532
leaq 0x20(%r14), %rsi
leaq (%rsp,%rbp), %rdi
addq $0x50, %rdi
movq %r13, %rdx
callq 0x5220
addq %r13, %rbp
jmp 0x752a
movq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x50e0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
movq 0x30(%rsp), %r13
andl $0x0, (%r13)
movslq %ebp, %r14
movq 0x38(%rsp), %rbp
jmp 0x75aa
xorl %r14d, %r14d
movq %r15, %rax
subq %rbx, %rax
leaq (%r14,%rax), %rcx
movl $0x3e8, %r12d           # imm = 0x3E8
subq %r14, %r12
movl $0x3e8, %edx            # imm = 0x3E8
cmpq %rdx, %rcx
cmovbq %rax, %r12
testq %r12, %r12
je 0x75e4
leaq (%rsp,%r14), %rdi
addq $0x50, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x5220
addq %r12, %r14
cmpl $0x3e8, %r14d           # imm = 0x3E8
jne 0x7607
leaq 0x438(%rsp), %rax
movw $0x2e2e, 0x4(%rax)      # imm = 0x2E2E
movl $0x2e2e2e2e, (%rax)     # imm = 0x2E2E2E2E
movl $0x3ee, %r14d           # imm = 0x3EE
movslq %r14d, %rax
movb $0x0, 0x50(%rsp,%rax)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
leaq 0x3aca(%rip), %rdx      # 0xb0ea
leaq 0x50(%rsp), %rcx
xorl %eax, %eax
movq 0x683a(%rip), %r8       # 0xde68
callq *(%r8)
incq %r15
movq %r15, %rbx
jmp 0x74f1
movslq %r12d, %r14
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r13, %rcx
movq %r14, %r8
movl $0x400, %r9d            # imm = 0x400
callq 0x5370
movq %rax, %r15
movslq 0xc(%rax), %rax
leaq (%r15,%rax), %rdi
addq $0x20, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5220
addl %r14d, 0xc(%r15)
jmp 0x74c2
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq