// File: /workspace/github_cpp_makefile_star2_O2/st0ne[P]XReflectorPlus/dxrfd.cpp
// Function: playback(void*)
static void *playback(void *arg)
{
   struct rcd *temp_rcd = (struct rcd *)arg;
   struct sigaction act;
   unsigned short int j;
   unsigned short int i;
   struct timespec nanos;

   act.sa_handler = sigCatch;
   sigemptyset(&act.sa_mask);
   act.sa_flags = SA_RESTART;
   if (sigaction(SIGTERM, &act, 0) != 0)
   {
      traceit("sigaction-TERM failed, error=%d\n", errno);
      keep_running = false;
      pthread_exit(NULL);
   }
   if (sigaction(SIGINT, &act, 0) != 0)
   {
      traceit("sigaction-INT failed, error=%d\n", errno);
      keep_running = false;
      pthread_exit(NULL);
   }

   /* delay 5 seconds here */
   sleep(5);

   /***
   if (temp_rcd->recvlen == 56)
      traceit("playback started for user=%.8s, streamid %d,%d\n", 
            &(temp_rcd->data[0][42]), temp_rcd->data[0][12], temp_rcd->data[0][13]);
   else
      traceit("playback started for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][44]), temp_rcd->data[0][14], temp_rcd->data[0][15]);
   ***/

   /* first packet is header */

   /*** MUST CHANGE rpt1 and rpt2 if temp_rcd->recvlen is 58 ***/
   for (j = 0; j < 5; j++)
      sendto(ref_sock, (char *)temp_rcd->data[0], temp_rcd->recvlen, 0,
             (struct sockaddr *)&(temp_rcd->sin),
             sizeof(struct sockaddr_in));

   /*** header sent ***/
   i = 1;
   
   while ((keep_running) && (i < temp_rcd->idx))
   {
      time(&(temp_rcd->ts));
      sendto(ref_sock, (char *)temp_rcd->data[i], 
             (temp_rcd->recvlen == 56)?27:29,   /*** ? 32 ***/
             0,(struct sockaddr *)&(temp_rcd->sin),
             sizeof(struct sockaddr_in));
      i ++;
      nanos.tv_sec = 0;
      nanos.tv_nsec = 17000000;
      nanosleep(&nanos,0);
   }

   /***
   if (temp_rcd->recvlen == 56)
      traceit("Finished playback for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][42]), temp_rcd->data[0][12], temp_rcd->data[0][13]);
   else
      traceit("Finished playback for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][44]), temp_rcd->data[0][14], temp_rcd->data[0][15]);
   ***/

   temp_rcd->locked = false;

   pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq -0x5936(%rip), %rax     # 0x341a
leaq 0x18(%rsp), %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
callq 0x2300
movl $0x10000000, 0x80(%r14) # imm = 0x10000000
pushq $0xf
popq %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
testl %eax, %eax
jne 0x8dce
pushq $0x2
popq %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
testl %eax, %eax
jne 0x8dde
pushq $0x5
popq %rdi
callq 0x21b0
leaq 0x24(%rbx), %r15
leaq 0x10(%rbx), %r14
movw $0x5, %r12w
pushq $0x10
popq %rbp
subw $0x1, %r12w
jb 0x8dfc
movl 0x74a9(%rip), %edi      # 0x10260
movswq 0x20(%rbx), %rdx
movq %r15, %rsi
xorl %ecx, %ecx
movq %r14, %r8
movl %ebp, %r9d
callq 0x2060
jmp 0x8daa
callq 0x2050
movl (%rax), %esi
leaq 0x2304(%rip), %rdi      # 0xb0e0
jmp 0x8dec
callq 0x2050
movl (%rax), %esi
leaq 0x2315(%rip), %rdi      # 0xb101
xorl %eax, %eax
callq 0x274c
movb $0x1, 0xacf6(%rip)      # 0x13af0
jmp 0x8e71
leaq 0x8(%rbx), %r15
leaq 0x5e(%rbx), %r12
pushq $0x1
popq %rbp
movq %rsp, %r13
cmpb $0x0, 0xacdf(%rip)      # 0x13af0
jne 0x8e6e
movzwl 0x22(%rbx), %eax
cmpq %rax, %rbp
jae 0x8e6e
movq %r15, %rdi
callq 0x2200
movl 0x7436(%rip), %edi      # 0x10260
xorl %eax, %eax
cmpw $0x38, 0x20(%rbx)
setne %al
leaq 0x1b(,%rax,2), %rdx
movq %r12, %rsi
xorl %ecx, %ecx
movq %r14, %r8
pushq $0x10
popq %r9
callq 0x2060
incq %rbp
andq $0x0, (%rsp)
movq $0x1036640, 0x8(%rsp)   # imm = 0x1036640
movq %r13, %rdi
xorl %esi, %esi
callq 0x20d0
addq $0x3a, %r12
jmp 0x8e0a
movb $0x0, (%rbx)
xorl %edi, %edi
callq 0x2430