#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ out_fname;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned long ULONG_MAX;
int atoi(char *);
scalar_t__ construct_out_name(char *, int, char *, int);
int /*<<< orphan*/ die_help();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
double get_sec();
char getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *fin = NULL;
  FILE *fout = NULL;
  char *name = NULL;
  char *in_fname = NULL;
  int channels = 0;
  int rate = 0;
  int sample_size = 0;
  char opt = '\0';
  char out_fname[1024];
  int track = 0;
  int items = 0;
  unsigned long i = 0;
  char buffer[1024 * 1024];
  double start_sec = 0;
  double finish_sec = 0;
  unsigned long start_sample = 0;
  unsigned long finish_sample = 0;
  while ((opt = getopt(argc, argv, "r:c:i:s:n:")) != -1) {
    switch (opt) {
    case 'r':
      rate = atoi(optarg);
      break;
    case 'c':
      channels = atoi(optarg);
      break;
    case 's':
      sample_size = atoi(optarg);
      break;
    case 'i':
      in_fname = optarg;
      break;
    case 'n':
      name = optarg;
      break;
    case '?':
    default:
      die_help();
    }
  }
  if (channels <= 0 || rate <= 0 || sample_size <= 0) {
    fprintf(stderr, "ERROR: Channel count, bitrate and sample size must all be "
                    "present and positive\n");
    die_help();
  }
  if (in_fname == NULL || name == NULL) {
    fprintf(stderr, "ERROR: Input filename and output name must be present\n");
    die_help();
  }
  if ((fin = fopen(in_fname, "r")) == NULL) {
    fprintf(stderr, "Failed to open '%s': ", in_fname);
    perror("fopen");
    return -1;
  }
  track = 0;
  start_sec = get_sec();
  if (start_sec < 0) {
    fprintf(stderr, "ERROR: At least one start timestamp must be specified\n");
    return -1;
  }
  while (finish_sample != ULONG_MAX) {
    track++;
    if (construct_out_name(out_fname, sizeof(out_fname), name, track) < 0) {
      fclose(fin);
      return 1;
    }
    finish_sec = get_sec();
    printf("%s starts %f s, finishes ", out_fname, start_sec);
    if (finish_sec < 0)
      printf("EOF\n");
    else
      printf("%f s\n", finish_sec);
    if ((fout = fopen(out_fname, "w")) == NULL) {
      fprintf(stderr, "Failed to open '%s': ", out_fname);
      perror("fopen");
      fclose(fin);
      return -1;
    }
    start_sample = start_sec * rate * channels;
    finish_sample = finish_sec * rate * channels;
    if (start_sample > finish_sample) {
      fprintf(stderr,
              "ERROR: Finish time can't be before start time, skipping %s\n",
              out_fname);
      continue;
    }
    if (finish_sec == -1)
      finish_sample = ULONG_MAX;
    for (i = start_sample; i < finish_sample; i += items) {
      items = fread(buffer, sample_size,
                    ((sizeof(buffer) / sample_size < (finish_sample - i))
                         ? sizeof(buffer) / sample_size
                         : (finish_sample - i)),
                    fin);
      if (items == 0) {
        if (feof(fin))
          break;
        if (ferror(fin)) {
          perror("fread");
          break;
        }
      }
      if (fwrite(buffer, sample_size, items, fout) != items) {
        fprintf(stderr, "Write to %s failed: ", out_fname);
        perror("fwrite");
        break;
      }
    }
    fclose(fout);
    start_sec = finish_sec;
  }
  fclose(fin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movb   $0x0,-0x3d(%rbp)
movl   $0x0,-0x444(%rbp)
movl   $0x0,-0x448(%rbp)
movq   $0x0,-0x450(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100458(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100460(%rbp)
ff
movq   $0x0,-0x100468(%rbp)
movq   $0x0,-0x100470(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe59(%rip),%rdx
call   10d0 <getopt@plt>
mov    %al,-0x3d(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     134b <main+0x16b>
movsbl -0x3d(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x100478(%rbp)
sub    $0x34,%eax
ja     133f <main+0x15f>
mov    -0x100478(%rbp),%rax
lea    0xd4a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d22(%rip),%rax
mov    (%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x38(%rbp)
jmp    1346 <main+0x166>
mov    0x2d0b(%rip),%rax
mov    (%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x34(%rbp)
jmp    1346 <main+0x166>
mov    0x2cf4(%rip),%rax
mov    (%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x3c(%rbp)
jmp    1346 <main+0x166>
mov    0x2cdd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1346 <main+0x166>
mov    0x2cca(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1346 <main+0x166>
jmp    133f <main+0x15f>
mov    $0x0,%al
call   1100 <die_help@plt>
jmp    127d <main+0x9d>
cmpl   $0x0,-0x34(%rbp)
jle    1369 <main+0x189>
cmpl   $0x0,-0x38(%rbp)
jle    1369 <main+0x189>
cmpl   $0x0,-0x3c(%rbp)
jg     1387 <main+0x1a7>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
lea    0xd76(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1100 <die_help@plt>
cmpq   $0x0,-0x30(%rbp)
je     139d <main+0x1bd>
cmpq   $0x0,-0x28(%rbp)
jne    13bb <main+0x1db>
mov    0x2c34(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1100 <die_help@plt>
mov    -0x30(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    140c <main+0x22c>
mov    0x2bf8(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    0xd93(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1813 <main+0x633>
movl   $0x0,-0x444(%rbp)
mov    $0x0,%al
call   10b0 <get_sec@plt>
movsd  %xmm0,-0x100458(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x100458(%rbp),%xmm0
ff
jbe    1459 <main+0x279>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1813 <main+0x633>
jmp    145e <main+0x27e>
mov    -0x100470(%rbp),%rax
mov    0x2b5c(%rip),%rcx
cmp    (%rcx),%rax
je     1803 <main+0x623>
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
lea    -0x440(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x444(%rbp),%ecx
mov    $0x400,%esi
call   1090 <construct_out_name@plt>
cmp    $0x0,%rax
jge    14be <main+0x2de>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1813 <main+0x633>
mov    $0x0,%al
call   10b0 <get_sec@plt>
movsd  %xmm0,-0x100460(%rbp)
ff
lea    -0x440(%rbp),%rsi
movsd  -0x100458(%rbp),%xmm0
ff
lea    0xce8(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x100460(%rbp),%xmm0
ff
jbe    150e <main+0x32e>
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1524 <main+0x344>
movsd  -0x100460(%rbp),%xmm0
ff
lea    0xccd(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    -0x440(%rbp),%rdi
lea    0xcbe(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1584 <main+0x3a4>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rdx
lea    0xc1c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    0xc24(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1813 <main+0x633>
movsd  -0x100458(%rbp),%xmm0
ff
cvtsi2sdl -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xa4b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x100468(%rbp)
movsd  -0x100460(%rbp),%xmm0
ff
cvtsi2sdl -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2sdl -0x34(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movaps %xmm0,%xmm2
cvttsd2si %xmm2,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x100470(%rbp)
mov    -0x100468(%rbp),%rax
cmp    -0x100470(%rbp),%rax
jbe    1641 <main+0x461>
mov    0x29b3(%rip),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rdx
lea    0xbbd(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    145e <main+0x27e>
movsd  -0x100460(%rbp),%xmm0
ff
movsd  0x9b7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1672 <main+0x492>
jp     1672 <main+0x492>
mov    0x2960(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x100470(%rbp)
mov    -0x100468(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
cmp    -0x100470(%rbp),%rax
jae    17e5 <main+0x605>
lea    -0x100450(%rbp),%rax
mov    %rax,-0x100488(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x10047c(%rbp)
movslq -0x3c(%rbp),%rcx
mov    $0x100000,%eax
xor    %edx,%edx
div    %rcx
mov    -0x100470(%rbp),%rcx
sub    -0x450(%rbp),%rcx
cmp    %rcx,%rax
jae    16ea <main+0x50a>
movslq -0x3c(%rbp),%rcx
mov    $0x100000,%eax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x100490(%rbp)
jmp    16ff <main+0x51f>
mov    -0x100470(%rbp),%rax
sub    -0x450(%rbp),%rax
mov    %rax,-0x100490(%rbp)
mov    -0x10047c(%rbp),%esi
mov    -0x100488(%rbp),%rdi
mov    -0x100490(%rbp),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rcx
call   1040 <fread@plt>
mov    %eax,-0x448(%rbp)
cmpl   $0x0,-0x448(%rbp)
jne    1772 <main+0x592>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
je     1749 <main+0x569>
jmp    17e5 <main+0x605>
mov    -0x18(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     176d <main+0x58d>
lea    0xacb(%rip),%rdi
call   10c0 <perror@plt>
jmp    17e5 <main+0x605>
jmp    1772 <main+0x592>
lea    -0x100450(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x448(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   10f0 <fwrite@plt>
cmp    -0x448(%rbp),%eax
je     17c6 <main+0x5e6>
mov    0x283a(%rip),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rdx
lea    0xa86(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    0xa8d(%rip),%rdi
call   10c0 <perror@plt>
jmp    17e5 <main+0x605>
jmp    17cb <main+0x5eb>
movslq -0x448(%rbp),%rax
add    -0x450(%rbp),%rax
mov    %rax,-0x450(%rbp)
jmp    1680 <main+0x4a0>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movsd  -0x100460(%rbp),%xmm0
ff
movsd  %xmm0,-0x100458(%rbp)
ff
jmp    145e <main+0x27e>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100468,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
lea    0xe4e(%rip),%rdx
call   10e0 <getopt@plt>
cmp    $0xff,%al
je     12f3 <main+0x103>
lea    0xe3a(%rip),%r12
lea    0xdef(%rip),%r13
mov    0x2dc8(%rip),%r15
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
movl   $0x0,0x18(%rsp)
xor    %ebx,%ebx
xor    %ecx,%ecx
mov    %rcx,0x28(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
jmp    1272 <main+0x82>
xor    %eax,%eax
call   1110 <die_help@plt>
nopl   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   10e0 <getopt@plt>
cmp    $0xff,%al
je     12c4 <main+0xd4>
movsbl %al,%eax
add    $0xffffff9d,%eax
cmp    $0x10,%eax
ja     1251 <main+0x61>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
mov    (%r15),%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebx
jmp    1260 <main+0x70>
mov    (%r15),%rax
mov    %rax,0x28(%rsp)
jmp    1260 <main+0x70>
mov    (%r15),%rax
mov    %rax,0x10(%rsp)
jmp    1260 <main+0x70>
mov    (%r15),%rdi
call   10f0 <atoi@plt>
mov    %eax,0x18(%rsp)
jmp    1260 <main+0x70>
mov    (%r15),%rdi
call   10f0 <atoi@plt>
mov    %rax,0x8(%rsp)
jmp    1260 <main+0x70>
mov    %ebx,%r14d
test   %ebx,%ebx
jle    169a <main+0x4aa>
mov    0x18(%rsp),%r15d
test   %r15d,%r15d
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%r12
mov    0x28(%rsp),%rbp
jle    1300 <main+0x110>
test   %ebx,%ebx
jle    1300 <main+0x110>
test   %rbp,%rbp
jne    1323 <main+0x133>
jmp    1328 <main+0x138>
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %ebp,%ebp
xor    %r12d,%r12d
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
lea    0xd57(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1110 <die_help@plt>
test   %rbp,%rbp
je     1328 <main+0x138>
test   %r12,%r12
jne    1346 <main+0x156>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
lea    0xd7f(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1110 <die_help@plt>
lea    0xda1(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     16b3 <main+0x4c3>
xor    %eax,%eax
call   10c0 <get_sec@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1399 <main+0x1a9>
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1688 <main+0x498>
mov    %rbx,0x8(%rsp)
mov    0x2c23(%rip),%rax
cmpq   $0x0,(%rax)
je     166b <main+0x47b>
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  %xmm0,0x48(%rsp)
movslq 0x8(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0x60(%rsp),%rbp
lea    0x460(%rsp),%r14
xor    %r13d,%r13d
movsd  %xmm1,0x10(%rsp)
mulsd  0x28(%rsp),%xmm1
mulsd  0x48(%rsp),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
subsd  0xbf9(%rip),%xmm1
cvttsd2si %xmm1,%r15
sar    $0x3f,%rcx
and    %rcx,%r15
or     %rax,%r15
add    $0x1,%r13d
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
mov    %r13d,%ecx
call   10a0 <construct_out_name@plt>
test   %rax,%rax
js     1679 <main+0x489>
xor    %eax,%eax
call   10c0 <get_sec@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xcf3(%rip),%rdi
mov    %rbp,%rsi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x18(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1480 <main+0x290>
lea    0xd4c(%rip),%rdi
call   1030 <puts@plt>
jmp    1492 <main+0x2a2>
xchg   %ax,%ax
lea    0xcd6(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbp,%rdi
lea    0xcc7(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     16de <main+0x4ee>
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0x28(%rsp),%xmm0
mulsd  0x48(%rsp),%xmm0
cvttsd2si %xmm0,%rdx
mov    %rdx,%rcx
subsd  0xb30(%rip),%xmm0
cvttsd2si %xmm0,%rbx
sar    $0x3f,%rcx
and    %rcx,%rbx
or     %rdx,%rbx
cmp    %rbx,%r15
jbe    151c <main+0x32c>
mov    0x2aed(%rip),%rax
mov    (%rax),%edi
lea    0xc71(%rip),%rsi
lea    0x60(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%r13d
mov    0x2aba(%rip),%rax
cmp    %rbx,(%rax)
jne    1420 <main+0x230>
jmp    166b <main+0x47b>
mov    %r15,%rcx
mov    %rax,0x40(%rsp)
mov    %r12,0x10(%rsp)
ucomisd 0xad7(%rip),%xmm1
mov    0x2a90(%rip),%rax
mov    (%rax),%rbp
cmovne %rbx,%rbp
cmovp  %rbx,%rbp
cmp    %r15,%rbp
jbe    1607 <main+0x417>
cmpq   $0x100000,0x50(%rsp)
ja     1564 <main+0x374>
mov    $0x100000,%eax
xor    %edx,%edx
divl   0x8(%rsp)
jmp    1566 <main+0x376>
xor    %eax,%eax
mov    %rax,0x38(%rsp)
mov    %rbp,0x30(%rsp)
mov    %rbp,%rax
mov    %rcx,0x58(%rsp)
sub    %rcx,%rax
mov    0x38(%rsp),%rcx
cmp    %rax,%rcx
mov    %ecx,%edx
cmovae %eax,%edx
mov    %r14,%rbx
mov    %r14,%rdi
mov    0x8(%rsp),%r12
mov    %r12d,%esi
mov    0x20(%rsp),%rcx
call   1050 <fread@plt>
mov    %eax,%r15d
test   %eax,%eax
jne    15d6 <main+0x3e6>
mov    0x20(%rsp),%rdi
call   1090 <feof@plt>
test   %rax,%rax
mov    0x30(%rsp),%rbp
jne    1607 <main+0x417>
mov    0x20(%rsp),%rdi
call   1040 <ferror@plt>
test   %rax,%rax
mov    0x8(%rsp),%r12
mov    %r14,%rbx
jne    1658 <main+0x468>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    0x40(%rsp),%rcx
call   1100 <fwrite@plt>
cmp    %r15d,%eax
jne    1633 <main+0x443>
movslq %r15d,%rax
mov    0x58(%rsp),%rcx
add    %rax,%rcx
mov    0x30(%rsp),%rbp
cmp    %rcx,%rbp
ja     1570 <main+0x380>
mov    0x40(%rsp),%rdi
call   1060 <fclose@plt>
mov    0x29b0(%rip),%rax
cmp    (%rax),%rbp
mov    0x10(%rsp),%r12
lea    0x60(%rsp),%rbp
movsd  0x18(%rsp),%xmm1
jne    13e5 <main+0x1f5>
jmp    166b <main+0x47b>
mov    0x299e(%rip),%rax
mov    (%rax),%edi
lea    0xb64(%rip),%rsi
lea    0x60(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xb66(%rip),%rdi
jmp    165f <main+0x46f>
lea    0xb42(%rip),%rdi
mov    0x30(%rsp),%rbp
call   10d0 <perror@plt>
jmp    1607 <main+0x417>
mov    0x20(%rsp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
jmp    1688 <main+0x498>
mov    0x20(%rsp),%rdi
call   1060 <fclose@plt>
mov    $0x1,%eax
add    $0x100468,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%r12
mov    0x18(%rsp),%r15d
mov    0x28(%rsp),%rbp
jmp    1300 <main+0x110>
mov    0x291e(%rip),%rax
mov    (%rax),%edi
lea    0xa2d(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xa32(%rip),%rdi
call   10d0 <perror@plt>
jmp    138f <main+0x19f>
mov    0x28f3(%rip),%rax
mov    (%rax),%edi
lea    0xa02(%rip),%rsi
lea    0x60(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xa05(%rip),%rdi
call   10d0 <perror@plt>
mov    0x20(%rsp),%rdi
call   1060 <fclose@plt>
jmp    138f <main+0x19f>

LLVM IR (-O0):
@.str = [11 x i8] c"r:c:i:s:n:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [80 x i8] c"ERROR: Channel count, bitrate and sample size must all be present and positive\0A\00"
@.str.2 = [55 x i8] c"ERROR: Input filename and output name must be present\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"Failed to open '%s': \00"
@.str.5 = [6 x i8] c"fopen\00"
@.str.6 = [55 x i8] c"ERROR: At least one start timestamp must be specified\0A\00"
@ULONG_MAX = global i64 0
@.str.7 = [26 x i8] c"%s starts %f s, finishes \00"
@.str.8 = [5 x i8] c"EOF\0A\00"
@.str.9 = [6 x i8] c"%f s\0A\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [60 x i8] c"ERROR: Finish time can't be before start time, skipping %s\0A\00"
@.str.12 = [6 x i8] c"fread\00"
@.str.13 = [21 x i8] c"Write to %s failed: \00"
@.str.14 = [7 x i8] c"fwrite\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca [1024 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca [1048576 x i8]
%19 = alloca double
%20 = alloca double
%21 = alloca i64
%22 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i8 0, i8* %13
store i32 0, i32* %15
store i32 0, i32* %16
store i64 0, i64* %17
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store i64 0, i64* %21
store i64 0, i64* %22
br label %23
23: ; preds = %48, %2
%24 = load i32, i32* %4
%25 = load i8**, i8*** %5
%26 = call signext i8 @getopt(i32 %24, i8** %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8 %26, i8* %13
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %49
29: ; preds = %23
%30 = load i8, i8* %13
%31 = sext i8 %30 to i32
switch i32 %31, label %46 [
i32 114, label %32
i32 99, label %35
i32 115, label %38
i32 105, label %41
i32 110, label %43
i32 63, label %45
]
32: ; preds = %29
%33 = load i8*, i8** @optarg
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %11
br label %48
35: ; preds = %29
%36 = load i8*, i8** @optarg
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %10
br label %48
38: ; preds = %29
%39 = load i8*, i8** @optarg
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %12
br label %48
41: ; preds = %29
%42 = load i8*, i8** @optarg
store i8* %42, i8** %9
br label %48
43: ; preds = %29
%44 = load i8*, i8** @optarg
store i8* %44, i8** %8
br label %48
45: ; preds = %29
br label %46
46: ; preds = %29, %45
%47 = call i32 (...) @die_help()
br label %48
48: ; preds = %46, %43, %41, %38, %35, %32
br label %23
49: ; preds = %23
%50 = load i32, i32* %10
%51 = icmp sle i32 %50, 0
br i1 %51, label %58, label %52
52: ; preds = %49
%53 = load i32, i32* %11
%54 = icmp sle i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %52
%56 = load i32, i32* %12
%57 = icmp sle i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %55, %52, %49
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0))
%61 = call i32 (...) @die_help()
br label %62
62: ; preds = %58, %55
%63 = load i8*, i8** %9
%64 = icmp eq i8* %63, null
br i1 %64, label %68, label %65
65: ; preds = %62
%66 = load i8*, i8** %8
%67 = icmp eq i8* %66, null
br i1 %67, label %68, label %72
68: ; preds = %65, %62
%69 = load i32, i32* @stderr
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%71 = call i32 (...) @die_help()
br label %72
72: ; preds = %68, %65
%73 = load i8*, i8** %9
%74 = call i32* @fopen(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %74, i32** %6
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %9
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %78)
%80 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %225
81: ; preds = %72
store i32 0, i32* %15
%82 = call double (...) @get_sec()
store double %82, double* %19
%83 = load double, double* %19
%84 = fcmp olt double %83, 0.000000e+00
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %225
88: ; preds = %81
br label %89
89: ; preds = %218, %147, %88
%90 = load i64, i64* %22
%91 = load i64, i64* @ULONG_MAX
%92 = icmp ne i64 %90, %91
br i1 %92, label %93, label %222
93: ; preds = %89
%94 = load i32, i32* %15
%95 = add nsw i32 %94, 1
store i32 %95, i32* %15
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%97 = load i8*, i8** %8
%98 = load i32, i32* %15
%99 = call i64 @construct_out_name(i8* %96, i32 1024, i8* %97, i32 %98)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %93
%102 = load i32*, i32** %6
%103 = call i32 @fclose(i32* %102)
store i32 1, i32* %3
br label %225
104: ; preds = %93
%105 = call double (...) @get_sec()
store double %105, double* %20
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%107 = load double, double* %19
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %106, double %107)
%109 = load double, double* %20
%110 = fcmp olt double %109, 0.000000e+00
br i1 %110, label %111, label %113
111: ; preds = %104
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %116
113: ; preds = %104
%114 = load double, double* %20
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %114)
br label %116
116: ; preds = %113, %111
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%118 = call i32* @fopen(i8* %117, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %118, i32** %7
%119 = icmp eq i32* %118, null
br i1 %119, label %120, label %127
120: ; preds = %116
%121 = load i32, i32* @stderr
%122 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %122)
%124 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%125 = load i32*, i32** %6
%126 = call i32 @fclose(i32* %125)
store i32 -1, i32* %3
br label %225
127: ; preds = %116
%128 = load double, double* %19
%129 = load i32, i32* %11
%130 = sitofp i32 %129 to double
%131 = fmul double %128, %130
%132 = load i32, i32* %10
%133 = sitofp i32 %132 to double
%134 = fmul double %131, %133
%135 = fptoui double %134 to i64
store i64 %135, i64* %21
%136 = load double, double* %20
%137 = load i32, i32* %11
%138 = sitofp i32 %137 to double
%139 = fmul double %136, %138
%140 = load i32, i32* %10
%141 = sitofp i32 %140 to double
%142 = fmul double %139, %141
%143 = fptoui double %142 to i64
store i64 %143, i64* %22
%144 = load i64, i64* %21
%145 = load i64, i64* %22
%146 = icmp ugt i64 %144, %145
br i1 %146, label %147, label %151
147: ; preds = %127
%148 = load i32, i32* @stderr
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0), i8* %149)
br label %89
151: ; preds = %127
%152 = load double, double* %20
%153 = fcmp oeq double %152, -1.000000e+00
br i1 %153, label %154, label %156
154: ; preds = %151
%155 = load i64, i64* @ULONG_MAX
store i64 %155, i64* %22
br label %156
156: ; preds = %154, %151
%157 = load i64, i64* %21
store i64 %157, i64* %17
br label %158
158: ; preds = %213, %156
%159 = load i64, i64* %17
%160 = load i64, i64* %22
%161 = icmp ult i64 %159, %160
br i1 %161, label %162, label %218
162: ; preds = %158
%163 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %18, i64 0, i64 0
%164 = load i32, i32* %12
%165 = load i32, i32* %12
%166 = sext i32 %165 to i64
%167 = udiv i64 1048576, %166
%168 = load i64, i64* %22
%169 = load i64, i64* %17
%170 = sub i64 %168, %169
%171 = icmp ult i64 %167, %170
br i1 %171, label %172, label %176
172: ; preds = %162
%173 = load i32, i32* %12
%174 = sext i32 %173 to i64
%175 = udiv i64 1048576, %174
br label %180
176: ; preds = %162
%177 = load i64, i64* %22
%178 = load i64, i64* %17
%179 = sub i64 %177, %178
br label %180
180: ; preds = %176, %172
%181 = phi i64 [ %175, %172 ], [ %179, %176 ]
%182 = trunc i64 %181 to i32
%183 = load i32*, i32** %6
%184 = call i32 @fread(i8* %163, i32 %164, i32 %182, i32* %183)
store i32 %184, i32* %16
%185 = load i32, i32* %16
%186 = icmp eq i32 %185, 0
br i1 %186, label %187, label %199
187: ; preds = %180
%188 = load i32*, i32** %6
%189 = call i64 @feof(i32* %188)
%190 = icmp ne i64 %189, 0
br i1 %190, label %191, label %192
191: ; preds = %187
br label %218
192: ; preds = %187
%193 = load i32*, i32** %6
%194 = call i64 @ferror(i32* %193)
%195 = icmp ne i64 %194, 0
br i1 %195, label %196, label %198
196: ; preds = %192
%197 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %218
198: ; preds = %192
br label %199
199: ; preds = %198, %180
%200 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %18, i64 0, i64 0
%201 = load i32, i32* %12
%202 = load i32, i32* %16
%203 = load i32*, i32** %7
%204 = call i32 @fwrite(i8* %200, i32 %201, i32 %202, i32* %203)
%205 = load i32, i32* %16
%206 = icmp ne i32 %204, %205
br i1 %206, label %207, label %212
207: ; preds = %199
%208 = load i32, i32* @stderr
%209 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%210 = call i32 (i32, i8*, ...) @fprintf(i32 %208, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i8* %209)
%211 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
br label %218
212: ; preds = %199
br label %213
213: ; preds = %212
%214 = load i32, i32* %16
%215 = sext i32 %214 to i64
%216 = load i64, i64* %17
%217 = add i64 %216, %215
store i64 %217, i64* %17
br label %158
218: ; preds = %207, %196, %191, %158
%219 = load i32*, i32** %7
%220 = call i32 @fclose(i32* %219)
%221 = load double, double* %20
store double %221, double* %19
br label %89
222: ; preds = %89
%223 = load i32*, i32** %6
%224 = call i32 @fclose(i32* %223)
store i32 0, i32* %3
br label %225
225: ; preds = %222, %120, %101, %85, %76
%226 = load i32, i32* %3
ret i32 %226
}

LLVM IR (-O2):
@.str = [11 x i8] c"r:c:i:s:n:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [80 x i8] c"ERROR: Channel count, bitrate and sample size must all be present and positive\0A\00"
@.str.2 = [55 x i8] c"ERROR: Input filename and output name must be present\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"Failed to open '%s': \00"
@.str.5 = [6 x i8] c"fopen\00"
@.str.6 = [55 x i8] c"ERROR: At least one start timestamp must be specified\0A\00"
@ULONG_MAX = global i64 0
@.str.7 = [26 x i8] c"%s starts %f s, finishes \00"
@.str.9 = [6 x i8] c"%f s\0A\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [60 x i8] c"ERROR: Finish time can't be before start time, skipping %s\0A\00"
@.str.12 = [6 x i8] c"fread\00"
@.str.13 = [21 x i8] c"Write to %s failed: \00"
@.str.14 = [7 x i8] c"fwrite\00"
@str = [4 x i8] c"EOF\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1048576 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %4, i64 0, i64 0
%7 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8 %7, -1
br i1 %8, label %46, label %9
9: ; preds = %2, %32
%10 = phi i8 [ %38, %32 ], [ %7, %2 ]
%11 = phi i32 [ %37, %32 ], [ 0, %2 ]
%12 = phi i32 [ %36, %32 ], [ 0, %2 ]
%13 = phi i32 [ %35, %32 ], [ 0, %2 ]
%14 = phi i8* [ %34, %32 ], [ null, %2 ]
%15 = phi i8* [ %33, %32 ], [ null, %2 ]
%16 = sext i8 %10 to i32
switch i32 %16, label %30 [
i32 114, label %17
i32 99, label %20
i32 115, label %23
i32 105, label %26
i32 110, label %28
]
17: ; preds = %9
%18 = load i8*, i8** @optarg
%19 = tail call i32 @atoi(i8* %18)
br label %32
20: ; preds = %9
%21 = load i8*, i8** @optarg
%22 = tail call i32 @atoi(i8* %21)
br label %32
23: ; preds = %9
%24 = load i8*, i8** @optarg
%25 = tail call i32 @atoi(i8* %24)
br label %32
26: ; preds = %9
%27 = load i8*, i8** @optarg
br label %32
28: ; preds = %9
%29 = load i8*, i8** @optarg
br label %32
30: ; preds = %9
%31 = tail call i32 (...) @die_help()
br label %32
32: ; preds = %30, %28, %26, %23, %20, %17
%33 = phi i8* [ %15, %30 ], [ %29, %28 ], [ %15, %26 ], [ %15, %23 ], [ %15, %20 ], [ %15, %17 ]
%34 = phi i8* [ %14, %30 ], [ %14, %28 ], [ %27, %26 ], [ %14, %23 ], [ %14, %20 ], [ %14, %17 ]
%35 = phi i32 [ %13, %30 ], [ %13, %28 ], [ %13, %26 ], [ %13, %23 ], [ %22, %20 ], [ %13, %17 ]
%36 = phi i32 [ %12, %30 ], [ %12, %28 ], [ %12, %26 ], [ %12, %23 ], [ %12, %20 ], [ %19, %17 ]
%37 = phi i32 [ %11, %30 ], [ %11, %28 ], [ %11, %26 ], [ %25, %23 ], [ %11, %20 ], [ %11, %17 ]
%38 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%39 = icmp eq i8 %38, -1
br i1 %39, label %40, label %9
40: ; preds = %32
%41 = icmp slt i32 %35, 1
%42 = icmp slt i32 %36, 1
%43 = select i1 %41, i1 true, i1 %42
%44 = icmp slt i32 %37, 1
%45 = select i1 %43, i1 true, i1 %44
br i1 %45, label %46, label %55
46: ; preds = %2, %40
%47 = phi i32 [ %37, %40 ], [ 0, %2 ]
%48 = phi i32 [ %36, %40 ], [ 0, %2 ]
%49 = phi i32 [ %35, %40 ], [ 0, %2 ]
%50 = phi i8* [ %34, %40 ], [ null, %2 ]
%51 = phi i8* [ %33, %40 ], [ null, %2 ]
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0))
%54 = tail call i32 (...) @die_help()
br label %55
55: ; preds = %40, %46
%56 = phi i32 [ %37, %40 ], [ %47, %46 ]
%57 = phi i32 [ %36, %40 ], [ %48, %46 ]
%58 = phi i32 [ %35, %40 ], [ %49, %46 ]
%59 = phi i8* [ %34, %40 ], [ %50, %46 ]
%60 = phi i8* [ %33, %40 ], [ %51, %46 ]
%61 = icmp eq i8* %59, null
%62 = icmp eq i8* %60, null
%63 = select i1 %61, i1 true, i1 %62
br i1 %63, label %64, label %68
64: ; preds = %55
%65 = load i32, i32* @stderr
%66 = tail call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%67 = tail call i32 (...) @die_help()
br label %68
68: ; preds = %55, %64
%69 = tail call i32* @fopen(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%70 = icmp eq i32* %69, null
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = load i32, i32* @stderr
%73 = tail call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %59)
%74 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %167
75: ; preds = %68
%76 = tail call double (...) @get_sec()
%77 = fcmp olt double %76, 0.000000e+00
br i1 %77, label %85, label %78
78: ; preds = %75
%79 = load i64, i64* @ULONG_MAX
%80 = icmp eq i64 %79, 0
br i1 %80, label %165, label %81
81: ; preds = %78
%82 = sitofp i32 %57 to double
%83 = sitofp i32 %58 to double
%84 = sext i32 %56 to i64
br label %159
85: ; preds = %75
%86 = load i32, i32* @stderr
%87 = tail call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
br label %167
88: ; preds = %159, %116
%89 = phi i32 [ %161, %159 ], [ %90, %116 ]
%90 = add nsw i32 %89, 1
%91 = call i64 @construct_out_name(i8* %5, i32 1024, i8* %60, i32 %90)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %88
%94 = call i32 @fclose(i32* %69)
br label %167
95: ; preds = %88
%96 = call double (...) @get_sec()
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %5, double %160)
%98 = fcmp olt double %96, 0.000000e+00
br i1 %98, label %99, label %101
99: ; preds = %95
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %103
101: ; preds = %95
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %96)
br label %103
103: ; preds = %101, %99
%104 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%105 = icmp eq i32* %104, null
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%109 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%110 = call i32 @fclose(i32* %69)
br label %167
111: ; preds = %103
%112 = fmul double %96, %82
%113 = fmul double %112, %83
%114 = fptoui double %113 to i64
%115 = icmp ugt i64 %164, %114
br i1 %115, label %116, label %121
116: ; preds = %111
%117 = load i32, i32* @stderr
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0), i8* %5)
%119 = load i64, i64* @ULONG_MAX
%120 = icmp eq i64 %119, %114
br i1 %120, label %165, label %88
121: ; preds = %111
%122 = fcmp oeq double %96, -1.000000e+00
%123 = load i64, i64* @ULONG_MAX
%124 = select i1 %122, i64 %123, i64 %114
%125 = icmp ugt i64 %124, %164
br i1 %125, label %126, label %155
126: ; preds = %121
%127 = udiv i64 1048576, %84
br label %130
128: ; preds = %144
%129 = icmp ugt i64 %124, %148
br i1 %129, label %130, label %155
130: ; preds = %126, %128
%131 = phi i64 [ %164, %126 ], [ %148, %128 ]
%132 = sub i64 %124, %131
%133 = icmp ult i64 %127, %132
%134 = select i1 %133, i64 %127, i64 %132
%135 = trunc i64 %134 to i32
%136 = call i32 @fread(i8* %6, i32 %56, i32 %135, i32* %69)
%137 = icmp eq i32 %136, 0
br i1 %137, label %138, label %144
138: ; preds = %130
%139 = call i64 @feof(i32* %69)
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %155
141: ; preds = %138
%142 = call i64 @ferror(i32* %69)
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %152
144: ; preds = %141, %130
%145 = call i32 @fwrite(i8* %6, i32 %56, i32 %136, i32* %104)
%146 = icmp eq i32 %145, %136
%147 = sext i32 %136 to i64
%148 = add i64 %131, %147
br i1 %146, label %128, label %149
149: ; preds = %144
%150 = load i32, i32* @stderr
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i8* %5)
br label %152
152: ; preds = %141, %149
%153 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), %149 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), %141 ]
%154 = call i32 @perror(i8* %153)
br label %155
155: ; preds = %128, %138, %152, %121
%156 = call i32 @fclose(i32* %104)
%157 = load i64, i64* @ULONG_MAX
%158 = icmp eq i64 %124, %157
br i1 %158, label %165, label %159
159: ; preds = %81, %155
%160 = phi double [ %76, %81 ], [ %96, %155 ]
%161 = phi i32 [ 0, %81 ], [ %90, %155 ]
%162 = fmul double %160, %82
%163 = fmul double %162, %83
%164 = fptoui double %163 to i64
br label %88
165: ; preds = %155, %116, %78
%166 = call i32 @fclose(i32* %69)
br label %167
167: ; preds = %165, %106, %93, %85, %71
%168 = phi i32 [ -1, %71 ], [ -1, %85 ], [ 1, %93 ], [ -1, %106 ], [ 0, %165 ]
ret i32 %168
}