// File: tobias93[P]piano/rtaudio/tests/teststops.cpp
// Function: main
int main( int argc, char *argv[] )
{
  unsigned int bufferFrames, fs, oDevice = 0, iDevice = 0, iOffset = 0, oOffset = 0;
  unsigned int runtime, pausetime;
  char input;

  // minimal command-line checking
  if (argc < 3 || argc > 7 ) usage();

  RtAudio *adc = new RtAudio();
  if ( adc->getDeviceCount() < 1 ) {
    std::cout << "\nNo audio devices found!\n";
    exit( 1 );
  }

  MyData mydata;
  mydata.channels = (unsigned int) atoi( argv[1] );
  fs = (unsigned int) atoi( argv[2] );
  if ( argc > 3 )
    iDevice = (unsigned int) atoi( argv[3] );
  if ( argc > 4 )
    oDevice = (unsigned int) atoi(argv[4]);
  if ( argc > 5 )
    iOffset = (unsigned int) atoi(argv[5]);
  if ( argc > 6 )
    oOffset = (unsigned int) atoi(argv[6]);

  // Let RtAudio print messages to stderr.
  adc->showWarnings( true );

  runtime = static_cast<unsigned int>(RUNTIME * 1000);
  pausetime = static_cast<unsigned int>(PAUSETIME * 1000);

  // Set our stream parameters for a duplex stream.
  bufferFrames = 512;
  RtAudio::StreamParameters oParams, iParams;
  oParams.deviceId = oDevice;
  oParams.nChannels = mydata.channels;
  oParams.firstChannel = oOffset;

  iParams.deviceId = iDevice;
  iParams.nChannels = mydata.channels;
  iParams.firstChannel = iOffset;

  if ( iDevice == 0 )
    iParams.deviceId = adc->getDefaultInputDevice();
  if ( oDevice == 0 )
    oParams.deviceId = adc->getDefaultOutputDevice();

  // First, test external stopStream() calls.
  mydata.pulseCount = static_cast<unsigned int>(PULSE_RATE * fs);
  mydata.nFrames = 50 * fs;
  mydata.returnValue = 0;
  try {
    adc->openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &pulse, (void *)&mydata );

    std::cout << "Press <enter> to start test.\n";
    std::cin.get( input );

    for (int i=0; i<REPETITIONS; i++ ) {
      mydata.frameCounter = 0;
      adc->startStream();
      std::cout << "Stream started ... ";
      SLEEP( runtime );
      adc->stopStream();
      std::cout << "stream externally stopped.\n";
      SLEEP( pausetime );
    }
  }
  catch ( RtAudioError& e ) {
    e.printMessage();
    goto cleanup;
  }

  adc->closeStream();

  // Next, test internal stopStream() calls.
  mydata.nFrames = (unsigned int) (RUNTIME * fs);
  mydata.returnValue = 1;
  try {
    adc->openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &pulse, (void *)&mydata );

    std::cin.clear();
    fflush(stdin);
    std::cout << "\nPress <enter> to continue test.\n";
    std::cin.get( input );

    for (int i=0; i<REPETITIONS; i++ ) {
      mydata.frameCounter = 0;
      adc->startStream();
      std::cout << "Stream started ... ";
      while ( adc->isStreamRunning() ) SLEEP( 5 );
      std::cout << "stream stopped via callback return value = 1.\n";
      SLEEP( pausetime );
    }
  }
  catch ( RtAudioError& e ) {
    e.printMessage();
    goto cleanup;
  }

  adc->closeStream();

  // Test internal abortStream() calls.
  mydata.returnValue = 2;
  try {
    adc->openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &pulse, (void *)&mydata );
    std::cin.clear();
    fflush(stdin);
    std::cout << "\nPress <enter> to continue test.\n";
    std::cin.get( input );

    for (int i=0; i<REPETITIONS; i++ ) {
      mydata.frameCounter = 0;
      adc->startStream();
      std::cout << "Stream started ... ";
      while ( adc->isStreamRunning() ) SLEEP( 5 );
      std::cout << "stream aborted via callback return value = 2.\n";
      SLEEP( pausetime );
    }
  }
  catch ( RtAudioError& e ) {
    e.printMessage();
    goto cleanup;
  }

  adc->closeStream();

  // Test consecutive stream re-opening.
  mydata.returnValue = 0;
  mydata.nFrames = 50 * fs;
  try {

    std::cin.clear();
    fflush(stdin);
    std::cout << "\nPress <enter> to continue test.\n";
    std::cin.get( input );

    for (int i=0; i<REPETITIONS; i++ ) {
      adc->openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &pulse, (void *)&mydata );
      mydata.frameCounter = 0;
      adc->startStream();
      std::cout << "New stream started ... ";
      SLEEP( runtime );
      adc->stopStream();
      adc->closeStream();
      std::cout << "stream stopped externally and closed.\n";
      SLEEP( pausetime );
    }
  }
  catch ( RtAudioError& e ) {
    e.printMessage();
    goto cleanup;
  }

  delete adc;
  adc = 0;

  // Test consecutive RtAudio creating and deletion.
  try {

    std::cin.clear();
    fflush(stdin);
    std::cout << "\nPress <enter> to continue test.\n";
    std::cin.get( input );

    for (int i=0; i<REPETITIONS; i++ ) {
      adc = new RtAudio();      
      adc->openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &pulse, (void *)&mydata );
      mydata.frameCounter = 0;
      adc->startStream();
      std::cout << "New instance and stream started ... ";
      SLEEP( runtime );
      adc->stopStream();
      adc->closeStream();
      delete adc;
      adc = 0;
      std::cout << "stream stopped and instance deleted.\n";
      SLEEP( pausetime );
    }
  }
  catch ( RtAudioError& e ) {
    e.printMessage();
    goto cleanup;
  }

 cleanup:
  if ( adc && adc->isStreamOpen() ) adc->closeStream();
  if ( adc ) delete adc;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x3, -0x8(%rbp)
