// File: /workspace/github_c_makefile_star2_O0/redis-force[P]rpm/module/rpm.c
// Function: rpm_worker_process_start
static void rpm_worker_process_start(worker_process *worker, char **argv) {
  long idx, cidx, closefd, max = sysconf(_SC_OPEN_MAX);
  char buff[32], envbuff[32 + sizeof(ENV_RPM_DOWNSTREAM_FD_PREFIX) + sizeof(ENV_RPM_UPSTREAM_FD_PREFIX)];
  rpm_worker_process_daemonize();
  for (idx = 1; idx < max; ++idx) {
    if (idx == worker->out.pipe[1] || idx == worker->err.pipe[1]) {
      continue;
    }
    closefd = 1;
    if (closefd != 0) {
      for (cidx = 0; cidx < worker->num_upstreams; ++cidx) {
        if (idx == worker->upstreams[cidx].pipe[1]) {
          closefd = 0;
          break;
        }
      }
    }
    if (closefd != 0) {
      for (cidx = 0; cidx < worker->num_downstreams; ++cidx) {
        if (idx == worker->downstreams[cidx]) {
          closefd = 0;
          break;
        }
      }
    }
    if (closefd != 0) {
      close(idx);
    }
  }
  rpm_worker_redirect_fd(worker->out.pipe[1], STDOUT_FILENO);
  rpm_worker_redirect_fd(worker->err.pipe[1], STDERR_FILENO);
  snprintf(buff, sizeof(buff), "%d", worker->num_upstreams);
  setenv(ENV_RPM_UPSTREAM_FD_NUM, buff, 1);
  for (cidx = 0; cidx < worker->num_upstreams; ++cidx) {
    snprintf(envbuff, sizeof(envbuff), "%s[%ld]", ENV_RPM_UPSTREAM_FD_PREFIX, cidx);
    snprintf(buff, sizeof(buff), "%d", worker->upstreams[cidx].pipe[1]);
    setenv(envbuff, buff, 1);
  }
  snprintf(buff, sizeof(buff), "%d", worker->num_downstreams);
  setenv(ENV_RPM_DOWNSTREAM_FD_NUM, buff, 1);
  for (cidx = 0; cidx < worker->num_downstreams; ++cidx) {
    snprintf(envbuff, sizeof(envbuff), "%s[%ld]", ENV_RPM_DOWNSTREAM_FD_PREFIX, cidx);
    snprintf(buff, sizeof(buff), "%d", worker->downstreams[cidx]);
    setenv(envbuff, buff, 1);
  }
  fprintf(stdout, "worker process %lld is spawned and prepare to serve requests\n", (long long) getpid());
  fflush(stdout);
  execvp(argv[0], argv);
  exit(1);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movl $0x4, %edi
callq 0x5330
movq %rax, 0x88(%rsp)
callq 0x8af0
movq $0x1, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq 0x88(%rsp), %rax
jge 0x7dff
movq 0xa0(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x28(%rcx), %rcx
cmpq %rcx, %rax
je 0x7cb2
movq 0xa0(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x60(%rcx), %rcx
cmpq %rcx, %rax
jne 0x7cb7
jmp 0x7de6
movq $0x1, 0x90(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x7d4a
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x88(%rcx), %rcx
cmpq %rcx, %rax
jge 0x7d48
movq 0xa0(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq 0x90(%rcx), %rcx
imulq $0x38, 0x98(%rsp), %rdx
addq %rdx, %rcx
movslq 0x28(%rcx), %rcx
cmpq %rcx, %rax
jne 0x7d30
movq $0x0, 0x90(%rsp)
jmp 0x7d48
jmp 0x7d32
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0x7cda
jmp 0x7d4a
cmpq $0x0, 0x90(%rsp)
je 0x7dca
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x78(%rcx), %rcx
cmpq %rcx, %rax
jge 0x7dc8
movq 0xa0(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq 0x80(%rcx), %rcx
movq 0x98(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jne 0x7db0
movq $0x0, 0x90(%rsp)
jmp 0x7dc8
jmp 0x7db2
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0x7d61
jmp 0x7dca
cmpq $0x0, 0x90(%rsp)
je 0x7de4
movq 0xa0(%rsp), %rax
movl %eax, %edi
callq 0x5140
jmp 0x7de6
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
jmp 0x7c6a
movq 0xb0(%rsp), %rax
movl 0x28(%rax), %edi
movl $0x1, %esi
callq 0x8ac0
movq 0xb0(%rsp), %rax
movl 0x60(%rax), %edi
movl $0x2, %esi
callq 0x8ac0
leaq 0x60(%rsp), %rdi
movq 0xb0(%rsp), %rax
movl 0x88(%rax), %ecx
movl $0x20, %esi
leaq 0x6832(%rip), %rdx      # 0xe67a
movb $0x0, %al
callq 0x50f0
leaq 0x60(%rsp), %rsi
leaq 0x62f4(%rip), %rdi      # 0xe14f
movl $0x1, %edx
callq 0x5080
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x88(%rcx), %rcx
cmpq %rcx, %rax
jge 0x7f1b
leaq 0x10(%rsp), %rdi
movq 0x98(%rsp), %r8
movl $0x42, %esi
leaq 0x62b9(%rip), %rdx      # 0xe163
leaq 0x62ba(%rip), %rcx      # 0xe16b
movb $0x0, %al
callq 0x50f0
leaq 0x60(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq 0x90(%rax), %rax
imulq $0x38, 0x98(%rsp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
movl $0x20, %esi
leaq 0x6793(%rip), %rdx      # 0xe67a
movb $0x0, %al
callq 0x50f0
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x1, %edx
callq 0x5080
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0x7e71
leaq 0x60(%rsp), %rdi
movq 0xb0(%rsp), %rax
movl 0x78(%rax), %ecx
movl $0x20, %esi
leaq 0x6743(%rip), %rdx      # 0xe67a
movb $0x0, %al
callq 0x50f0
leaq 0x60(%rsp), %rsi
leaq 0x6231(%rip), %rdi      # 0xe17b
movl $0x1, %edx
callq 0x5080
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0xb0(%rsp), %rcx
movslq 0x78(%rcx), %rcx
cmpq %rcx, %rax
jge 0x8003
leaq 0x10(%rsp), %rdi
movq 0x98(%rsp), %r8
movl $0x42, %esi
leaq 0x61cd(%rip), %rdx      # 0xe163
leaq 0x61f4(%rip), %rcx      # 0xe191
movb $0x0, %al
callq 0x50f0
leaq 0x60(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq 0x80(%rax), %rax
movq 0x98(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movl $0x20, %esi
leaq 0x66ab(%rip), %rdx      # 0xe67a
movb $0x0, %al
callq 0x50f0
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x1, %edx
callq 0x5080
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0x7f60
movq 0x8bde(%rip), %rax      # 0x10be8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x50a0
movq 0x8(%rsp), %rdi
movslq %eax, %rdx
leaq 0x617d(%rip), %rsi      # 0xe1a3
movb $0x0, %al
callq 0x51f0
movq 0x8bb4(%rip), %rax      # 0x10be8
movq (%rax), %rdi
callq 0x5290
movq 0xa8(%rsp), %rax
movq (%rax), %rdi
movq 0xa8(%rsp), %rsi
callq 0x5350
movl $0x1, %edi
callq 0x53a0
nop