#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 *, float, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int stom(char *filename1, char *filename2, float starttime, float endtime,
         float endpos) {
  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) {
    strcpy(valstr, "0.0 -1.0\n");
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    strcpy(valstr, "0.0 1.0\n");
    if (fputs(valstr, fp2) < 0) {
      OK = 0;
      break;
    }
    if (starttime > 0.0) {
      sprintf(valstr, "%f", starttime);
      strcat(valstr, " -1.0\n");
      if (fputs(valstr, fp1) < 0) {
        OK = 0;
        break;
      }
      sprintf(valstr, "%f", starttime);
      strcat(valstr, " 1.0\n");
      if (fputs(valstr, fp2) < 0) {
        OK = 0;
        break;
      }
    }
    gap = endtime - starttime;
    leftmove = endpos + 1.0;
    rightmove = endpos - 1.0;
    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) - 1.0;
      rightpos = (cospos * rightmove) + 1.0;
      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;
      }
    }
    if (!OK)
      break;
    sprintf(valstr, "%f %f\n", endtime, endpos);
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    if (fputs(valstr, fp2) < 0) {
      OK = 0;
      break;
    }
    sprintf(valstr, "10000 %f\n", endpos);
    if (fputs(valstr, fp1) < 0) {
      OK = 0;
      break;
    }
    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):
