// File: /workspace/github_cpp_makefile_star2_O2/jp-myk[P]WAVUtil/src/SimpleWAV/WAVUtil.cpp
// Function: SimpleWAV::cat_wav(WAV&)
int cat_wav(WAV& wav){
  //void* data;
  //int res=0;
  if(wav.getChannels() == 1){
    if(wav.getBit() == 8){
      Monoral8* data=(Monoral8*)wav.getData();
      for(unsigned long i=0;i<wav.getSampleCount();i++){
	printf("%d\n",(unsigned char)data[i]);
      }
    }else if(wav.getBit() == 16){
      Monoral16* data=(Monoral16*)wav.getData();
      for(unsigned long i=0;i<wav.getSampleCount();i++){
	printf("%d\n",(signed short)data[i]);
      }
    }else{
      printLOG("error bit must be 8 or 16");
      exit(-1);
    }
  }else if(wav.getChannels() == 2){
    if(wav.getBit() == 8){
      Stereo8* data=(Stereo8*)wav.getData();
      for(unsigned long i=0;i<wav.getSampleCount();i++){
	printf("%d\t%d\n",(unsigned char)data[i].l, (unsigned char)data[i].r);
      }
    }else if(wav.getBit() == 16){
      Stereo16* data=(Stereo16*)wav.getData();
      for(unsigned long i=0;i<wav.getSampleCount();i++){
	printf("%d\t%d\n",(signed short)data[i].l, (signed short)data[i].r);
      }
    }else{
      printLOG("error bit must be 8 or 16");
      exit(-1);
    }

  }else{
    printLOG("wav channel must set monoral");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movzwl 0x16(%rdi), %eax
cmpl $0x2, %eax
je 0x304a
cmpl $0x1, %eax
jne 0x309a
movzwl 0x22(%rbx), %eax
cmpl $0x10, %eax
je 0x30d3
cmpl $0x8, %eax
jne 0x3141
movq %rbx, %rdi
callq 0x24ec
movq %rax, %r15
xorl %r14d, %r14d
leaq 0x1297(%rip), %r12      # 0x42be
xorl %r13d, %r13d
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jae 0x30c6
movzbl (%r15,%r13), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2030
incq %r13
jmp 0x302a
movzwl 0x22(%rbx), %eax
cmpl $0x10, %eax
je 0x3107
cmpl $0x8, %eax
jne 0x3162
movq %rbx, %rdi
callq 0x24ec
movq %rax, %r15
xorl %r14d, %r14d
leaq 0x1246(%rip), %r12      # 0x42bb
xorl %r13d, %r13d
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jae 0x30c6
movzbl (%r15,%r13,2), %esi
movzbl 0x1(%r15,%r13,2), %edx
movq %r12, %rdi
xorl %eax, %eax
callq 0x2030
incq %r13
jmp 0x3078
leaq 0xf63(%rip), %rdi       # 0x4004
leaq 0x1147(%rip), %rsi      # 0x41ef
leaq 0x11ea(%rip), %rdx      # 0x4299
leaq 0x120c(%rip), %r8       # 0x42c2
movl $0x8b, %ecx
xorl %eax, %eax
callq 0x2030
pushq $-0x1
popq %r14
movl %r14d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x24ec
movq %rax, %r15
xorl %r14d, %r14d
leaq 0x11d6(%rip), %r12      # 0x42be
xorl %r13d, %r13d
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jae 0x30c6
movswl (%r15,%r13,2), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2030
incq %r13
jmp 0x30eb
movq %rbx, %rdi
callq 0x24ec
movq %rax, %r15
xorl %r14d, %r14d
leaq 0x119f(%rip), %r12      # 0x42bb
xorl %r13d, %r13d
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jae 0x30c6
movswl (%r15,%r13,4), %esi
movswl 0x2(%r15,%r13,4), %edx
movq %r12, %rdi
xorl %eax, %eax
callq 0x2030
incq %r13
jmp 0x311f
leaq 0xebc(%rip), %rdi       # 0x4004
leaq 0x10a0(%rip), %rsi      # 0x41ef
leaq 0x1143(%rip), %rdx      # 0x4299
leaq 0x1144(%rip), %r8       # 0x42a1
pushq $0x77
popq %rcx
jmp 0x3183
leaq 0xe9b(%rip), %rdi       # 0x4004
leaq 0x107f(%rip), %rsi      # 0x41ef
leaq 0x1122(%rip), %rdx      # 0x4299
leaq 0x1123(%rip), %r8       # 0x42a1
movl $0x86, %ecx
xorl %eax, %eax
callq 0x2030
pushq $-0x1
popq %rdi
callq 0x2140