// File: /workspace/github_c_makefile_star2_O2/waywardgeek[P]sonic/main.c
// Function: main
int main(int argc, char** argv) {
  char* inFileName;
  char* outFileName;
  float speed = 1.0f;
  float pitch = 1.0f;
  float rate = 1.0f;
  float volume = 1.0f;
  int outputSampleRate = 0;  /* Means use the input file sample rate. */
  int emulateChordPitch = 0;
  int quality = 0;
  int xArg = 1;
  int computeSpectrogram = 0;
  int numRows = 0, numCols = 0;

  while (xArg < argc && *(argv[xArg]) == '-') {
    if (!strcmp(argv[xArg], "-c")) {
      emulateChordPitch = 1;
      printf("Scaling pitch linearly.\n");
    } else if (!strcmp(argv[xArg], "-o")) {
      xArg++;
      if (xArg < argc) {
        outputSampleRate = atoi(argv[xArg]);
        printf("Setting output sample rate to %d\n", outputSampleRate);
      }
    } else if (!strcmp(argv[xArg], "-p")) {
      xArg++;
      if (xArg < argc) {
        pitch = atof(argv[xArg]);
        printf("Setting pitch to %0.2fX\n", pitch);
      }
    } else if (!strcmp(argv[xArg], "-q")) {
      quality = 1;
      printf("Disabling speed-up heuristics\n");
    } else if (!strcmp(argv[xArg], "-r")) {
      xArg++;
      if (xArg < argc) {
        rate = atof(argv[xArg]);
        if (rate == 0.0f) {
          usage();
        }
        printf("Setting rate to %0.2fX\n", rate);
      }
    } else if (!strcmp(argv[xArg], "-s")) {
      xArg++;
      if (xArg < argc) {
        speed = atof(argv[xArg]);
        printf("Setting speed to %0.2fX\n", speed);
      }
#ifdef SONIC_SPECTROGRAM
    } else if (!strcmp(argv[xArg], "-S")) {
      xArg++;
      if (xArg < argc) {
        numCols = atof(argv[xArg]);
      }
      xArg++;
      if (xArg < argc) {
        numRows = atof(argv[xArg]);
        computeSpectrogram = 1;
        printf("Computing spectrogram %d wide and %d tall\n", numCols, numRows);
      }
#endif  /* SONIC_SPECTROGRAM */
    } else if (!strcmp(argv[xArg], "-v")) {
      xArg++;
      if (xArg < argc) {
        volume = atof(argv[xArg]);
        printf("Setting volume to %0.2f\n", volume);
      }
    }
    xArg++;
  }
  if (argc - xArg != 2) {
    usage();
  }
  inFileName = argv[xArg];
  outFileName = argv[xArg + 1];
  runSonic(inFileName, outFileName, speed, pitch, rate, volume,
           outputSampleRate, emulateChordPitch, quality,
           computeSpectrogram, numRows, numCols);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2028, %rsp           # imm = 0x2028
movq %rsi, %r14
movl %edi, %r15d
pushq $0x1
popq %r13
movss 0x2d75(%rip), %xmm0     # 0x4004
xorl %r12d, %r12d
xorl %ebp, %ebp
movl $0x0, 0x1c(%rsp)
movl %r13d, %ebx
movss %xmm0, 0x14(%rsp)
movss %xmm0, 0x18(%rsp)
movss %xmm0, 0xc(%rsp)
movss %xmm0, 0x10(%rsp)
movl %r15d, %edx
movslq %ebx, %rcx
subl %ebx, %edx
jle 0x146a
movq (%r14,%rcx,8), %rax
cmpb $0x2d, (%rax)
jne 0x146a
cmpb $0x63, 0x1(%rax)
jne 0x12e2
cmpb $0x0, 0x2(%rax)
je 0x1377
cmpb $0x6f, 0x1(%rax)
jne 0x12f2
cmpb $0x0, 0x2(%rax)
je 0x138b
cmpb $0x70, 0x1(%rax)
jne 0x1302
cmpb $0x0, 0x2(%rax)
je 0x13ba
cmpb $0x71, 0x1(%rax)
jne 0x1312
cmpb $0x0, 0x2(%rax)
je 0x13e8
cmpb $0x72, 0x1(%rax)
jne 0x1322
cmpb $0x0, 0x2(%rax)
je 0x13fb
cmpb $0x73, 0x1(%rax)
jne 0x1332
cmpb $0x0, 0x2(%rax)
je 0x1434
cmpb $0x76, 0x1(%rax)
jne 0x1463
cmpb $0x0, 0x2(%rax)
jne 0x1463
incl %ebx
cmpl %r15d, %ebx
jge 0x1463
movslq %ebx, %rax
movq (%r14,%rax,8), %rdi
callq 0x1060
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
cvtss2sd %xmm0, %xmm0
leaq 0x2d06(%rip), %rdi      # 0x4078
jmp 0x145c
leaq 0x2fe6(%rip), %rdi      # 0x4364
callq 0x1040
movl %r13d, %ebp
jmp 0x1463
incl %ebx
cmpl %r15d, %ebx
jge 0x1463
movslq %ebx, %rax
movq (%r14,%rax,8), %rdi
callq 0x1140
movl %eax, %r12d
leaq 0x2c60(%rip), %rdi      # 0x400c
movl %eax, %esi
xorl %eax, %eax
callq 0x1090
jmp 0x1463
incl %ebx
cmpl %r15d, %ebx
jge 0x1463
movslq %ebx, %rax
movq (%r14,%rax,8), %rdi
callq 0x1060
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
cvtss2sd %xmm0, %xmm0
leaq 0x2c48(%rip), %rdi      # 0x402e
jmp 0x145c
leaq 0x2f8d(%rip), %rdi      # 0x437c
callq 0x1040
movl %r13d, 0x1c(%rsp)
jmp 0x1463
incl %ebx
cmpl %r15d, %ebx
jge 0x1463
movslq %ebx, %rax
movq (%r14,%rax,8), %rdi
callq 0x1060
cvtsd2ss %xmm0, %xmm0
ucomiss 0x2bef(%rip), %xmm0     # 0x4008
jne 0x1421
jnp 0x15b8
movss %xmm0, 0x14(%rsp)
cvtss2sd %xmm0, %xmm0
leaq 0x2c15(%rip), %rdi      # 0x4047
jmp 0x145c
incl %ebx
cmpl %r15d, %ebx
jge 0x1463
movslq %ebx, %rax
movq (%r14,%rax,8), %rdi
callq 0x1060
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
cvtss2sd %xmm0, %xmm0
leaq 0x2c03(%rip), %rdi      # 0x405f
movb $0x1, %al
callq 0x1090
incl %ebx
jmp 0x12b7
cmpl $0x2, %edx
jne 0x15b8
movq (%r14,%rcx,8), %r15
movq 0x8(%r14,%rcx,8), %r13
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %r15, %rdi
callq 0x2968
movq %rax, %r14
testl %r12d, %r12d
je 0x149b
movl %r12d, 0x8(%rsp)
testq %r14, %r14
je 0x15bd
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
movq %r13, %rdi
callq 0x2b7b
testq %rax, %rax
je 0x15d3
movq %rax, %r15
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
callq 0x1740
movq %rax, %r12
movq %rax, %rdi
movss 0x10(%rsp), %xmm0
callq 0x1630
movq %r12, %rdi
movss 0x18(%rsp), %xmm0
callq 0x1661
movq %r12, %rdi
movss 0x14(%rsp), %xmm0
callq 0x1692
movq %r12, %rdi
movss 0xc(%rsp), %xmm0
callq 0x16db
movq %r12, %rdi
movl %ebp, %esi
callq 0x16c5
movq %r12, %rdi
movl 0x1c(%rsp), %esi
callq 0x16ca
leaq 0x1020(%rsp), %rbx
leaq 0x20(%rsp), %r13
movl $0x800, %eax            # imm = 0x800
xorl %edx, %edx
idivl 0x4(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x2da8
movl %eax, %ebp
movq %r12, %rdi
testl %eax, %eax
je 0x1558
movq %rbx, %rsi
movl %ebp, %edx
callq 0x1bcb
jmp 0x156c
callq 0x1ad5
jmp 0x156c
movq %r15, %rdi
movq %r13, %rsi
movl %eax, %edx
callq 0x2e30
movl $0x800, %eax            # imm = 0x800
xorl %edx, %edx
idivl 0x4(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movl %eax, %edx
callq 0x19e3
testl %eax, %eax
jg 0x155f
testl %ebp, %ebp
jg 0x152b
movq %r12, %rdi
callq 0x1706
movq %r14, %rdi
callq 0x2c99
movq %r15, %rdi
callq 0x2c99
xorl %eax, %eax
addq $0x2028, %rsp           # imm = 0x2028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x15fe
movq 0x5a34(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2d50(%rip), %rsi      # 0x431e
movq %r15, %rdx
jmp 0x15ef
movq %r14, %rdi
callq 0x2c99
movq 0x5a16(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2d4f(%rip), %rsi      # 0x433b
movq %r13, %rdx
xorl %eax, %eax
callq 0x10d0
pushq $0x1
popq %rdi
callq 0x1150