// File: /workspace/github_cpp_makefile_star2_O1/jp-myk[P]WAVUtil/src/wav_split.cpp
// Function: main
int main(int argc, char *argv[]){
  if(argc<4){
    std::cout << argv[0] << " WAVFILE PREFIX SPLIT_TIME_SPAN[sec]" << std::endl;
    exit(0);
  }
  const char* wavFName=argv[1];
  std::string prefix(argv[2]);
  float splitTime=5.0;
  splitTime=atof(argv[3]);
  WAV wav;
  std::vector<WAV> wavList;
  std::vector<WAV>::iterator it;
  int res=0;
  res=wav.Read(wavFName);
  std::cout << "split!" << std::endl;
  wavList=SimpleWAV::split_wav(splitTime, wav); // extra 0.0 - 1.00[sec]
  
  int i=0;
  char outfname[100];
  for(it=wavList.begin();it!=wavList.end();++it){
    sprintf(outfname, "%s.%d.wav", prefix.c_str(), i);
    it->Write(outfname);
    i++;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
cmpl $0x3, %edi
jle 0x3c97
movq 0x8(%r14), %rbx
movq 0x10(%r14), %rsi
leaq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x3cfe
movq 0x18(%r14), %rdi
callq 0x21e0
movsd %xmm0, 0x18(%rsp)
xorl %eax, %eax
leaq 0x58(%rsp), %rdi
movl %eax, 0x4(%rdi)
movabsq $0x2000100000010, %rcx  # imm = 0x2000100000010
movq %rcx, 0x10(%rdi)
movabsq $0x7d000000ac44, %rcx   # imm = 0x7D000000AC44
movq %rcx, 0x18(%rdi)
movl $0x100002, 0x20(%rdi)   # imm = 0x100002
movl %eax, 0x28(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movq %rax, 0x50(%rdi)
movq %rax, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %rbx, %rsi
callq 0x2ae0
movq 0x2463(%rip), %rbx      # 0x5fd0
leaq 0x7ba(%rip), %rsi       # 0x432e
movl $0x6, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x2431(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
xorps %xmm0, %xmm0
cvtsd2ss 0x18(%rsp), %xmm0
leaq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3247
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps (%rsp), %xmm0
movq 0x10(%rsp), %rax
leaq 0x40(%rsp), %rbx
movups (%rbx), %xmm1
movaps %xmm1, (%rsp)
movq 0x10(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movups %xmm1, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x37c0
movq %rbx, %rdi
callq 0x37c0
movq (%rsp), %rbx
cmpq 0x8(%rsp), %rbx
je 0x3c5a
leaq 0x711(%rip), %r14       # 0x4335
leaq 0xb0(%rsp), %r15
xorl %ebp, %ebp
movq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2060
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2838
incl %ebp
addq $0x58, %rbx
cmpq 0x8(%rsp), %rbx
jne 0x3c2e
movq %rsp, %rdi
callq 0x37c0
leaq 0x58(%rsp), %rdi
callq 0x278e
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c87
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21a0
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rsi
movq 0x232f(%rip), %rdi      # 0x5fd0
callq 0x2180
leaq 0x65c(%rip), %rsi       # 0x4309
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20e0
xorl %edi, %edi
callq 0x21d0
jmp 0x3cf6
jmp 0x3cca
jmp 0x3cca
movq %rax, %rbx
movq %rsp, %rdi
callq 0x37c0
leaq 0x58(%rsp), %rdi
callq 0x278e
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x237a
movq %rbx, %rdi
callq 0x22a0
movq %rax, %rdi
callq 0x37ef