#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*/ FILE;

/* Variables and functions */
double cos(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stdout;
int mtos(char *filename1, char *filename2, float starttime, float endtime,
         float startpos) {
  FILE *fp1, *fp2;
  char valstr[400];
  int OK = 1, n;
  double gap, step, q;
  double leftmove, rightmove, cospos, leftpos, rightpos, thistime;
  if ((fp1 = fopen(filename1, "w")) == NULL) {
    fprintf(stdout, "ERROR: Cannot open file %s: spacedesign()\n", filename1);
    fflush(stdout);
    return -1;
  }
  if ((fp2 = fopen(filename2, "w")) == NULL) {
    fprintf(stdout, "ERROR: Cannot open file %s: spacedesign()\n", filename2);
    fclose(fp1);
    if (remove(filename1) < 0)
      fprintf(stdout, "ERROR: Can't remove file %s.\n", filename1);
    fflush(stdout);
    return -1;
  }
  while (OK) {
    sprintf(valstr, "0.0 %f\n", startpos);
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    if (fputs(valstr, fp2) < 0) {
      OK = 0;
      break;
    }
    if (starttime > 0.0) {
      sprintf(valstr, "%f %f\n", starttime, startpos);
      if (fputs(valstr, fp1) < 0) {
        OK = 0;
        break;
      }
      if (fputs(valstr, fp2) < 0) {
        OK = 0;
        break;
      }
    }
    gap = endtime - starttime;
    leftmove = -(1.0 + startpos);
    rightmove = 1.0 - startpos;
    step = gap / 8.0;
    thistime = starttime;
    for (n = 1; n < 8; n++) {
      thistime += step;
      q = (double)n / 8.0;
      cospos = cos(q * (3.141592654));
      cospos = (1 - cospos) / 2.0;
      cospos = (q + (2.0 * cospos)) / 3.0;
      leftpos = (cospos * leftmove) + startpos;
      rightpos = (cospos * rightmove) + startpos;
      sprintf(valstr, "%f %f\n", thistime, (float)leftpos);
      if (fputs(valstr, fp1) < 0) {
        OK = 0;
        break;
      }
      sprintf(valstr, "%f %f\n", thistime, (float)rightpos);
      if (fputs(valstr, fp2) < 0) {
        OK = 0;
        break;
      }
    }
    sprintf(valstr, "%f -1.0\n", endtime);
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    sprintf(valstr, "%f 1.0\n", endtime);
    if (fputs(valstr, fp2) < 0) {
      OK = 0;
      break;
    }
    sprintf(valstr, "10000 -1\n");
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    sprintf(valstr, "10000 1\n");
    if (fputs(valstr, fp2) < 0)
      OK = 0;
    break;
  }
  fclose(fp1);
  fclose(fp2);
  if (!OK) {
    if (remove(filename1) < 0)
      fprintf(stdout, "ERROR: Can't remove file %s.\n", filename1);
    if (remove(filename2) < 0)
      fprintf(stdout, "ERROR: Can't remove file %s.\n", filename2);
    fflush(stdout);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<mtos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
movss  %xmm2,-0x24(%rbp)
movl   $0x1,-0x1d4(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11fd <mtos+0x7d>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe4c(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    179e <mtos+0x61e>
mov    -0x18(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1283 <mtos+0x103>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdfb(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1269 <mtos+0xe9>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdf1(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    179e <mtos+0x61e>
jmp    1288 <mtos+0x108>
cmpl   $0x0,-0x1d4(%rbp)
je     1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc7(%rip),%rsi
mov    $0x1,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    12dc <mtos+0x15c>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    1305 <mtos+0x185>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1399 <mtos+0x219>
lea    -0x1d0(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd40(%rip),%rsi
mov    $0x2,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    136b <mtos+0x1eb>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    1394 <mtos+0x214>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
jmp    1399 <mtos+0x219>
movss  -0x20(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x1e0(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc48(%rip),%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc14(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
movsd  -0x1e0(%rbp),%xmm0
ff
movsd  0xbf0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1e8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x220(%rbp)
ff
movl   $0x1,-0x1d8(%rbp)
cmpl   $0x8,-0x1d8(%rbp)
jge    15fc <mtos+0x47c>
movsd  -0x1e8(%rbp),%xmm0
ff
addsd  -0x220(%rbp),%xmm0
ff
movsd  %xmm0,-0x220(%rbp)
ff
cvtsi2sdl -0x1d8(%rbp),%xmm0
ff
movsd  0xb94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1f0(%rbp)
ff
movsd  0xba0(%rip),%xmm0
mulsd  -0x1f0(%rbp),%xmm0
ff
call   1080 <cos@plt>
movsd  %xmm0,-0x208(%rbp)
ff
movsd  0xb6b(%rip),%xmm0
subsd  -0x208(%rbp),%xmm0
ff
movsd  0xb6b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  -0x1f0(%rbp),%xmm1
ff
movsd  -0x208(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb37(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  -0x208(%rbp),%xmm0
ff
movsd  -0x1f8(%rbp),%xmm2
ff
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
movsd  -0x208(%rbp),%xmm0
ff
movsd  -0x200(%rbp),%xmm2
ff
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x218(%rbp)
ff
lea    -0x1d0(%rbp),%rdi
movsd  -0x220(%rbp),%xmm0
ff
movsd  -0x210(%rbp),%xmm1
ff
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xb1e(%rip),%rsi
mov    $0x2,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    158d <mtos+0x40d>
movl   $0x0,-0x1d4(%rbp)
jmp    15fc <mtos+0x47c>
lea    -0x1d0(%rbp),%rdi
movsd  -0x220(%rbp),%xmm0
ff
movsd  -0x218(%rbp),%xmm1
ff
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xac8(%rip),%rsi
mov    $0x2,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    15e3 <mtos+0x463>
movl   $0x0,-0x1d4(%rbp)
jmp    15fc <mtos+0x47c>
jmp    15e8 <mtos+0x468>
mov    -0x1d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8(%rbp)
jmp    1437 <mtos+0x2b7>
lea    -0x1d0(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa6f(%rip),%rsi
mov    $0x1,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    1643 <mtos+0x4c3>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa31(%rip),%rsi
mov    $0x1,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    168a <mtos+0x50a>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
lea    0x9fb(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    16c8 <mtos+0x548>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
lea    -0x1d0(%rbp),%rdi
lea    0x9c7(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fputs@plt>
cmp    $0x0,%rax
jge    1701 <mtos+0x581>
movl   $0x0,-0x1d4(%rbp)
jmp    1706 <mtos+0x586>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x1d4(%rbp)
jne    1797 <mtos+0x617>
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1751 <mtos+0x5d1>
mov    0x28a1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0x909(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    177d <mtos+0x5fd>
mov    0x2875(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0x8dd(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x285c(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    179e <mtos+0x61e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
movss  %xmm2,(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %rsi,%r13
mov    %rdi,%r15
lea    0xe91(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     14d2 <mtos+0x352>
mov    %rax,%rbx
lea    0xe79(%rip),%rsi
mov    %r13,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     154d <mtos+0x3cd>
mov    %rax,%r12
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea0(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     14f4 <mtos+0x374>
lea    0x50(%rsp),%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     14f4 <mtos+0x374>
movss  0x8(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm2
jbe    128f <mtos+0x10f>
lea    0xe4d(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm1
mov    $0x2,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     14f4 <mtos+0x374>
lea    0x50(%rsp),%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
js     14f4 <mtos+0x374>
mov    %r13,0x20(%rsp)
mov    %r15,0x28(%rsp)
movss  0x14(%rsp),%xmm1
subss  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
movsd  0xd4c(%rip),%xmm3
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm4
addsd  %xmm3,%xmm4
xorpd  0xd66(%rip),%xmm4
movapd %xmm4,0x40(%rsp)
mulsd  0xd30(%rip),%xmm2
movsd  %xmm2,0x38(%rsp)
subsd  %xmm1,%xmm3
movsd  %xmm3,0x30(%rsp)
mov    $0x1,%r15d
lea    0xd9e(%rip),%r13
lea    0x50(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
addsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
mulsd  0xced(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0xce7(%rip),%xmm0
call   1080 <cos@plt>
movsd  0xcca(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xcd6(%rip),%xmm1
addsd  %xmm1,%xmm1
addsd  0x8(%rsp),%xmm1
divsd  0xccc(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  0x40(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %rbp,%rdi
mov    %r13,%rsi
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
mov    $0x1,%r14b
test   %rax,%rax
js     13ef <mtos+0x26f>
movsd  0x8(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %rbp,%rdi
mov    %r13,%rsi
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     13ef <mtos+0x26f>
add    $0x1,%r15d
cmp    $0x8,%r15d
movsd  (%rsp),%xmm0
jne    1300 <mtos+0x180>
xor    %r14d,%r14d
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc9a(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movsd  %xmm0,(%rsp)
mov    $0x1,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%r13
js     14f4 <mtos+0x374>
lea    0xc6a(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     14f4 <mtos+0x374>
movabs $0x312d203030303031,%rax
20 2d 31
mov    %rax,0x50(%rsp)
movw   $0xa,0x58(%rsp)
lea    0x50(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
js     14f4 <mtos+0x374>
movabs $0xa31203030303031,%rax
20 31 0a
mov    %rax,0x50(%rsp)
movb   $0x0,0x58(%rsp)
lea    0x50(%rsp),%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
test   %rax,%rax
sets   %al
or     %al,%r14b
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    $0x1,%ebx
test   %r14b,%r14b
jne    1504 <mtos+0x384>
jmp    15a0 <mtos+0x420>
mov    0x2b07(%rip),%rax
mov    (%rax),%edi
lea    0xb60(%rip),%rsi
mov    %r15,%rdx
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    1592 <mtos+0x412>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
test   %rax,%rax
jns    1529 <mtos+0x3a9>
mov    0x2ac8(%rip),%rax
mov    (%rax),%edi
lea    0xb4c(%rip),%rsi
mov    %r15,%rdx
call   1060 <fprintf@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
xor    %ebx,%ebx
test   %rax,%rax
jns    1592 <mtos+0x412>
mov    0x2aa1(%rip),%rax
mov    (%rax),%edi
lea    0xb25(%rip),%rsi
mov    %r13,%rdx
jmp    158d <mtos+0x40d>
mov    0x2a8c(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xae4(%rip),%rsi
mov    %r13,%rdx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jns    1592 <mtos+0x412>
mov    0x0(%rbp),%edi
lea    0xae3(%rip),%rsi
mov    %r15,%rdx
call   1060 <fprintf@plt>
mov    0x2a47(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    %ebx,%eax
add    $0x1e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.1 = [43 x i8] c"ERROR: Cannot open file %s: spacedesign()\0A\00"
@.str.2 = [30 x i8] c"ERROR: Can't remove file %s.\0A\00"
@.str.3 = [8 x i8] c"0.0 %f\0A\00"
@.str.4 = [7 x i8] c"%f %f\0A\00"
@.str.5 = [9 x i8] c"%f -1.0\0A\00"
@.str.6 = [8 x i8] c"%f 1.0\0A\00"
@.str.7 = [10 x i8] c"10000 -1\0A\00"
@.str.8 = [9 x i8] c"10000 1\0A\00"
define i32 @mtos(i8* %0, i8* %1, float %2, float %3, float %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca [400 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
store i8* %0, i8** %7
store i8* %1, i8** %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store i32 1, i32* %15
%26 = load i8*, i8** %7
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %12
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %35
29: ; preds = %5
%30 = load i32, i32* @stdout
%31 = load i8*, i8** %7
%32 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @stdout
%34 = call i32 @fflush(i32 %33)
store i32 -1, i32* %6
br label %235
35: ; preds = %5
%36 = load i8*, i8** %8
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %37, i32** %13
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %55
39: ; preds = %35
%40 = load i32, i32* @stdout
%41 = load i8*, i8** %8
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = load i32*, i32** %12
%44 = call i32 @fclose(i32* %43)
%45 = load i8*, i8** %7
%46 = call i64 @remove(i8* %45)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %39
%49 = load i32, i32* @stdout
%50 = load i8*, i8** %7
%51 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %48, %39
%53 = load i32, i32* @stdout
%54 = call i32 @fflush(i32 %53)
store i32 -1, i32* %6
br label %235
55: ; preds = %35
br label %56
56: ; preds = %55
%57 = load i32, i32* %15
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %208
59: ; preds = %56
%60 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%61 = load float, float* %11
%62 = fpext float %61 to double
%63 = call i32 (i8*, i8*, ...) @sprintf(i8* %60, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %62)
%64 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%65 = load i32*, i32** %12
%66 = call i64 @fputs(i8* %64, i32* %65)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %59
store i32 0, i32* %15
br label %208
69: ; preds = %59
%70 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%71 = load i32*, i32** %13
%72 = call i64 @fputs(i8* %70, i32* %71)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %69
store i32 0, i32* %15
br label %208
75: ; preds = %69
%76 = load float, float* %9
%77 = fpext float %76 to double
%78 = fcmp ogt double %77, 0.000000e+00
br i1 %78, label %79, label %98
79: ; preds = %75
%80 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%81 = load float, float* %9
%82 = fpext float %81 to double
%83 = load float, float* %11
%84 = fpext float %83 to double
%85 = call i32 (i8*, i8*, ...) @sprintf(i8* %80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %82, double %84)
%86 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%87 = load i32*, i32** %12
%88 = call i64 @fputs(i8* %86, i32* %87)
%89 = icmp slt i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %79
store i32 0, i32* %15
br label %208
91: ; preds = %79
%92 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%93 = load i32*, i32** %13
%94 = call i64 @fputs(i8* %92, i32* %93)
%95 = icmp slt i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %91
store i32 0, i32* %15
br label %208
97: ; preds = %91
br label %98
98: ; preds = %97, %75
%99 = load float, float* %10
%100 = load float, float* %9
%101 = fsub float %99, %100
%102 = fpext float %101 to double
store double %102, double* %17
%103 = load float, float* %11
%104 = fpext float %103 to double
%105 = fadd double 1.000000e+00, %104
%106 = fneg double %105
store double %106, double* %20
%107 = load float, float* %11
%108 = fpext float %107 to double
%109 = fsub double 1.000000e+00, %108
store double %109, double* %21
%110 = load double, double* %17
%111 = fdiv double %110, 8.000000e+00
store double %111, double* %18
%112 = load float, float* %9
%113 = fpext float %112 to double
store double %113, double* %25
store i32 1, i32* %16
br label %114
114: ; preds = %168, %98
%115 = load i32, i32* %16
%116 = icmp slt i32 %115, 8
br i1 %116, label %117, label %171
117: ; preds = %114
%118 = load double, double* %18
%119 = load double, double* %25
%120 = fadd double %119, %118
store double %120, double* %25
%121 = load i32, i32* %16
%122 = sitofp i32 %121 to double
%123 = fdiv double %122, 8.000000e+00
store double %123, double* %19
%124 = load double, double* %19
%125 = fmul double %124, 0x400921FB54524550
%126 = call double @cos(double %125)
store double %126, double* %22
%127 = load double, double* %22
%128 = fsub double 1.000000e+00, %127
%129 = fdiv double %128, 2.000000e+00
store double %129, double* %22
%130 = load double, double* %19
%131 = load double, double* %22
%132 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %131, double %130)
%133 = fdiv double %132, 3.000000e+00
store double %133, double* %22
%134 = load double, double* %22
%135 = load double, double* %20
%136 = load float, float* %11
%137 = fpext float %136 to double
%138 = call double @llvm.fmuladd.f64(double %134, double %135, double %137)
store double %138, double* %23
%139 = load double, double* %22
%140 = load double, double* %21
%141 = load float, float* %11
%142 = fpext float %141 to double
%143 = call double @llvm.fmuladd.f64(double %139, double %140, double %142)
store double %143, double* %24
%144 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%145 = load double, double* %25
%146 = load double, double* %23
%147 = fptrunc double %146 to float
%148 = fpext float %147 to double
%149 = call i32 (i8*, i8*, ...) @sprintf(i8* %144, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %145, double %148)
%150 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%151 = load i32*, i32** %12
%152 = call i64 @fputs(i8* %150, i32* %151)
%153 = icmp slt i64 %152, 0
br i1 %153, label %154, label %155
154: ; preds = %117
store i32 0, i32* %15
br label %171
155: ; preds = %117
%156 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%157 = load double, double* %25
%158 = load double, double* %24
%159 = fptrunc double %158 to float
%160 = fpext float %159 to double
%161 = call i32 (i8*, i8*, ...) @sprintf(i8* %156, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %157, double %160)
%162 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%163 = load i32*, i32** %13
%164 = call i64 @fputs(i8* %162, i32* %163)
%165 = icmp slt i64 %164, 0
br i1 %165, label %166, label %167
166: ; preds = %155
store i32 0, i32* %15
br label %171
167: ; preds = %155
br label %168
168: ; preds = %167
%169 = load i32, i32* %16
%170 = add nsw i32 %169, 1
store i32 %170, i32* %16
br label %114
171: ; preds = %166, %154, %114
%172 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%173 = load float, float* %10
%174 = fpext float %173 to double
%175 = call i32 (i8*, i8*, ...) @sprintf(i8* %172, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %174)
%176 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%177 = load i32*, i32** %12
%178 = call i64 @fputs(i8* %176, i32* %177)
%179 = icmp slt i64 %178, 0
br i1 %179, label %180, label %181
180: ; preds = %171
store i32 0, i32* %15
br label %208
181: ; preds = %171
%182 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%183 = load float, float* %10
%184 = fpext float %183 to double
%185 = call i32 (i8*, i8*, ...) @sprintf(i8* %182, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %184)
%186 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%187 = load i32*, i32** %13
%188 = call i64 @fputs(i8* %186, i32* %187)
%189 = icmp slt i64 %188, 0
br i1 %189, label %190, label %191
190: ; preds = %181
store i32 0, i32* %15
br label %208
191: ; preds = %181
%192 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%193 = call i32 (i8*, i8*, ...) @sprintf(i8* %192, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%194 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%195 = load i32*, i32** %12
%196 = call i64 @fputs(i8* %194, i32* %195)
%197 = icmp slt i64 %196, 0
br i1 %197, label %198, label %199
198: ; preds = %191
store i32 0, i32* %15
br label %208
199: ; preds = %191
%200 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%201 = call i32 (i8*, i8*, ...) @sprintf(i8* %200, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%202 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%203 = load i32*, i32** %13
%204 = call i64 @fputs(i8* %202, i32* %203)
%205 = icmp slt i64 %204, 0
br i1 %205, label %206, label %207
206: ; preds = %199
store i32 0, i32* %15
br label %207
207: ; preds = %206, %199
br label %208
208: ; preds = %207, %198, %190, %180, %96, %90, %74, %68, %56
%209 = load i32*, i32** %12
%210 = call i32 @fclose(i32* %209)
%211 = load i32*, i32** %13
%212 = call i32 @fclose(i32* %211)
%213 = load i32, i32* %15
%214 = icmp ne i32 %213, 0
br i1 %214, label %234, label %215
215: ; preds = %208
%216 = load i8*, i8** %7
%217 = call i64 @remove(i8* %216)
%218 = icmp slt i64 %217, 0
br i1 %218, label %219, label %223
219: ; preds = %215
%220 = load i32, i32* @stdout
%221 = load i8*, i8** %7
%222 = call i32 @fprintf(i32 %220, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %221)
br label %223
223: ; preds = %219, %215
%224 = load i8*, i8** %8
%225 = call i64 @remove(i8* %224)
%226 = icmp slt i64 %225, 0
br i1 %226, label %227, label %231
227: ; preds = %223
%228 = load i32, i32* @stdout
%229 = load i8*, i8** %8
%230 = call i32 @fprintf(i32 %228, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %229)
br label %231
231: ; preds = %227, %223
%232 = load i32, i32* @stdout
%233 = call i32 @fflush(i32 %232)
store i32 0, i32* %6
br label %235
234: ; preds = %208
store i32 1, i32* %6
br label %235
235: ; preds = %234, %231, %52, %29
%236 = load i32, i32* %6
ret i32 %236
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.1 = [43 x i8] c"ERROR: Cannot open file %s: spacedesign()\0A\00"
@.str.2 = [30 x i8] c"ERROR: Can't remove file %s.\0A\00"
@.str.3 = [8 x i8] c"0.0 %f\0A\00"
@.str.4 = [7 x i8] c"%f %f\0A\00"
@.str.5 = [9 x i8] c"%f -1.0\0A\00"
@.str.6 = [8 x i8] c"%f 1.0\0A\00"
@.str.7 = [10 x i8] c"10000 -1\0A\00"
@.str.8 = [9 x i8] c"10000 1\0A\00"
define i32 @mtos(i8* %0, i8* %1, float %2, float %3, float %4) {
%6 = alloca [400 x i8]
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i32, i32* @stdout
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %112
13: ; preds = %5
%14 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* @stdout
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%19 = tail call i32 @fclose(i32* %8)
%20 = tail call i64 @remove(i8* %0)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %112
22: ; preds = %16
%23 = load i32, i32* @stdout
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %112
25: ; preds = %13
%26 = fpext float %4 to double
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %26)
%28 = call i64 @fputs(i8* %7, i32* %8)
%29 = icmp slt i64 %28, 0
br i1 %29, label %97, label %30
30: ; preds = %25
%31 = call i64 @fputs(i8* %7, i32* %14)
%32 = icmp slt i64 %31, 0
br i1 %32, label %97, label %33
33: ; preds = %30
%34 = fpext float %2 to double
%35 = fcmp ogt float %2, 0.000000e+00
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %34, double %26)
%38 = call i64 @fputs(i8* %7, i32* %8)
%39 = icmp slt i64 %38, 0
br i1 %39, label %97, label %40
40: ; preds = %36
%41 = call i64 @fputs(i8* %7, i32* %14)
%42 = icmp slt i64 %41, 0
br i1 %42, label %97, label %43
43: ; preds = %40, %33
%44 = fsub float %3, %2
%45 = fpext float %44 to double
%46 = fadd double %26, 1.000000e+00
%47 = fneg double %46
%48 = fsub double 1.000000e+00, %26
%49 = fmul double %45, 1.250000e-01
br label %53
50: ; preds = %71
%51 = add nuw nsw i32 %55, 1
%52 = icmp eq i32 %51, 8
br i1 %52, label %78, label %53
53: ; preds = %43, %50
%54 = phi double [ %34, %43 ], [ %56, %50 ]
%55 = phi i32 [ 1, %43 ], [ %51, %50 ]
%56 = fadd double %49, %54
%57 = sitofp i32 %55 to double
%58 = fmul double %57, 1.250000e-01
%59 = fmul double %58, 0x400921FB54524550
%60 = tail call double @cos(double %59)
%61 = fsub double 1.000000e+00, %60
%62 = fmul double %61, 5.000000e-01
%63 = tail call double @llvm.fmuladd.f64(double %62, double 2.000000e+00, double %58)
%64 = fdiv double %63, 3.000000e+00
%65 = tail call double @llvm.fmuladd.f64(double %64, double %47, double %26)
%66 = fptrunc double %65 to float
%67 = fpext float %66 to double
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %56, double %67)
%69 = call i64 @fputs(i8* %7, i32* %8)
%70 = icmp slt i64 %69, 0
br i1 %70, label %78, label %71
71: ; preds = %53
%72 = tail call double @llvm.fmuladd.f64(double %64, double %48, double %26)
%73 = fptrunc double %72 to float
%74 = fpext float %73 to double
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %56, double %74)
%76 = call i64 @fputs(i8* %7, i32* %14)
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %50
78: ; preds = %71, %53, %50
%79 = phi i1 [ true, %71 ], [ true, %53 ], [ false, %50 ]
%80 = fpext float %3 to double
%81 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %80)
%82 = call i64 @fputs(i8* %7, i32* %8)
%83 = icmp slt i64 %82, 0
br i1 %83, label %97, label %84
84: ; preds = %78
%85 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %80)
%86 = call i64 @fputs(i8* %7, i32* %14)
%87 = icmp slt i64 %86, 0
br i1 %87, label %97, label %88
88: ; preds = %84
%89 = call i64 @fputs(i8* %7, i32* %8)
%90 = icmp slt i64 %89, 0
br i1 %90, label %97, label %91
91: ; preds = %88
%92 = call i64 @fputs(i8* %7, i32* %14)
%93 = icmp slt i64 %92, 0
%94 = or i1 %79, %93
%95 = tail call i32 @fclose(i32* %8)
%96 = tail call i32 @fclose(i32* %14)
br i1 %94, label %100, label %116
97: ; preds = %88, %84, %78, %40, %36, %30, %25
%98 = tail call i32 @fclose(i32* %8)
%99 = tail call i32 @fclose(i32* %14)
br label %100
100: ; preds = %97, %91
%101 = tail call i64 @remove(i8* %0)
%102 = icmp slt i64 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %100
%104 = load i32, i32* @stdout
%105 = tail call i32 @fprintf(i32 %104, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %106
106: ; preds = %103, %100
%107 = tail call i64 @remove(i8* %1)
%108 = icmp slt i64 %107, 0
br i1 %108, label %109, label %112
109: ; preds = %106
%110 = load i32, i32* @stdout
%111 = tail call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %112
112: ; preds = %106, %109, %16, %22, %10
%113 = phi i32 [ -1, %10 ], [ -1, %22 ], [ -1, %16 ], [ 0, %109 ], [ 0, %106 ]
%114 = load i32, i32* @stdout
%115 = tail call i32 @fflush(i32 %114)
br label %116
116: ; preds = %112, %91
%117 = phi i32 [ 1, %91 ], [ %113, %112 ]
ret i32 %117
}