#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 void *int16_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ EINTR;
int /*<<< orphan*/ EXIT_FAILURE;
int M_PI;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
void *lround(double);
int /*<<< orphan*/ perror(char *);
double sin(double);
int /*<<< orphan*/ stderr;
double strtol(char *, char **, int /*<<< orphan*/);
int write(int, void **, int);
int main(int argc, char *argv[]) {
  double dur;
  double freq;
  const double rate = 22050.0;
  if (argc != 3) {
    fprintf(stderr, "%s: usage: tonegen ms freq", argv[0]);
    exit(EXIT_FAILURE);
  }
  {
    char *endptr;
    dur = strtol(argv[1], &endptr, 0);
    if (*endptr != '\0') {
      fprintf(stderr, "%s: incorrect argument: %s\n", argv[0], argv[1]);
      exit(EXIT_FAILURE);
    }
    freq = strtol(argv[2], &endptr, 0);
    if (*endptr != '\0') {
      fprintf(stderr, "%s: incorrect argument: %s\n", argv[0], argv[2]);
      exit(EXIT_FAILURE);
    }
  }
  {
    int16_t buf[1024];
    const int bufsize = sizeof(buf) / sizeof(buf[0]);
    int chunk, written;
    int i = 0;
    int samples = lround(0.001 * dur * rate);
    double coeff = 2 * M_PI * freq / rate;
    int fade = lround(0.002 * rate);
    while (i < fade && i <= samples) {
      int j;
      chunk = samples - i + 1 < bufsize ? samples - i + 1 : bufsize;
      chunk = fade - i < chunk ? fade - i : chunk;
      for (j = 0; j < chunk; i++, j++)
        buf[j] = lround(24000.0 * ((double)i / (double)fade) * sin(coeff * i));
      written = 0;
      while (written < chunk * sizeof(buf[0])) {
        int rc = write(1, buf + written, chunk * sizeof(buf[0]) - written);
        if (rc == -1) {
          if (errno == EINTR)
            continue;
          else {
            perror("write");
            exit(EXIT_FAILURE);
          }
        }
        written += rc;
      }
    }
    while (i < samples - fade) {
      int j;
      chunk = samples - fade - i < bufsize ? samples - fade - i : bufsize;
      for (j = 0; j < chunk; i++, j++)
        buf[j] = lround(24000.0 * sin(coeff * i));
      written = 0;
      while (written < chunk * sizeof(buf[0])) {
        int rc = write(1, buf + written, chunk * sizeof(buf[0]) - written);
        if (rc == -1) {
          if (errno == EINTR)
            continue;
          else {
            perror("write");
            exit(EXIT_FAILURE);
          }
        }
        written += rc;
      }
    }
    while (i <= samples) {
      int j;
      chunk = samples - i + 1 < bufsize ? samples - i + 1 : bufsize;
      for (j = 0; j < chunk; i++, j++)
        buf[j] = lround(24000.0 * ((double)(samples - i) / (double)fade) *
                        sin(coeff * i));
      written = 0;
      while (written < chunk * sizeof(buf[0])) {
        int rc = write(1, buf + written, chunk * sizeof(buf[0]) - written);
        if (rc == -1) {
          if (errno == EINTR)
            continue;
          else {
            perror("write");
            exit(EXIT_FAILURE);
          }
        }
        written += rc;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe6f(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11cc <main+0x5c>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1228 <main+0xb8>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1284 <main+0x114>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
movl   $0x400,-0x2034(%rbp)
movl   $0x0,-0x2040(%rbp)
movsd  0xd70(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd53(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <lround@plt>
mov    %eax,-0x2044(%rbp)
mov    0x2d25(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xd27(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x2050(%rbp)
ff
movsd  0xd1b(%rip),%xmm0
call   1030 <lround@plt>
mov    %eax,-0x2054(%rbp)
mov    -0x2040(%rbp),%ecx
xor    %eax,%eax
cmp    -0x2054(%rbp),%ecx
mov    %al,-0x206d(%rbp)
jge    1327 <main+0x1b7>
mov    -0x2040(%rbp),%eax
cmp    -0x2044(%rbp),%eax
setle  %al
mov    %al,-0x206d(%rbp)
mov    -0x206d(%rbp),%al
test   $0x1,%al
jne    133a <main+0x1ca>
jmp    153a <main+0x3ca>
mov    -0x2044(%rbp),%eax
sub    -0x2040(%rbp),%eax
add    $0x1,%eax
cmp    $0x400,%eax
jge    136e <main+0x1fe>
mov    -0x2044(%rbp),%eax
sub    -0x2040(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2074(%rbp)
jmp    137e <main+0x20e>
mov    $0x400,%eax
mov    %eax,-0x2074(%rbp)
jmp    137e <main+0x20e>
mov    -0x2074(%rbp),%eax
mov    %eax,-0x2038(%rbp)
mov    -0x2054(%rbp),%eax
sub    -0x2040(%rbp),%eax
cmp    -0x2038(%rbp),%eax
jge    13b9 <main+0x249>
mov    -0x2054(%rbp),%eax
sub    -0x2040(%rbp),%eax
mov    %eax,-0x2078(%rbp)
jmp    13c5 <main+0x255>
mov    -0x2038(%rbp),%eax
mov    %eax,-0x2078(%rbp)
mov    -0x2078(%rbp),%eax
mov    %eax,-0x2038(%rbp)
movl   $0x0,-0x2058(%rbp)
mov    -0x2058(%rbp),%eax
cmp    -0x2038(%rbp),%eax
jge    1477 <main+0x307>
cvtsi2sdl -0x2040(%rbp),%xmm1
ff
cvtsi2sdl -0x2054(%rbp),%xmm0
ff
divsd  %xmm0,%xmm1
movsd  0xc0f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x2080(%rbp)
ff
movsd  -0x2050(%rbp),%xmm0
ff
cvtsi2sdl -0x2040(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x2080(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1030 <lround@plt>
mov    %rax,%rcx
movslq -0x2058(%rbp),%rax
mov    %rcx,-0x2030(%rbp,%rax,8)
ff
mov    -0x2040(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2040(%rbp)
mov    -0x2058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2058(%rbp)
jmp    13db <main+0x26b>
movl   $0x0,-0x203c(%rbp)
movslq -0x203c(%rbp),%rax
movslq -0x2038(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
jae    1535 <main+0x3c5>
lea    -0x2030(%rbp),%rsi
movslq -0x203c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x2038(%rbp),%rax
shl    $0x3,%rax
movslq -0x203c(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %eax,-0x205c(%rbp)
cmpl   $0xffffffff,-0x205c(%rbp)
jne    151e <main+0x3ae>
mov    0x2ae4(%rip),%rax
mov    (%rax),%rax
mov    0x2aca(%rip),%rcx
cmp    (%rcx),%rax
jne    1504 <main+0x394>
jmp    1481 <main+0x311>
lea    0xb4c(%rip),%rdi
call   1080 <perror@plt>
mov    0x2ab1(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x205c(%rbp),%eax
add    -0x203c(%rbp),%eax
mov    %eax,-0x203c(%rbp)
jmp    1481 <main+0x311>
jmp    12f8 <main+0x188>
jmp    153f <main+0x3cf>
mov    -0x2040(%rbp),%eax
mov    -0x2044(%rbp),%ecx
sub    -0x2054(%rbp),%ecx
cmp    %ecx,%eax
jge    16f0 <main+0x580>
mov    -0x2044(%rbp),%eax
sub    -0x2054(%rbp),%eax
sub    -0x2040(%rbp),%eax
cmp    $0x400,%eax
jge    1593 <main+0x423>
mov    -0x2044(%rbp),%eax
sub    -0x2054(%rbp),%eax
sub    -0x2040(%rbp),%eax
mov    %eax,-0x2084(%rbp)
jmp    15a3 <main+0x433>
mov    $0x400,%eax
mov    %eax,-0x2084(%rbp)
jmp    15a3 <main+0x433>
mov    -0x2084(%rbp),%eax
mov    %eax,-0x2038(%rbp)
movl   $0x0,-0x2060(%rbp)
mov    -0x2060(%rbp),%eax
cmp    -0x2038(%rbp),%eax
jge    162d <main+0x4bd>
movsd  -0x2050(%rbp),%xmm0
ff
cvtsi2sdl -0x2040(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xa29(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <lround@plt>
mov    %rax,%rcx
movslq -0x2060(%rbp),%rax
mov    %rcx,-0x2030(%rbp,%rax,8)
ff
mov    -0x2040(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2040(%rbp)
mov    -0x2060(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2060(%rbp)
jmp    15b9 <main+0x449>
movl   $0x0,-0x203c(%rbp)
movslq -0x203c(%rbp),%rax
movslq -0x2038(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
jae    16eb <main+0x57b>
lea    -0x2030(%rbp),%rsi
movslq -0x203c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x2038(%rbp),%rax
shl    $0x3,%rax
movslq -0x203c(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %eax,-0x2064(%rbp)
cmpl   $0xffffffff,-0x2064(%rbp)
jne    16d4 <main+0x564>
mov    0x292e(%rip),%rax
mov    (%rax),%rax
mov    0x2914(%rip),%rcx
cmp    (%rcx),%rax
jne    16ba <main+0x54a>
jmp    1637 <main+0x4c7>
lea    0x996(%rip),%rdi
call   1080 <perror@plt>
mov    0x28fb(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x2064(%rbp),%eax
add    -0x203c(%rbp),%eax
mov    %eax,-0x203c(%rbp)
jmp    1637 <main+0x4c7>
jmp    153f <main+0x3cf>
jmp    16f5 <main+0x585>
mov    -0x2040(%rbp),%eax
cmp    -0x2044(%rbp),%eax
jg     18c8 <main+0x758>
mov    -0x2044(%rbp),%eax
sub    -0x2040(%rbp),%eax
add    $0x1,%eax
cmp    $0x400,%eax
jge    173b <main+0x5cb>
mov    -0x2044(%rbp),%eax
sub    -0x2040(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2088(%rbp)
jmp    174b <main+0x5db>
mov    $0x400,%eax
mov    %eax,-0x2088(%rbp)
jmp    174b <main+0x5db>
mov    -0x2088(%rbp),%eax
mov    %eax,-0x2038(%rbp)
movl   $0x0,-0x2068(%rbp)
mov    -0x2068(%rbp),%eax
cmp    -0x2038(%rbp),%eax
jge    1805 <main+0x695>
mov    -0x2044(%rbp),%eax
sub    -0x2040(%rbp),%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x2054(%rbp),%xmm0
ff
divsd  %xmm0,%xmm1
movsd  0x881(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x2090(%rbp)
ff
movsd  -0x2050(%rbp),%xmm0
ff
cvtsi2sdl -0x2040(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x2090(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
call   1030 <lround@plt>
mov    %rax,%rcx
movslq -0x2068(%rbp),%rax
mov    %rcx,-0x2030(%rbp,%rax,8)
ff
mov    -0x2040(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2040(%rbp)
mov    -0x2068(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2068(%rbp)
jmp    1761 <main+0x5f1>
movl   $0x0,-0x203c(%rbp)
movslq -0x203c(%rbp),%rax
movslq -0x2038(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
jae    18c3 <main+0x753>
lea    -0x2030(%rbp),%rsi
movslq -0x203c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x2038(%rbp),%rax
shl    $0x3,%rax
movslq -0x203c(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %eax,-0x206c(%rbp)
cmpl   $0xffffffff,-0x206c(%rbp)
jne    18ac <main+0x73c>
mov    0x2756(%rip),%rax
mov    (%rax),%rax
mov    0x273c(%rip),%rcx
cmp    (%rcx),%rax
jne    1892 <main+0x722>
jmp    180f <main+0x69f>
lea    0x7be(%rip),%rdi
call   1080 <perror@plt>
mov    0x2723(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x206c(%rbp),%eax
add    -0x203c(%rbp),%eax
mov    %eax,-0x203c(%rbp)
jmp    180f <main+0x69f>
jmp    16f5 <main+0x585>
xor    %eax,%eax
add    $0x2090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2038,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    15c3 <main+0x453>
mov    0x8(%r14),%rdi
lea    0x30(%rsp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x30(%rsp),%rax
cmpb   $0x0,(%rax)
jne    15df <main+0x46f>
mov    0x10(%r14),%rdi
lea    0x30(%rsp),%rsi
xor    %r15d,%r15d
xor    %edx,%edx
call   1070 <strtol@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x30(%rsp),%rax
cmpb   $0x0,(%rax)
jne    15f1 <main+0x481>
movsd  0x8(%rsp),%xmm0
mulsd  0xe1a(%rip),%xmm0
mulsd  0xe1a(%rip),%xmm0
call   1030 <lround@plt>
mov    %rax,%rbx
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
divsd  0xdee(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xde8(%rip),%xmm0
call   1030 <lround@plt>
test   %eax,%eax
mov    %rbx,0x20(%rsp)
mov    %rax,0x28(%rsp)
jle    137d <main+0x20d>
test   %ebx,%ebx
js     137d <main+0x20d>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xor    %r15d,%r15d
movsd  0xdbf(%rip),%xmm2
mov    0x2d70(%rip),%r13
mov    0x2d59(%rip),%r14
movsd  %xmm1,0x10(%rsp)
nopl   (%rax)
mov    %ebx,%ecx
sub    %r15d,%ecx
cmp    $0x3ff,%ecx
mov    $0x3ff,%edx
cmovge %edx,%ecx
add    $0x1,%ecx
mov    %eax,%r12d
sub    %r15d,%r12d
cmp    %ecx,%r12d
cmovge %ecx,%r12d
test   %r12d,%r12d
jle    12fa <main+0x18a>
mov    %r12d,%ebx
mov    %r15d,%r13d
xor    %ebp,%ebp
lea    0x0(%r13,%rbp,1),%eax
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
movsd  0x18(%rsp),%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
call   1060 <sin@plt>
mulsd  0x8(%rsp),%xmm0
call   1030 <lround@plt>
movsd  0xd3c(%rip),%xmm2
movsd  0x10(%rsp),%xmm1
mov    %rax,0x30(%rsp,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12a0 <main+0x130>
add    %ebp,%r15d
mov    0x2cd6(%rip),%r13
test   %r12d,%r12d
je     1350 <main+0x1e0>
movslq %r12d,%rbx
shl    $0x3,%rbx
xor    %eax,%eax
xor    %ebp,%ebp
jmp    131a <main+0x1aa>
nopl   0x0(%rax)
add    %eax,%ebp
movslq %ebp,%rax
cmp    %rax,%rbx
jbe    1350 <main+0x1e0>
lea    (%rsp,%rax,8),%rsi
add    $0x30,%rsi
mov    %ebx,%edx
sub    %ebp,%edx
mov    $0x1,%edi
call   1040 <write@plt>
cmp    $0xffffffff,%eax
jne    1310 <main+0x1a0>
mov    0x0(%r13),%rax
cmp    (%r14),%rax
je     1312 <main+0x1a2>
jmp    15a9 <main+0x439>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x28(%rsp),%rax
cmp    %eax,%r15d
jge    1378 <main+0x208>
mov    0x20(%rsp),%rbx
cmp    %ebx,%r15d
movsd  0x10(%rsp),%xmm1
movsd  0xca8(%rip),%xmm2
jle    1270 <main+0x100>
jmp    137d <main+0x20d>
mov    0x20(%rsp),%rbx
mov    %ebx,%r13d
sub    %eax,%r13d
cmp    %r15d,%r13d
jle    146e <main+0x2fe>
mov    0x2c2d(%rip),%r12
mov    %r13d,0x8(%rsp)
jmp    13a9 <main+0x239>
nopw   0x0(%rax,%rax,1)
cmp    %r15d,%r13d
jle    146e <main+0x2fe>
mov    %r13d,%eax
sub    %r15d,%eax
cmp    $0x400,%eax
mov    $0x400,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    141a <main+0x2aa>
cmp    $0x2,%r14d
mov    $0x1,%ebx
cmovge %r14d,%ebx
mov    %r15d,%r13d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x0(%r13,%rbp,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0xc19(%rip),%xmm0
call   1030 <lround@plt>
mov    %rax,0x30(%rsp,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    13e0 <main+0x270>
add    %ebp,%r15d
mov    0x8(%rsp),%r13d
test   %r14d,%r14d
je     13a0 <main+0x230>
movslq %r14d,%rbx
shl    $0x3,%rbx
xor    %eax,%eax
xor    %ebp,%ebp
jmp    143e <main+0x2ce>
nopl   0x0(%rax)
add    %eax,%ebp
movslq %ebp,%rax
cmp    %rax,%rbx
jbe    13a0 <main+0x230>
lea    (%rsp,%rax,8),%rsi
add    $0x30,%rsi
mov    %ebx,%edx
sub    %ebp,%edx
mov    $0x1,%edi
call   1040 <write@plt>
cmp    $0xffffffff,%eax
jne    1430 <main+0x2c0>
mov    0x2b70(%rip),%rax
mov    (%rax),%rax
cmp    (%r12),%rax
je     1432 <main+0x2c2>
jmp    15a9 <main+0x439>
mov    0x20(%rsp),%r14
cmp    %r14d,%r15d
jle    148c <main+0x31c>
xor    %eax,%eax
add    $0x2038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xorps  %xmm0,%xmm0
cvtsi2sdl 0x28(%rsp),%xmm0
mov    0x2b34(%rip),%r12
movsd  0xb74(%rip),%xmm1
movsd  %xmm0,0x10(%rsp)
jmp    14c3 <main+0x353>
nopl   0x0(%rax)
cmp    %r14d,%r15d
movsd  0x10(%rsp),%xmm0
movsd  0xb57(%rip),%xmm1
jg     1478 <main+0x308>
mov    %r14d,%ebx
sub    %r15d,%ebx
cmp    $0x3ff,%ebx
mov    $0x3ff,%eax
cmovl  %ebx,%eax
lea    0x1(%rax),%r13d
test   %eax,%eax
js     1554 <main+0x3e4>
mov    %r13d,%ebp
mov    %r15d,%r14d
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
lea    (%r14,%r12,1),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
divsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x8(%rsp),%xmm0
call   1030 <lround@plt>
movsd  0xaea(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
mov    %rax,0x30(%rsp,%r12,8)
add    $0x1,%r12
add    $0xffffffff,%ebx
cmp    %r12,%rbp
jne    14f0 <main+0x380>
add    %r12d,%r15d
mov    0x20(%rsp),%r14
mov    0x2a7c(%rip),%r12
test   %r13d,%r13d
je     14b0 <main+0x340>
movslq %r13d,%rbx
shl    $0x3,%rbx
xor    %eax,%eax
xor    %ebp,%ebp
jmp    157e <main+0x40e>
nopw   0x0(%rax,%rax,1)
add    %eax,%ebp
movslq %ebp,%rax
cmp    %rax,%rbx
jbe    14b0 <main+0x340>
lea    (%rsp,%rax,8),%rsi
add    $0x30,%rsi
mov    %ebx,%edx
sub    %ebp,%edx
mov    $0x1,%edi
call   1040 <write@plt>
cmp    $0xffffffff,%eax
jne    1570 <main+0x400>
mov    (%r12),%rax
mov    0x2a1c(%rip),%rcx
cmp    (%rcx),%rax
je     1572 <main+0x402>
lea    0xaa7(%rip),%rdi
call   1080 <perror@plt>
mov    0x2a0c(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    0x2a0e(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xa4a(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    15b5 <main+0x445>
mov    0x29f2(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
mov    0x8(%r14),%rcx
jmp    1601 <main+0x491>
mov    0x29e0(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xa33(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    15b5 <main+0x445>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"%s: usage: tonegen ms freq\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"%s: incorrect argument: %s\0A\00"
@M_PI = global i32 0
@errno = global i64 0
@EINTR = global i64 0
@.str.2 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i8*
%10 = alloca [1024 x i8*]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 2.205000e+04, double* %8
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 3
br i1 %25, label %26, label %34
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call double @strtol(i8* %37, i8** %9, i32 0)
store double %38, double* %6
%39 = load i8*, i8** %9
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %34
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %47, i8* %50)
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %34
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call double @strtol(i8* %57, i8** %9, i32 0)
store double %58, double* %7
%59 = load i8*, i8** %9
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %74
63: ; preds = %54
%64 = load i32, i32* @stderr
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 0
%67 = load i8*, i8** %66
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %67, i8* %70)
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %54
store i32 1024, i32* %11
store i32 0, i32* %14
%75 = load double, double* %6
%76 = fmul double 1.000000e-03, %75
%77 = fmul double %76, 2.205000e+04
%78 = call i8* @lround(double %77)
%79 = ptrtoint i8* %78 to i32
store i32 %79, i32* %15
%80 = load i32, i32* @M_PI
%81 = mul nsw i32 2, %80
%82 = sitofp i32 %81 to double
%83 = load double, double* %7
%84 = fmul double %82, %83
%85 = fdiv double %84, 2.205000e+04
store double %85, double* %16
%86 = call i8* @lround(double 4.410000e+01)
%87 = ptrtoint i8* %86 to i32
store i32 %87, i32* %17
br label %88
88: ; preds = %187, %74
%89 = load i32, i32* %14
%90 = load i32, i32* %17
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %96
92: ; preds = %88
%93 = load i32, i32* %14
%94 = load i32, i32* %15
%95 = icmp sle i32 %93, %94
br label %96
96: ; preds = %92, %88
%97 = phi i1 [ false, %88 ], [ %95, %92 ]
br i1 %97, label %98, label %188
98: ; preds = %96
%99 = load i32, i32* %15
%100 = load i32, i32* %14
%101 = sub nsw i32 %99, %100
%102 = add nsw i32 %101, 1
%103 = icmp slt i32 %102, 1024
br i1 %103, label %104, label %109
104: ; preds = %98
%105 = load i32, i32* %15
%106 = load i32, i32* %14
%107 = sub nsw i32 %105, %106
%108 = add nsw i32 %107, 1
br label %110
109: ; preds = %98
br label %110
110: ; preds = %109, %104
%111 = phi i32 [ %108, %104 ], [ 1024, %109 ]
store i32 %111, i32* %12
%112 = load i32, i32* %17
%113 = load i32, i32* %14
%114 = sub nsw i32 %112, %113
%115 = load i32, i32* %12
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %121
117: ; preds = %110
%118 = load i32, i32* %17
%119 = load i32, i32* %14
%120 = sub nsw i32 %118, %119
br label %123
121: ; preds = %110
%122 = load i32, i32* %12
br label %123
123: ; preds = %121, %117
%124 = phi i32 [ %120, %117 ], [ %122, %121 ]
store i32 %124, i32* %12
store i32 0, i32* %18
br label %125
125: ; preds = %146, %123
%126 = load i32, i32* %18
%127 = load i32, i32* %12
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %151
129: ; preds = %125
%130 = load i32, i32* %14
%131 = sitofp i32 %130 to double
%132 = load i32, i32* %17
%133 = sitofp i32 %132 to double
%134 = fdiv double %131, %133
%135 = fmul double 2.400000e+04, %134
%136 = load double, double* %16
%137 = load i32, i32* %14
%138 = sitofp i32 %137 to double
%139 = fmul double %136, %138
%140 = call double @sin(double %139)
%141 = fmul double %135, %140
%142 = call i8* @lround(double %141)
%143 = load i32, i32* %18
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 %144
store i8* %142, i8** %145
br label %146
146: ; preds = %129
%147 = load i32, i32* %14
%148 = add nsw i32 %147, 1
store i32 %148, i32* %14
%149 = load i32, i32* %18
%150 = add nsw i32 %149, 1
store i32 %150, i32* %18
br label %125
151: ; preds = %125
store i32 0, i32* %13
br label %152
152: ; preds = %183, %178, %151
%153 = load i32, i32* %13
%154 = sext i32 %153 to i64
%155 = load i32, i32* %12
%156 = sext i32 %155 to i64
%157 = mul i64 %156, 8
%158 = icmp ult i64 %154, %157
br i1 %158, label %159, label %187
159: ; preds = %152
%160 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 0
%161 = load i32, i32* %13
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8*, i8** %160, i64 %162
%164 = load i32, i32* %12
%165 = sext i32 %164 to i64
%166 = mul i64 %165, 8
%167 = load i32, i32* %13
%168 = sext i32 %167 to i64
%169 = sub i64 %166, %168
%170 = trunc i64 %169 to i32
%171 = call i32 @write(i32 1, i8** %163, i32 %170)
store i32 %171, i32* %19
%172 = load i32, i32* %19
%173 = icmp eq i32 %172, -1
br i1 %173, label %174, label %183
174: ; preds = %159
%175 = load i64, i64* @errno
%176 = load i64, i64* @EINTR
%177 = icmp eq i64 %175, %176
br i1 %177, label %178, label %179
178: ; preds = %174
br label %152
179: ; preds = %174
%180 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%181 = load i32, i32* @EXIT_FAILURE
%182 = call i32 @exit(i32 %181)
unreachable
183: ; preds = %159
%184 = load i32, i32* %19
%185 = load i32, i32* %13
%186 = add nsw i32 %185, %184
store i32 %186, i32* %13
br label %152
187: ; preds = %152
br label %88
188: ; preds = %96
br label %189
189: ; preds = %267, %188
%190 = load i32, i32* %14
%191 = load i32, i32* %15
%192 = load i32, i32* %17
%193 = sub nsw i32 %191, %192
%194 = icmp slt i32 %190, %193
br i1 %194, label %195, label %268
195: ; preds = %189
%196 = load i32, i32* %15
%197 = load i32, i32* %17
%198 = sub nsw i32 %196, %197
%199 = load i32, i32* %14
%200 = sub nsw i32 %198, %199
%201 = icmp slt i32 %200, 1024
br i1 %201, label %202, label %208
202: ; preds = %195
%203 = load i32, i32* %15
%204 = load i32, i32* %17
%205 = sub nsw i32 %203, %204
%206 = load i32, i32* %14
%207 = sub nsw i32 %205, %206
br label %209
208: ; preds = %195
br label %209
209: ; preds = %208, %202
%210 = phi i32 [ %207, %202 ], [ 1024, %208 ]
store i32 %210, i32* %12
store i32 0, i32* %20
br label %211
211: ; preds = %226, %209
%212 = load i32, i32* %20
%213 = load i32, i32* %12
%214 = icmp slt i32 %212, %213
br i1 %214, label %215, label %231
215: ; preds = %211
%216 = load double, double* %16
%217 = load i32, i32* %14
%218 = sitofp i32 %217 to double
%219 = fmul double %216, %218
%220 = call double @sin(double %219)
%221 = fmul double 2.400000e+04, %220
%222 = call i8* @lround(double %221)
%223 = load i32, i32* %20
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 %224
store i8* %222, i8** %225
br label %226
226: ; preds = %215
%227 = load i32, i32* %14
%228 = add nsw i32 %227, 1
store i32 %228, i32* %14
%229 = load i32, i32* %20
%230 = add nsw i32 %229, 1
store i32 %230, i32* %20
br label %211
231: ; preds = %211
store i32 0, i32* %13
br label %232
232: ; preds = %263, %258, %231
%233 = load i32, i32* %13
%234 = sext i32 %233 to i64
%235 = load i32, i32* %12
%236 = sext i32 %235 to i64
%237 = mul i64 %236, 8
%238 = icmp ult i64 %234, %237
br i1 %238, label %239, label %267
239: ; preds = %232
%240 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 0
%241 = load i32, i32* %13
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds i8*, i8** %240, i64 %242
%244 = load i32, i32* %12
%245 = sext i32 %244 to i64
%246 = mul i64 %245, 8
%247 = load i32, i32* %13
%248 = sext i32 %247 to i64
%249 = sub i64 %246, %248
%250 = trunc i64 %249 to i32
%251 = call i32 @write(i32 1, i8** %243, i32 %250)
store i32 %251, i32* %21
%252 = load i32, i32* %21
%253 = icmp eq i32 %252, -1
br i1 %253, label %254, label %263
254: ; preds = %239
%255 = load i64, i64* @errno
%256 = load i64, i64* @EINTR
%257 = icmp eq i64 %255, %256
br i1 %257, label %258, label %259
258: ; preds = %254
br label %232
259: ; preds = %254
%260 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%261 = load i32, i32* @EXIT_FAILURE
%262 = call i32 @exit(i32 %261)
unreachable
263: ; preds = %239
%264 = load i32, i32* %21
%265 = load i32, i32* %13
%266 = add nsw i32 %265, %264
store i32 %266, i32* %13
br label %232
267: ; preds = %232
br label %189
268: ; preds = %189
br label %269
269: ; preds = %351, %268
%270 = load i32, i32* %14
%271 = load i32, i32* %15
%272 = icmp sle i32 %270, %271
br i1 %272, label %273, label %352
273: ; preds = %269
%274 = load i32, i32* %15
%275 = load i32, i32* %14
%276 = sub nsw i32 %274, %275
%277 = add nsw i32 %276, 1
%278 = icmp slt i32 %277, 1024
br i1 %278, label %279, label %284
279: ; preds = %273
%280 = load i32, i32* %15
%281 = load i32, i32* %14
%282 = sub nsw i32 %280, %281
%283 = add nsw i32 %282, 1
br label %285
284: ; preds = %273
br label %285
285: ; preds = %284, %279
%286 = phi i32 [ %283, %279 ], [ 1024, %284 ]
store i32 %286, i32* %12
store i32 0, i32* %22
br label %287
287: ; preds = %310, %285
%288 = load i32, i32* %22
%289 = load i32, i32* %12
%290 = icmp slt i32 %288, %289
br i1 %290, label %291, label %315
291: ; preds = %287
%292 = load i32, i32* %15
%293 = load i32, i32* %14
%294 = sub nsw i32 %292, %293
%295 = sitofp i32 %294 to double
%296 = load i32, i32* %17
%297 = sitofp i32 %296 to double
%298 = fdiv double %295, %297
%299 = fmul double 2.400000e+04, %298
%300 = load double, double* %16
%301 = load i32, i32* %14
%302 = sitofp i32 %301 to double
%303 = fmul double %300, %302
%304 = call double @sin(double %303)
%305 = fmul double %299, %304
%306 = call i8* @lround(double %305)
%307 = load i32, i32* %22
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 %308
store i8* %306, i8** %309
br label %310
310: ; preds = %291
%311 = load i32, i32* %14
%312 = add nsw i32 %311, 1
store i32 %312, i32* %14
%313 = load i32, i32* %22
%314 = add nsw i32 %313, 1
store i32 %314, i32* %22
br label %287
315: ; preds = %287
store i32 0, i32* %13
br label %316
316: ; preds = %347, %342, %315
%317 = load i32, i32* %13
%318 = sext i32 %317 to i64
%319 = load i32, i32* %12
%320 = sext i32 %319 to i64
%321 = mul i64 %320, 8
%322 = icmp ult i64 %318, %321
br i1 %322, label %323, label %351
323: ; preds = %316
%324 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %10, i64 0, i64 0
%325 = load i32, i32* %13
%326 = sext i32 %325 to i64
%327 = getelementptr inbounds i8*, i8** %324, i64 %326
%328 = load i32, i32* %12
%329 = sext i32 %328 to i64
%330 = mul i64 %329, 8
%331 = load i32, i32* %13
%332 = sext i32 %331 to i64
%333 = sub i64 %330, %332
%334 = trunc i64 %333 to i32
%335 = call i32 @write(i32 1, i8** %327, i32 %334)
store i32 %335, i32* %23
%336 = load i32, i32* %23
%337 = icmp eq i32 %336, -1
br i1 %337, label %338, label %347
338: ; preds = %323
%339 = load i64, i64* @errno
%340 = load i64, i64* @EINTR
%341 = icmp eq i64 %339, %340
br i1 %341, label %342, label %343
342: ; preds = %338
br label %316
343: ; preds = %338
%344 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%345 = load i32, i32* @EXIT_FAILURE
%346 = call i32 @exit(i32 %345)
unreachable
347: ; preds = %323
%348 = load i32, i32* %23
%349 = load i32, i32* %13
%350 = add nsw i32 %349, %348
store i32 %350, i32* %13
br label %316
351: ; preds = %316
br label %269
352: ; preds = %269
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%s: usage: tonegen ms freq\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"%s: incorrect argument: %s\0A\00"
@M_PI = global i32 0
@errno = global i64 0
@EINTR = global i64 0
@.str.2 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8*]
%5 = icmp eq i32 %0, 3
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = bitcast i8** %3 to i8*
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call double @strtol(i8* %15, i8** %3, i32 0)
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %12
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = load i8*, i8** %14
%24 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %12
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call double @strtol(i8* %29, i8** %3, i32 0)
%31 = load i8*, i8** %3
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %27
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %1
%37 = load i8*, i8** %28
%38 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = tail call i32 @exit(i32 %39)
unreachable
41: ; preds = %27
%42 = bitcast [1024 x i8*]* %4 to i8*
%43 = fmul double %16, 1.000000e-03
%44 = fmul double %43, 2.205000e+04
%45 = tail call i8* @lround(double %44)
%46 = ptrtoint i8* %45 to i64
%47 = trunc i64 %46 to i32
%48 = load i32, i32* @M_PI
%49 = shl nsw i32 %48, 1
%50 = sitofp i32 %49 to double
%51 = fmul double %30, %50
%52 = fdiv double %51, 2.205000e+04
%53 = tail call i8* @lround(double 4.410000e+01)
%54 = ptrtoint i8* %53 to i64
%55 = trunc i64 %54 to i32
%56 = icmp sgt i32 %55, 0
%57 = icmp sgt i32 %47, -1
%58 = select i1 %56, i1 %57, i1 false
br i1 %58, label %59, label %65
59: ; preds = %41
%60 = sitofp i32 %55 to double
br label %69
61: ; preds = %119, %81
%62 = icmp slt i32 %82, %55
%63 = icmp sle i32 %82, %47
%64 = select i1 %62, i1 %63, i1 false
br i1 %64, label %69, label %65
65: ; preds = %61, %41
%66 = phi i32 [ 0, %41 ], [ %82, %61 ]
%67 = sub nsw i32 %47, %55
%68 = icmp sgt i32 %67, %66
br i1 %68, label %130, label %125
69: ; preds = %59, %61
%70 = phi i32 [ 0, %59 ], [ %82, %61 ]
%71 = sub nsw i32 %47, %70
%72 = icmp slt i32 %71, 1023
%73 = select i1 %72, i32 %71, i32 1023
%74 = add nsw i32 %73, 1
%75 = sub nsw i32 %55, %70
%76 = icmp slt i32 %75, %74
%77 = select i1 %76, i32 %75, i32 %74
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %69
%80 = zext i32 %77 to i64
br label %88
81: ; preds = %88, %69
%82 = phi i32 [ %70, %69 ], [ %99, %88 ]
%83 = sext i32 %77 to i64
%84 = shl nsw i64 %83, 3
%85 = icmp eq i32 %77, 0
br i1 %85, label %61, label %86
86: ; preds = %81
%87 = trunc i64 %84 to i32
br label %102
88: ; preds = %79, %88
%89 = phi i64 [ 0, %79 ], [ %100, %88 ]
%90 = phi i32 [ %70, %79 ], [ %99, %88 ]
%91 = sitofp i32 %90 to double
%92 = fdiv double %91, %60
%93 = fmul double %92, 2.400000e+04
%94 = fmul double %52, %91
%95 = tail call double @sin(double %94)
%96 = fmul double %93, %95
%97 = tail call i8* @lround(double %96)
%98 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %89
store i8* %97, i8** %98
%99 = add nsw i32 %90, 1
%100 = add nuw nsw i64 %89, 1
%101 = icmp eq i64 %100, %80
br i1 %101, label %81, label %88
102: ; preds = %86, %119
%103 = phi i64 [ 0, %86 ], [ %121, %119 ]
%104 = phi i32 [ 0, %86 ], [ %120, %119 ]
%105 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %103
%106 = sub i32 %87, %104
%107 = call i32 @write(i32 1, i8** %105, i32 %106)
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %117
109: ; preds = %102
%110 = load i64, i64* @errno
%111 = load i64, i64* @EINTR
%112 = icmp eq i64 %110, %111
br i1 %112, label %119, label %113
113: ; preds = %109
%114 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%115 = load i32, i32* @EXIT_FAILURE
%116 = tail call i32 @exit(i32 %115)
unreachable
117: ; preds = %102
%118 = add nsw i32 %107, %104
br label %119
119: ; preds = %109, %117
%120 = phi i32 [ %118, %117 ], [ %104, %109 ]
%121 = sext i32 %120 to i64
%122 = icmp ugt i64 %84, %121
br i1 %122, label %102, label %61
123: ; preds = %175, %139
%124 = icmp sgt i32 %67, %140
br i1 %124, label %130, label %125
125: ; preds = %123, %65
%126 = phi i32 [ %66, %65 ], [ %140, %123 ]
%127 = icmp sgt i32 %126, %47
br i1 %127, label %234, label %128
128: ; preds = %125
%129 = sitofp i32 %55 to double
br label %181
130: ; preds = %65, %123
%131 = phi i32 [ %140, %123 ], [ %66, %65 ]
%132 = sub nsw i32 %67, %131
%133 = icmp slt i32 %132, 1024
%134 = select i1 %133, i32 %132, i32 1024
%135 = icmp sgt i32 %132, 0
br i1 %135, label %136, label %139
136: ; preds = %130
%137 = call i32 @llvm.smax.i32(i32 %134, i32 1)
%138 = zext i32 %137 to i64
br label %146
139: ; preds = %146, %130
%140 = phi i32 [ %131, %130 ], [ %155, %146 ]
%141 = sext i32 %134 to i64
%142 = shl nsw i64 %141, 3
%143 = icmp eq i32 %134, 0
br i1 %143, label %123, label %144
144: ; preds = %139
%145 = trunc i64 %142 to i32
br label %158
146: ; preds = %136, %146
%147 = phi i64 [ 0, %136 ], [ %156, %146 ]
%148 = phi i32 [ %131, %136 ], [ %155, %146 ]
%149 = sitofp i32 %148 to double
%150 = fmul double %52, %149
%151 = tail call double @sin(double %150)
%152 = fmul double %151, 2.400000e+04
%153 = tail call i8* @lround(double %152)
%154 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %147
store i8* %153, i8** %154
%155 = add nsw i32 %148, 1
%156 = add nuw nsw i64 %147, 1
%157 = icmp eq i64 %156, %138
br i1 %157, label %139, label %146
158: ; preds = %144, %175
%159 = phi i64 [ 0, %144 ], [ %177, %175 ]
%160 = phi i32 [ 0, %144 ], [ %176, %175 ]
%161 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %159
%162 = sub i32 %145, %160
%163 = call i32 @write(i32 1, i8** %161, i32 %162)
%164 = icmp eq i32 %163, -1
br i1 %164, label %165, label %173
165: ; preds = %158
%166 = load i64, i64* @errno
%167 = load i64, i64* @EINTR
%168 = icmp eq i64 %166, %167
br i1 %168, label %175, label %169
169: ; preds = %165
%170 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%171 = load i32, i32* @EXIT_FAILURE
%172 = tail call i32 @exit(i32 %171)
unreachable
173: ; preds = %158
%174 = add nsw i32 %163, %160
br label %175
175: ; preds = %165, %173
%176 = phi i32 [ %174, %173 ], [ %160, %165 ]
%177 = sext i32 %176 to i64
%178 = icmp ugt i64 %142, %177
br i1 %178, label %158, label %123
179: ; preds = %230, %190
%180 = icmp sgt i32 %191, %47
br i1 %180, label %234, label %181
181: ; preds = %128, %179
%182 = phi i32 [ %126, %128 ], [ %191, %179 ]
%183 = sub nsw i32 %47, %182
%184 = icmp slt i32 %183, 1023
%185 = select i1 %184, i32 %183, i32 1023
%186 = add nsw i32 %185, 1
%187 = icmp slt i32 %185, 0
br i1 %187, label %190, label %188
188: ; preds = %181
%189 = zext i32 %186 to i64
br label %197
190: ; preds = %197, %181
%191 = phi i32 [ %182, %181 ], [ %210, %197 ]
%192 = sext i32 %186 to i64
%193 = shl nsw i64 %192, 3
%194 = icmp eq i32 %186, 0
br i1 %194, label %179, label %195
195: ; preds = %190
%196 = trunc i64 %193 to i32
br label %213
197: ; preds = %188, %197
%198 = phi i64 [ 0, %188 ], [ %211, %197 ]
%199 = phi i32 [ %182, %188 ], [ %210, %197 ]
%200 = sub nsw i32 %47, %199
%201 = sitofp i32 %200 to double
%202 = fdiv double %201, %129
%203 = fmul double %202, 2.400000e+04
%204 = sitofp i32 %199 to double
%205 = fmul double %52, %204
%206 = tail call double @sin(double %205)
%207 = fmul double %203, %206
%208 = tail call i8* @lround(double %207)
%209 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %198
store i8* %208, i8** %209
%210 = add nsw i32 %199, 1
%211 = add nuw nsw i64 %198, 1
%212 = icmp eq i64 %211, %189
br i1 %212, label %190, label %197
213: ; preds = %195, %230
%214 = phi i64 [ 0, %195 ], [ %232, %230 ]
%215 = phi i32 [ 0, %195 ], [ %231, %230 ]
%216 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 %214
%217 = sub i32 %196, %215
%218 = call i32 @write(i32 1, i8** %216, i32 %217)
%219 = icmp eq i32 %218, -1
br i1 %219, label %220, label %228
220: ; preds = %213
%221 = load i64, i64* @errno
%222 = load i64, i64* @EINTR
%223 = icmp eq i64 %221, %222
br i1 %223, label %230, label %224
224: ; preds = %220
%225 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%226 = load i32, i32* @EXIT_FAILURE
%227 = tail call i32 @exit(i32 %226)
unreachable
228: ; preds = %213
%229 = add nsw i32 %218, %215
br label %230
230: ; preds = %220, %228
%231 = phi i32 [ %229, %228 ], [ %215, %220 ]
%232 = sext i32 %231 to i64
%233 = icmp ugt i64 %193, %232
br i1 %233, label %213, label %179
234: ; preds = %179, %125
ret i32 0
}