// File: /workspace/github_cpp_makefile_star2_O1/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 0x3520
cmpl $0x1, %eax
jne 0x357d
movzwl 0x22(%rbx), %eax
cmpl $0x10, %eax
je 0x35ad
cmpl $0x8, %eax
jne 0x3637
movq %rbx, %rdi
callq 0x2634
cmpl $0x0, 0x30(%rbx)
je 0x3627
movq %rax, %r15
xorl %r14d, %r14d
leaq 0xdc0(%rip), %r12       # 0x42be
xorl %r13d, %r13d
movzbl (%r15,%r13), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
incq %r13
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jb 0x3501
jmp 0x362a
movzwl 0x22(%rbx), %eax
cmpl $0x10, %eax
je 0x35e7
cmpl $0x8, %eax
jne 0x365a
movq %rbx, %rdi
callq 0x2634
cmpl $0x0, 0x30(%rbx)
je 0x3627
movq %rax, %r15
xorl %r14d, %r14d
leaq 0xd66(%rip), %r12       # 0x42bb
xorl %r13d, %r13d
movzbl (%r15,%r13,2), %esi
movzbl 0x1(%r15,%r13,2), %edx
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
incq %r13
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jb 0x3558
jmp 0x362a
leaq 0xa80(%rip), %rdi       # 0x4004
leaq 0xc64(%rip), %rsi       # 0x41ef
leaq 0xd07(%rip), %rdx       # 0x4299
leaq 0xd29(%rip), %r8        # 0x42c2
movl $0x8b, %ecx
xorl %eax, %eax
callq 0x2040
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x362a
movq %rbx, %rdi
callq 0x2634
cmpl $0x0, 0x30(%rbx)
je 0x3627
movq %rax, %r15
xorl %r14d, %r14d
leaq 0xcf6(%rip), %r12       # 0x42be
xorl %r13d, %r13d
movswl (%r15,%r13,2), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
incq %r13
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jb 0x35cb
jmp 0x362a
movq %rbx, %rdi
callq 0x2634
cmpl $0x0, 0x30(%rbx)
je 0x3627
movq %rax, %r15
xorl %r14d, %r14d
leaq 0xcb9(%rip), %r12       # 0x42bb
xorl %r13d, %r13d
movswl (%r15,%r13,4), %esi
movswl 0x2(%r15,%r13,4), %edx
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
incq %r13
movl 0x30(%rbx), %eax
cmpq %rax, %r13
jb 0x3605
jmp 0x362a
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x9c6(%rip), %rdi       # 0x4004
leaq 0xbaa(%rip), %rsi       # 0x41ef
leaq 0xc4d(%rip), %rdx       # 0x4299
leaq 0xc4e(%rip), %r8        # 0x42a1
movl $0x77, %ecx
jmp 0x367b
leaq 0x9a3(%rip), %rdi       # 0x4004
leaq 0xb87(%rip), %rsi       # 0x41ef
leaq 0xc2a(%rip), %rdx       # 0x4299
leaq 0xc2b(%rip), %r8        # 0x42a1
movl $0x86, %ecx
xorl %eax, %eax
callq 0x2040
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21b0