jl 0x8841
cmpl $0x7, -0x8(%rbp)
jle 0x8846
callq 0x8660
movl $0x8, %edi
callq 0x8220
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
xorl %esi, %esi
callq 0x9830
jmp 0x8866
movq -0xd0(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9450
cmpl $0x1, %eax
jae 0x88be
movq 0xf742(%rip), %rdi      # 0x17fc8
leaq 0xa94e(%rip), %rsi      # 0x131db
callq 0x8210
movl $0x1, %edi
callq 0x82f0
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x8, %esi
callq 0x8230
jmp 0x9439
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x83d0
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x83d0
movl %eax, -0x18(%rbp)
cmpl $0x3, -0x8(%rbp)
jle 0x88f4
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x83d0
movl %eax, -0x20(%rbp)
cmpl $0x4, -0x8(%rbp)
jle 0x890a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x83d0
movl %eax, -0x1c(%rbp)
cmpl $0x5, -0x8(%rbp)
jle 0x8920
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x83d0
movl %eax, -0x24(%rbp)
cmpl $0x6, -0x8(%rbp)
jle 0x8936
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x83d0
movl %eax, -0x28(%rbp)
movq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0x9490
movl $0x190, -0x2c(%rbp)     # imm = 0x190
movl $0x64, -0x30(%rbp)
movl $0x200, -0x14(%rbp)     # imm = 0x200
leaq -0x6c(%rbp), %rdi
callq 0x94d0
leaq -0x78(%rbp), %rdi
callq 0x94d0
movl -0x1c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x89a1
movq -0x40(%rbp), %rdi
callq 0x9500
movl %eax, -0x78(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x89b3
movq -0x40(%rbp), %rdi
callq 0x9540
movl %eax, -0x6c(%rbp)
movl -0x18(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa645(%rip), %xmm1     # 0x13008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x5c(%rbp)
movl -0x18(%rbp), %eax
imull $0x32, %eax, %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %r8d
movq %rsp, %rax
leaq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x309(%rip), %rcx      # 0x86f0
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
leaq -0x6c(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x8, %ecx
leaq -0x14(%rbp), %r9
callq 0x9a40
jmp 0x8a24
movq 0xf59d(%rip), %rdi      # 0x17fc8
leaq 0xa7c3(%rip), %rsi      # 0x131f5
callq 0x8210
jmp 0x8a39
movq 0xf598(%rip), %rdi      # 0x17fd8
leaq -0x31(%rbp), %rsi
callq 0x8340
jmp 0x8a4b
movl $0x0, -0x7c(%rbp)
cmpl $0xa, -0x7c(%rbp)
jge 0x8b89
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9580
jmp 0x8a6e
movq 0xf553(%rip), %rdi      # 0x17fc8
leaq 0xa797(%rip), %rsi      # 0x13213
callq 0x8210
jmp 0x8a83
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa585(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0xa570(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x8ac6
movq -0x40(%rbp), %rdi
callq 0x95a0
jmp 0x8ad1
movq 0xf4f0(%rip), %rdi      # 0x17fc8
leaq 0xa748(%rip), %rsi      # 0x13227
callq 0x8210
jmp 0x8ae6
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa522(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0xa50d(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x8b29
jmp 0x8b2b
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x8a52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x9439
movq -0x48(%rbp), %rdi
callq 0x80b0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x5, -0x8c(%rbp)
callq 0x8420
jmp 0x93d8
jmp 0x8b8b
movq -0x40(%rbp), %rdi
callq 0x95c0
movl -0x18(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa46c(%rip), %xmm1     # 0x13010
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movl $0x1, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %r8d
movq %rsp, %rax
leaq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x4e1(%rip), %rcx      # 0x86f0
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
leaq -0x6c(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x8, %ecx
leaq -0x14(%rbp), %r9
callq 0x9a40
jmp 0x8bfc
movq 0xf3d5(%rip), %rdi      # 0x17fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x8440
jmp 0x8c16
movq 0xf39b(%rip), %rax      # 0x17fb8
movq (%rax), %rdi
callq 0x82c0
jmp 0x8c27
movq 0xf39a(%rip), %rdi      # 0x17fc8
leaq 0xa60e(%rip), %rsi      # 0x13243
callq 0x8210
jmp 0x8c3c
movq 0xf395(%rip), %rdi      # 0x17fd8
leaq -0x31(%rbp), %rsi
callq 0x8340
jmp 0x8c4e
movl $0x0, -0x90(%rbp)
cmpl $0xa, -0x90(%rbp)
jge 0x8d69
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9580
jmp 0x8c77
movq 0xf34a(%rip), %rdi      # 0x17fc8
leaq 0xa58e(%rip), %rsi      # 0x13213
callq 0x8210
jmp 0x8c8c
jmp 0x8c8e
movq -0x40(%rbp), %rdi
callq 0x95f0
testb $0x1, %al
jne 0x8c9d
jmp 0x8cfb
movl $0x1388, %edi           # imm = 0x1388
callq 0x8360
jmp 0x8ca9
jmp 0x8c8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x9439
movq -0x48(%rbp), %rdi
callq 0x80b0
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x5, -0x8c(%rbp)
callq 0x8420
jmp 0x93d8
movq 0xf2c6(%rip), %rdi      # 0x17fc8
leaq 0xa55c(%rip), %rsi      # 0x13265
callq 0x8210
jmp 0x8d10
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa2f8(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0xa2e3(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x8d53
jmp 0x8d55
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x8c58
jmp 0x8d6b
movq -0x40(%rbp), %rdi
callq 0x95c0
movl $0x2, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %r8d
movq %rsp, %rax
leaq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x6a5(%rip), %rcx      # 0x86f0
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
leaq -0x6c(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x8, %ecx
leaq -0x14(%rbp), %r9
callq 0x9a40
jmp 0x8dc0
movq 0xf211(%rip), %rdi      # 0x17fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x8440
jmp 0x8dda
movq 0xf1d7(%rip), %rax      # 0x17fb8
movq (%rax), %rdi
callq 0x82c0
jmp 0x8deb
movq 0xf1d6(%rip), %rdi      # 0x17fc8
leaq 0xa44a(%rip), %rsi      # 0x13243
callq 0x8210
jmp 0x8e00
movq 0xf1d1(%rip), %rdi      # 0x17fd8
leaq -0x31(%rbp), %rsi
callq 0x8340
jmp 0x8e12
movl $0x0, -0x9c(%rbp)
cmpl $0xa, -0x9c(%rbp)
jge 0x8f2d
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9580
jmp 0x8e3b
movq 0xf186(%rip), %rdi      # 0x17fc8
leaq 0xa3ca(%rip), %rsi      # 0x13213
callq 0x8210
jmp 0x8e50
jmp 0x8e52
movq -0x40(%rbp), %rdi
callq 0x95f0
testb $0x1, %al
jne 0x8e61
jmp 0x8ebf
movl $0x1388, %edi           # imm = 0x1388
callq 0x8360
jmp 0x8e6d
jmp 0x8e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x9439
movq -0x48(%rbp), %rdi
callq 0x80b0
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x5, -0x8c(%rbp)
callq 0x8420
jmp 0x93d8
movq 0xf102(%rip), %rdi      # 0x17fc8
leaq 0xa3c7(%rip), %rsi      # 0x13294
callq 0x8210
jmp 0x8ed4
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0xa134(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0xa11f(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x8f17
jmp 0x8f19
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x8e1c
jmp 0x8f2f
movq -0x40(%rbp), %rdi
callq 0x95c0
movl $0x0, -0x50(%rbp)
movl -0x18(%rbp), %eax
imull $0x32, %eax, %eax
movl %eax, -0x54(%rbp)
movq 0xf089(%rip), %rdi      # 0x17fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x8440
jmp 0x8f62
movq 0xf04f(%rip), %rax      # 0x17fb8
movq (%rax), %rdi
callq 0x82c0
jmp 0x8f73
movq 0xf04e(%rip), %rdi      # 0x17fc8
leaq 0xa2c2(%rip), %rsi      # 0x13243
callq 0x8210
jmp 0x8f88
movq 0xf049(%rip), %rdi      # 0x17fd8
leaq -0x31(%rbp), %rsi
callq 0x8340
jmp 0x8f9a
movl $0x0, -0xac(%rbp)
cmpl $0xa, -0xac(%rbp)
jge 0x9132
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %r8d
movq %rsp, %rax
leaq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x8db(%rip), %rcx      # 0x86f0
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
leaq -0x6c(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x8, %ecx
leaq -0x14(%rbp), %r9
callq 0x9a40
jmp 0x8ff6
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9580
jmp 0x9008
movq 0xefb9(%rip), %rdi      # 0x17fc8
leaq 0xa2ad(%rip), %rsi      # 0x132c3
callq 0x8210
jmp 0x901d
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x9feb(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0x9fd6(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x9060
movq -0x40(%rbp), %rdi
callq 0x95a0
jmp 0x906b
movq -0x40(%rbp), %rdi
callq 0x95c0
movq 0xef4d(%rip), %rdi      # 0x17fc8
leaq 0xa259(%rip), %rsi      # 0x132db
callq 0x8210
jmp 0x9089
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x9f7f(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0x9f6a(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x90cc
jmp 0x90ce
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x8fa4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x9439
movq -0x48(%rbp), %rdi
callq 0x80b0
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x5, -0x8c(%rbp)
callq 0x8420
jmp 0x93d8
jmp 0x9134
movq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, %rax
je 0x9162
movq -0xd8(%rbp), %rdi
callq 0x9a00
movq -0xd8(%rbp), %rdi
movl $0x8, %esi
callq 0x8230
movq $0x0, -0x40(%rbp)
movq 0xee67(%rip), %rdi      # 0x17fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x8440
jmp 0x9184
movq 0xee2d(%rip), %rax      # 0x17fb8
movq (%rax), %rdi
callq 0x82c0
jmp 0x9195
movq 0xee2c(%rip), %rdi      # 0x17fc8
leaq 0xa0a0(%rip), %rsi      # 0x13243
callq 0x8210
jmp 0x91aa
movq 0xee27(%rip), %rdi      # 0x17fd8
leaq -0x31(%rbp), %rsi
callq 0x8340
jmp 0x91bc
movl $0x0, -0xbc(%rbp)
cmpl $0xa, -0xbc(%rbp)
jge 0x93d4
movl $0x8, %edi
callq 0x8220
movq %rax, -0xe0(%rbp)
jmp 0x91e6
movq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x9830
jmp 0x91f6
movq -0xe0(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %r8d
movq %rsp, %rax
leaq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xb2b(%rip), %rcx      # 0x86f0
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
leaq -0x6c(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x8, %ecx
leaq -0x14(%rbp), %r9
callq 0x9a40
jmp 0x9246
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9580
jmp 0x9258
movq 0xed69(%rip), %rdi      # 0x17fc8
leaq 0xa09c(%rip), %rsi      # 0x13302
callq 0x8210
jmp 0x926d
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x9d9b(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0x9d86(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x92b0
movq -0x40(%rbp), %rdi
callq 0x95a0
jmp 0x92bb
movq -0x40(%rbp), %rdi
callq 0x95c0
movq -0x40(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, %rax
je 0x92f2
movq -0xe8(%rbp), %rdi
callq 0x9a00
movq -0xe8(%rbp), %rdi
movl $0x8, %esi
callq 0x8230
movq $0x0, -0x40(%rbp)
movq 0xecc7(%rip), %rdi      # 0x17fc8
leaq 0xa01f(%rip), %rsi      # 0x13327
callq 0x8210
jmp 0x930f
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x9cf9(%rip), %xmm1     # 0x13018
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movl %eax, %edx
movsd 0x9ce4(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andl %edx, %eax
movl %ecx, %edi
orl %eax, %edi
callq 0x8360
jmp 0x9352
jmp 0x9354
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x91c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9393
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x8, %esi
callq 0x8230
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x9439
movq -0x48(%rbp), %rdi
callq 0x80b0
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x5, -0x8c(%rbp)
callq 0x8420
jmp 0x93d8
jmp 0x93d6
jmp 0x93d8
cmpq $0x0, -0x40(%rbp)
je 0x93f7
movq -0x40(%rbp), %rdi
callq 0x9620
testb $0x1, %al
jne 0x93ee
jmp 0x93f7
movq -0x40(%rbp), %rdi
callq 0x95c0
cmpq $0x0, -0x40(%rbp)
je 0x942e
movq -0x40(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, %rax
je 0x942c
movq -0xf0(%rbp), %rdi
callq 0x9a00
movq -0xf0(%rbp), %rdi
movl $0x8, %esi
callq 0x8230
jmp 0x942e
xorl %eax, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x8460
nopw %cs:(%rax,%rax)
nopl (%rax)