<stom>:
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    0xe59(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    121d <stom+0x7d>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe34(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17d1 <stom+0x631>
mov    -0x18(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12a3 <stom+0x103>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xde3(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1289 <stom+0xe9>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdd9(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17d1 <stom+0x631>
jmp    12a8 <stom+0x108>
cmpl   $0x0,-0x1d4(%rbp)
je     1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
lea    0xdb8(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    12f1 <stom+0x151>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
lea    0xd86(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    132d <stom+0x18d>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13f4 <stom+0x254>
lea    -0x1d0(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
lea    0xd38(%rip),%rsi
mov    $0x1,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
lea    0xd13(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    1399 <stom+0x1f9>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
lea    0xce2(%rip),%rsi
mov    $0x1,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
lea    0xcc7(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    13ef <stom+0x24f>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
jmp    13f4 <stom+0x254>
movss  -0x20(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x1e0(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbed(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbd0(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
movsd  -0x1e0(%rbp),%xmm0
ff
movsd  0xbac(%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    1646 <stom+0x4a6>
movsd  -0x1e8(%rbp),%xmm0
ff
addsd  -0x220(%rbp),%xmm0
ff
movsd  %xmm0,-0x220(%rbp)
ff
cvtsi2sdl -0x1d8(%rbp),%xmm0
ff
movsd  0xb50(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1f0(%rbp)
ff
movsd  0xb64(%rip),%xmm0
mulsd  -0x1f0(%rbp),%xmm0
ff
call   1090 <cos@plt>
movsd  %xmm0,-0x208(%rbp)
ff
movsd  0xb27(%rip),%xmm0
subsd  -0x208(%rbp),%xmm0
ff
movsd  0xb2f(%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  0xafb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  -0x208(%rbp),%xmm0
ff
movsd  -0x1f8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0xacb(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
movsd  -0x208(%rbp),%xmm0
ff
movsd  -0x200(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0xa9b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x218(%rbp)
ff
lea    -0x1d0(%rbp),%rdi
movsd  -0x220(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
movsd  -0x210(%rbp),%xmm1
ff
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xaee(%rip),%rsi
mov    $0x2,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    15d3 <stom+0x433>
movl   $0x0,-0x1d4(%rbp)
jmp    1646 <stom+0x4a6>
lea    -0x1d0(%rbp),%rdi
movsd  -0x220(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
movsd  -0x218(%rbp),%xmm1
ff
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xa94(%rip),%rsi
mov    $0x2,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    162d <stom+0x48d>
movl   $0x0,-0x1d4(%rbp)
jmp    1646 <stom+0x4a6>
jmp    1632 <stom+0x492>
mov    -0x1d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d8(%rbp)
jmp    147b <stom+0x2db>
cmpl   $0x0,-0x1d4(%rbp)
jne    1658 <stom+0x4b8>
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xa1d(%rip),%rsi
mov    $0x2,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    16a4 <stom+0x504>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    16cd <stom+0x52d>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
lea    0x9b8(%rip),%rsi
mov    $0x1,%al
call   10c0 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    1710 <stom+0x570>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
lea    -0x1d0(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    1734 <stom+0x594>
movl   $0x0,-0x1d4(%rbp)
jmp    1739 <stom+0x599>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x0,-0x1d4(%rbp)
jne    17ca <stom+0x62a>
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1784 <stom+0x5e4>
mov    0x286e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0x8de(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    17b0 <stom+0x610>
mov    0x2842(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0x8b2(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2829(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
movl   $0x0,-0x4(%rbp)
jmp    17d1 <stom+0x631>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stom>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %rsi,%rbp
mov    %rdi,%r15
lea    0xe60(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     156d <stom+0x3cd>
mov    %rax,%rbx
lea    0xe48(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1589 <stom+0x3e9>
mov    %rax,%r12
mov    %rbp,0x30(%rsp)
lea    0xe73(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
lea    0xe55(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
xorps  %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    12dd <stom+0x13d>
lea    0xe28(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movss  0x8(%rsp),%xmm0
mov    $0x1,%al
call   10c0 <sprintf@plt>
lea    0xdfc(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcat@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
lea    0xde9(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movss  0x8(%rsp),%xmm0
mov    $0x1,%al
call   10c0 <sprintf@plt>
lea    0xdc7(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcat@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x14(%rsp),%xmm0
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xced(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rsp)
movsd  0xce3(%rip),%xmm2
movsd  %xmm0,0x28(%rsp)
addsd  %xmm0,%xmm2
movsd  %xmm2,0x38(%rsp)
mulsd  0xcd3(%rip),%xmm1
movsd  %xmm1,0x48(%rsp)
mov    $0x1,%r14d
lea    0xd41(%rip),%r13
lea    0x50(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x18(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  0xc8e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0xc88(%rip),%xmm0
call   1090 <cos@plt>
movsd  0xc63(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xc77(%rip),%xmm1
addsd  %xmm1,%xmm1
addsd  0x8(%rsp),%xmm1
divsd  0xc6d(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0x40(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
addsd  0xc2f(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbp,%rdi
mov    %r13,%rsi
movss  %xmm0,0x24(%rsp)
mov    $0x2,%al
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
movsd  0x8(%rsp),%xmm0
mulsd  0x38(%rsp),%xmm0
addsd  0xbe4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %rbp,%rdi
mov    %r13,%rsi
movss  0x24(%rsp),%xmm0
mov    $0x2,%al
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
add    $0x1,%r14d
cmp    $0x8,%r14d
jne    1360 <stom+0x1c0>
lea    0xc2e(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movss  0x14(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    $0x2,%al
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
lea    0x50(%rsp),%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
lea    0xbf1(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
movss  0x10(%rsp),%xmm0
mov    $0x1,%al
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
js     14fc <stom+0x35c>
lea    0x50(%rsp),%rdi
mov    %r12,%rsi
call   1060 <fputs@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    $0x1,%eax
test   %rbp,%rbp
jns    15d6 <stom+0x436>
jmp    150c <stom+0x36c>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
test   %rax,%rax
jns    1531 <stom+0x391>
mov    0x2ac0(%rip),%rax
mov    (%rax),%edi
lea    0xb34(%rip),%rsi
mov    %r15,%rdx
call   1070 <fprintf@plt>
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <remove@plt>
test   %rax,%rax
jns    155b <stom+0x3bb>
mov    0x2a96(%rip),%rax
mov    (%rax),%edi
lea    0xb0a(%rip),%rsi
mov    %rbx,%rdx
call   1070 <fprintf@plt>
mov    0x2a7e(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
xor    %eax,%eax
jmp    15d6 <stom+0x436>
mov    0x2a6c(%rip),%rbx
mov    (%rbx),%edi
lea    0xab5(%rip),%rsi
mov    %r15,%rdx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
jmp    15cc <stom+0x42c>
mov    0x2a50(%rip),%r14
mov    (%r14),%edi
lea    0xa98(%rip),%rsi
mov    %rbp,%rdx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
test   %rax,%rax
jns    15c9 <stom+0x429>
mov    (%r14),%edi
lea    0xa9c(%rip),%rsi
mov    %r15,%rdx
call   1070 <fprintf@plt>
mov    (%r14),%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%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 = [10 x i8] c"0.0 -1.0\0A\00"
@.str.4 = [9 x i8] c"0.0 1.0\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [7 x i8] c" -1.0\0A\00"
@.str.7 = [6 x i8] c" 1.0\0A\00"
@.str.8 = [7 x i8] c"%f %f\0A\00"
@.str.9 = [10 x i8] c"10000 %f\0A\00"
define i32 @stom(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 %236
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 %236
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 %209
59: ; preds = %56
%60 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%61 = call i32 @strcpy(i8* %60, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%62 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%63 = load i32*, i32** %12
%64 = call i64 @fputs(i8* %62, i32* %63)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %59
store i32 0, i32* %15
br label %209
67: ; preds = %59
%68 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%69 = call i32 @strcpy(i8* %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%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 = %67
store i32 0, i32* %15
br label %209
75: ; preds = %67
%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 %102
79: ; preds = %75
%80 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%81 = load float, float* %9
%82 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float %81)
%83 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%84 = call i32 @strcat(i8* %83, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%85 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%86 = load i32*, i32** %12
%87 = call i64 @fputs(i8* %85, i32* %86)
%88 = icmp slt i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %79
store i32 0, i32* %15
br label %209
90: ; preds = %79
%91 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%92 = load float, float* %9
%93 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float %92)
%94 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%95 = call i32 @strcat(i8* %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%96 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%97 = load i32*, i32** %13
%98 = call i64 @fputs(i8* %96, i32* %97)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %90
store i32 0, i32* %15
br label %209
101: ; preds = %90
br label %102
102: ; preds = %101, %75
%103 = load float, float* %10
%104 = load float, float* %9
%105 = fsub float %103, %104
%106 = fpext float %105 to double
store double %106, double* %17
%107 = load float, float* %11
%108 = fpext float %107 to double
%109 = fadd double %108, 1.000000e+00
store double %109, double* %20
%110 = load float, float* %11
%111 = fpext float %110 to double
%112 = fsub double %111, 1.000000e+00
store double %112, double* %21
%113 = load double, double* %17
%114 = fdiv double %113, 8.000000e+00
store double %114, double* %18
%115 = load float, float* %9
%116 = fpext float %115 to double
store double %116, double* %25
store i32 1, i32* %16
br label %117
117: ; preds = %169, %102
%118 = load i32, i32* %16
%119 = icmp slt i32 %118, 8
br i1 %119, label %120, label %172
120: ; preds = %117
%121 = load double, double* %18
%122 = load double, double* %25
%123 = fadd double %122, %121
store double %123, double* %25
%124 = load i32, i32* %16
%125 = sitofp i32 %124 to double
%126 = fdiv double %125, 8.000000e+00
store double %126, double* %19
%127 = load double, double* %19
%128 = fmul double %127, 0x400921FB54524550
%129 = call double @cos(double %128)
store double %129, double* %22
%130 = load double, double* %22
%131 = fsub double 1.000000e+00, %130
%132 = fdiv double %131, 2.000000e+00
store double %132, double* %22
%133 = load double, double* %19
%134 = load double, double* %22
%135 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %134, double %133)
%136 = fdiv double %135, 3.000000e+00
store double %136, double* %22
%137 = load double, double* %22
%138 = load double, double* %20
%139 = call double @llvm.fmuladd.f64(double %137, double %138, double -1.000000e+00)
store double %139, double* %23
%140 = load double, double* %22
%141 = load double, double* %21
%142 = call double @llvm.fmuladd.f64(double %140, double %141, double 1.000000e+00)
store double %142, double* %24
%143 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%144 = load double, double* %25
%145 = fptrunc double %144 to float
%146 = load double, double* %23
%147 = fptrunc double %146 to float
%148 = fpext float %147 to double
%149 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %143, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), float %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 = %120
store i32 0, i32* %15
br label %172
155: ; preds = %120
%156 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%157 = load double, double* %25
%158 = fptrunc double %157 to float
%159 = load double, double* %24
%160 = fptrunc double %159 to float
%161 = fpext float %160 to double
%162 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %156, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), float %158, double %161)
%163 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%164 = load i32*, i32** %13
%165 = call i64 @fputs(i8* %163, i32* %164)
%166 = icmp slt i64 %165, 0
br i1 %166, label %167, label %168
167: ; preds = %155
store i32 0, i32* %15
br label %172
168: ; preds = %155
br label %169
169: ; preds = %168
%170 = load i32, i32* %16
%171 = add nsw i32 %170, 1
store i32 %171, i32* %16
br label %117
172: ; preds = %167, %154, %117
%173 = load i32, i32* %15
%174 = icmp ne i32 %173, 0
br i1 %174, label %176, label %175
175: ; preds = %172
br label %209
176: ; preds = %172
%177 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%178 = load float, float* %10
%179 = load float, float* %11
%180 = fpext float %179 to double
%181 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %177, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), float %178, double %180)
%182 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%183 = load i32*, i32** %12
%184 = call i64 @fputs(i8* %182, i32* %183)
%185 = icmp slt i64 %184, 0
br i1 %185, label %186, label %187
186: ; preds = %176
store i32 0, i32* %15
br label %209
187: ; preds = %176
%188 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%189 = load i32*, i32** %13
%190 = call i64 @fputs(i8* %188, i32* %189)
%191 = icmp slt i64 %190, 0
br i1 %191, label %192, label %193
192: ; preds = %187
store i32 0, i32* %15
br label %209
193: ; preds = %187
%194 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%195 = load float, float* %11
%196 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %194, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), float %195)
%197 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%198 = load i32*, i32** %12
%199 = call i64 @fputs(i8* %197, i32* %198)
%200 = icmp slt i64 %199, 0
br i1 %200, label %201, label %202
201: ; preds = %193
store i32 0, i32* %15
br label %209
202: ; preds = %193
%203 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%204 = load i32*, i32** %13
%205 = call i64 @fputs(i8* %203, i32* %204)
%206 = icmp slt i64 %205, 0
br i1 %206, label %207, label %208
207: ; preds = %202
store i32 0, i32* %15
br label %208
208: ; preds = %207, %202
br label %209
209: ; preds = %208, %201, %192, %186, %175, %100, %89, %74, %66, %56
%210 = load i32*, i32** %12
%211 = call i32 @fclose(i32* %210)
%212 = load i32*, i32** %13
%213 = call i32 @fclose(i32* %212)
%214 = load i32, i32* %15
%215 = icmp ne i32 %214, 0
br i1 %215, label %235, label %216
216: ; preds = %209
%217 = load i8*, i8** %7
%218 = call i64 @remove(i8* %217)
%219 = icmp slt i64 %218, 0
br i1 %219, label %220, label %224
220: ; preds = %216
%221 = load i32, i32* @stdout
%222 = load i8*, i8** %7
%223 = call i32 @fprintf(i32 %221, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %222)
br label %224
224: ; preds = %220, %216
%225 = load i8*, i8** %8
%226 = call i64 @remove(i8* %225)
%227 = icmp slt i64 %226, 0
br i1 %227, label %228, label %232
228: ; preds = %224
%229 = load i32, i32* @stdout
%230 = load i8*, i8** %8
%231 = call i32 @fprintf(i32 %229, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %230)
br label %232
232: ; preds = %228, %224
%233 = load i32, i32* @stdout
%234 = call i32 @fflush(i32 %233)
store i32 0, i32* %6
br label %236
235: ; preds = %209
store i32 1, i32* %6
br label %236
236: ; preds = %235, %232, %52, %29
%237 = load i32, i32* %6
ret i32 %237
}

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