// File: /workspace/github_c_makefile_star2_O0/redis-force[P]rpm/module/rpm.c
// Function: rpm_worker_upstream_read
static void rpm_worker_upstream_read(RedisModuleCtx *ctx, int fd, void *client_data, int mask) {
  int rd;
  rpm_context *rpm;
  redis_response_status st = REDIS_RESPONSE_OK;
  worker_pipe *pipe = client_data;
  worker_process *worker = pipe->worker;
  redis_response_reader *reader = pipe->user_data;
  char *buf = worker->buf;
  redis_response *reply = NULL;
  REDISMODULE_NOT_USED(mask);
  while ((rd = read(fd, buf, sizeof(worker->buf))) > 0) {
    redis_response_reader_feed(reader, buf, rd);
    while (st == REDIS_RESPONSE_OK && (st = redis_response_reader_next(reader, &reply)) == REDIS_RESPONSE_OK && reply != NULL) {
      st = rpm_worker_upstream_on_reply(ctx, reply);
    }
    if (st != REDIS_RESPONSE_OK) {
      /* protocol error, kill worker and restart to fix the channel */
      RedisModule_Log(ctx, "warning", "worker process respond invalid response and will be restarted to fix the state. %s",
          redis_response_reader_strerr(reader));
      rpm_worker_suicide(ctx, worker);
    }
  }
  if (rd == 0) {
    /* upstream eof, worker process must be died, restart it automatically */
    RedisModule_DeleteFileEvent(ctx, fd, REDISMODULE_READ);
    RedisModule_Log(ctx, "warning", "Upstream connection with fd %d was closed", fd);
    rpm = rpm_context_get(ctx);
    if (--worker->active_upstreams <= 0) {
      RedisModule_Log(ctx, "warning", "All upstream connections were closed, restart worker process now");
      rpm_worker_destroy(ctx, rpm, worker);
    }
  }
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movl %esi, 0x6c(%rsp)
movq %rdx, 0x60(%rsp)
movl %ecx, 0x5c(%rsp)
movl $0x0, 0x4c(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
addq $0xa8, %rax
movq %rax, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x6c(%rsp), %edi
movq 0x28(%rsp), %rsi
movl $0x100000, %edx         # imm = 0x100000
callq 0x5180
movl %eax, 0x58(%rsp)
cmpl $0x0, %eax
jle 0x7af6
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x58(%rsp), %edx
callq 0x5410
xorl %eax, %eax
cmpl $0x0, 0x4c(%rsp)
movb %al, 0x1f(%rsp)
jne 0x7a79
movq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5130
movl %eax, %ecx
movl %ecx, 0x4c(%rsp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x1f(%rsp)
jne 0x7a79
cmpq $0x0, 0x20(%rsp)
setne %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x7a83
jmp 0x7a98
movq 0x70(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x83a0
movl %eax, 0x4c(%rsp)
jmp 0x7a3f
cmpl $0x0, 0x4c(%rsp)
je 0x7af1
movq 0x93ca(%rip), %rax      # 0x10e70
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
callq 0x5310
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r8
movq %rax, %rcx
leaq 0x62ee(%rip), %rsi      # 0xddc4
leaq 0x65ad(%rip), %rdx      # 0xe08a
movb $0x0, %al
callq *%r8
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x8470
jmp 0x7a0c
cmpl $0x0, 0x58(%rsp)
jne 0x7ba0
movq 0x9110(%rip), %rax      # 0x10c18
movq (%rax), %rax
movq 0x70(%rsp), %rdi
movl 0x6c(%rsp), %esi
movl $0x1, %edx
callq *%rax
movq 0x934e(%rip), %rax      # 0x10e70
movq (%rax), %r8
movq 0x70(%rsp), %rdi
movl 0x6c(%rsp), %ecx
leaq 0x628f(%rip), %rsi      # 0xddc4
leaq 0x65a1(%rip), %rdx      # 0xe0dd
movb $0x0, %al
callq *%r8
movq 0x70(%rsp), %rdi
callq 0x7240
movq %rax, 0x50(%rsp)
movq 0x38(%rsp), %rcx
movl 0x8c(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x8c(%rcx)
cmpl $0x0, %eax
jg 0x7b9e
movq 0x9300(%rip), %rax      # 0x10e70
movq (%rax), %rcx
movq 0x70(%rsp), %rdi
leaq 0x6245(%rip), %rsi      # 0xddc4
leaq 0x6581(%rip), %rdx      # 0xe107
movb $0x0, %al
callq *%rcx
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x8060
jmp 0x7ba0
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)