#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 time_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ asprintf(char **, char *, double, double);
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ ftruncate(int, int);
unsigned char *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
                    int /*<<< orphan*/);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, unsigned char *, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int strlen(char *);
double strtod(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ system(char *);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ write(int, char *, int);
int main(int argc, char **argv) {
  if (argc != 11) {
    fprintf(stderr,
            "wrong invocation: want width, height, minphi1, maxphi1, minphi2, "
            "maxphi2, binoutpath, csvoutpath, starti, nofi!\n");
    exit(1);
  }
  int width = atoi(argv[1]);
  int height = atoi(argv[2]);
  double minphi1 = strtod(argv[3], NULL);
  double maxphi1 = strtod(argv[4], NULL);
  double minphi2 = strtod(argv[5], NULL);
  double maxphi2 = strtod(argv[6], NULL);
  char *outpath = argv[7];
  char *csvoutpath = argv[8];
  int starti = atoi(argv[9]);
  int nofi = atoi(argv[10]);
  int outfd = open(outpath, O_RDWR | O_CREAT | O_TRUNC, 0666);
  if (outfd == -1) {
    perror("can't open binout file");
    return 1;
  }
  FILE *csvout = fopen(csvoutpath, "w");
  if (csvout == NULL) {
    perror("can't open csvout file");
    return 1;
  }
  char *header = NULL;
  asprintf(&header, "P6\n%d %d\n255\n", width, height);
  if (header == NULL)
    exit(1);
  if (write(outfd, header, strlen(header)) != strlen(header))
    exit(1);
  int datasize = 3 * width * height;
  if (ftruncate(outfd, strlen(header) + datasize))
    exit(1);
  time_t t0 = time(NULL);
  unsigned char *data_ = mmap(NULL, strlen(header) + datasize,
                              PROT_READ | PROT_WRITE, MAP_SHARED, outfd, 0);
  if (data_ == MAP_FAILED)
    exit(1);
  unsigned char *data = data_ + strlen(header);
  setvbuf(stdout, NULL, _IONBF, 0);
  setvbuf(csvout, NULL, _IONBF, 0);
  for (int y = starti / width; y < height; y++) {
    double phi1 = maxphi1 - (maxphi1 - minphi1) * (y / (double)height);
    for (int x = (y == starti / width) ? (starti % width) : 0; x < width; x++) {
      int i = y * width + x;
      if (i == starti + nofi)
        goto end;
      printf("\rstep %d (%d of %d)", i, i - starti, nofi);
      if (i != starti) {
        time_t t = time(NULL) - t0;
        printf(", ~%d minutes total          ",
               (int)(t * nofi / (i - starti) / 60));
      }
      double phi2 = minphi2 + (maxphi2 - minphi2) * (x / (double)width);
      unsigned char *pixel = data + 3 * i;
      pixel[0] = 0;
      int pipefds[2];
      if (pipe(pipefds))
        exit(1);
      int forkres = fork();
      if (forkres == -1)
        exit(1);
      if (forkres == 0) {
        dup2(pipefds[1], 1);
        close(0);
        char *cmd = NULL;
        asprintf(&cmd, "./fast_pendulum.x --phi1 %f --phi2 %f", phi1, phi2);
        system(cmd);
        exit(0);
      }
      close(pipefds[1]);
      if (read(pipefds[0], pixel + 1, 1) != 1)
        exit(1);
      if (read(pipefds[0], pixel + 2, 1) != 1)
        exit(1);
      fprintf(csvout, "%f,%f,%hhu,%hhu\n", phi1, phi2,
              *(unsigned char *)(pixel + 1), *(unsigned char *)(pixel + 2));
      close(pipefds[0]);
      waitpid(forkres, NULL, 0);
    }
  }
end:
  printf("\rdone!                                   \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xb,-0x8(%rbp)
je     12a5 <main+0x45>
mov    0x2d26(%rip),%rax
movslq (%rax),%rdi
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x50(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2c68(%rip),%rax
mov    (%rax),%esi
mov    0x2c8f(%rip),%rax
or     (%rax),%esi
mov    0x2c7e(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   1130 <open@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0xffffffff,-0x54(%rbp)
jne    13a3 <main+0x143>
lea    0xcdf(%rip),%rdi
call   1150 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    18ca <main+0x66a>
mov    -0x48(%rbp),%rdi
lea    0xcda(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    13da <main+0x17a>
lea    0xcc1(%rip),%rdi
call   1150 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    18ca <main+0x66a>
movq   $0x0,-0x68(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
lea    -0x68(%rbp),%rdi
lea    0xcaa(%rip),%rsi
call   1100 <asprintf@plt>
cmpq   $0x0,-0x68(%rbp)
jne    1411 <main+0x1b1>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xdc(%rbp),%edi
mov    -0xd8(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %rax,-0xd0(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
je     1471 <main+0x211>
mov    $0x1,%edi
call   1170 <exit@plt>
imul   $0x3,-0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xe0(%rbp),%edi
mov    %eax,%esi
add    -0x6c(%rbp),%esi
call   10a0 <ftruncate@plt>
cmp    $0x0,%rax
je     14b2 <main+0x252>
mov    $0x1,%edi
call   1170 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <time@plt>
mov    %eax,-0x70(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%esi
add    -0x6c(%rbp),%esi
mov    0x2b15(%rip),%rax
mov    (%rax),%edx
mov    0x2acc(%rip),%rax
or     (%rax),%edx
mov    0x2af3(%rip),%rax
mov    (%rax),%ecx
mov    -0x54(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1060 <mmap@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    0x2a92(%rip),%rcx
cmp    (%rcx),%rax
jne    1519 <main+0x2b9>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x78(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0xe8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    0x2a59(%rip),%rax
mov    (%rax),%rdi
mov    0x2a6f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1110 <setvbuf@plt>
mov    -0x60(%rbp),%rdi
mov    0x2a57(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1110 <setvbuf@plt>
mov    -0x4c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    18b7 <main+0x657>
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x84(%rbp),%xmm2
ff
cvtsi2sdl -0x18(%rbp),%xmm3
divsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x84(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    -0x4c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%ecx
mov    -0xec(%rbp),%eax
cmp    %ecx,%eax
jne    160e <main+0x3ae>
mov    -0x4c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0xf0(%rbp)
jmp    161b <main+0x3bb>
xor    %eax,%eax
mov    %eax,-0xf0(%rbp)
jmp    161b <main+0x3bb>
mov    -0xf0(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    189e <main+0x63e>
mov    -0x84(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0x94(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    -0x4c(%rbp),%ecx
add    -0x50(%rbp),%ecx
cmp    %ecx,%eax
jne    1665 <main+0x405>
jmp    18bc <main+0x65c>
mov    -0x98(%rbp),%esi
mov    -0x98(%rbp),%edx
sub    -0x4c(%rbp),%edx
mov    -0x50(%rbp),%ecx
lea    0xa31(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x98(%rbp),%eax
cmp    -0x4c(%rbp),%eax
je     16d4 <main+0x474>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <time@plt>
sub    -0x70(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
imul   -0x50(%rbp),%eax
mov    -0x98(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0x9f6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x94(%rbp),%xmm2
ff
cvtsi2sdl -0x14(%rbp),%xmm3
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x80(%rbp),%rax
imul   $0x3,-0x98(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
movb   $0x0,(%rax)
lea    -0xb8(%rbp),%rdi
call   10c0 <pipe@plt>
cmp    $0x0,%rax
je     1746 <main+0x4e6>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    $0x0,%al
call   1180 <fork@plt>
mov    %eax,-0xbc(%rbp)
cmpl   $0xffffffff,-0xbc(%rbp)
jne    176a <main+0x50a>
mov    $0x1,%edi
call   1170 <exit@plt>
cmpl   $0x0,-0xbc(%rbp)
jne    17cf <main+0x56f>
mov    -0xb4(%rbp),%edi
mov    $0x1,%esi
call   1080 <dup2@plt>
xor    %edi,%edi
call   10b0 <close@plt>
movq   $0x0,-0xc8(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
lea    -0xc8(%rbp),%rdi
lea    0x92a(%rip),%rsi
call   1100 <asprintf@plt>
mov    -0xc8(%rbp),%rdi
call   1070 <system@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    -0xb4(%rbp),%edi
call   10b0 <close@plt>
mov    -0xb8(%rbp),%edi
mov    -0xb0(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
call   10d0 <read@plt>
cmp    $0x1,%eax
je     1808 <main+0x5a8>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0xb8(%rbp),%edi
mov    -0xb0(%rbp),%rsi
add    $0x2,%rsi
mov    $0x1,%edx
call   10d0 <read@plt>
cmp    $0x1,%eax
je     1836 <main+0x5d6>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x60(%rbp),%rdi
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
mov    -0xb0(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0xb0(%rbp),%rax
movzbl 0x2(%rax),%ecx
lea    0x8a0(%rip),%rsi
mov    $0x2,%al
call   10e0 <fprintf@plt>
mov    -0xb8(%rbp),%edi
call   10b0 <close@plt>
mov    -0xbc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1120 <waitpid@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1627 <main+0x3c7>
jmp    18a3 <main+0x643>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1583 <main+0x323>
jmp    18bc <main+0x65c>
lea    0x855(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
cmp    $0xb,%edi
jne    1839 <main+0x5b9>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1170 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x10(%rbx),%rdi
call   1170 <atoi@plt>
mov    %eax,%r13d
mov    0x18(%rbx),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x20(%rbx),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x58(%rsp)
mov    0x28(%rbx),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x78(%rsp)
mov    0x30(%rbx),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x40(%rsp)
mov    0x38(%rbx),%r12
mov    0x40(%rbx),%r15
mov    0x48(%rbx),%rdi
call   1170 <atoi@plt>
mov    %eax,%r14d
mov    0x50(%rbx),%rdi
call   1170 <atoi@plt>
mov    0x2caa(%rip),%rcx
mov    0x2cd3(%rip),%rdx
mov    (%rdx),%esi
or     (%rcx),%esi
mov    %eax,%ebp
mov    0x2cbe(%rip),%rax
or     (%rax),%esi
mov    %r12,%rdi
mov    $0x1b6,%edx
call   1140 <open@plt>
cmp    $0xffffffff,%eax
je     17c8 <main+0x548>
mov    %eax,%r12d
lea    0xd44(%rip),%rsi
mov    %r15,%rdi
call   1150 <fopen@plt>
mov    %rax,0x80(%rsp)
test   %rax,%rax
je     17d1 <main+0x551>
movq   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
cvtsi2sd %r13d,%xmm1
lea    0xd26(%rip),%rsi
lea    0x8(%rsp),%rdi
movsd  %xmm0,0xc0(%rsp)
movsd  %xmm1,0xa0(%rsp)
call   1110 <asprintf@plt>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     1859 <main+0x5d9>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jne    1859 <main+0x5d9>
mov    0x4(%rsp),%eax
imul   %r13d,%eax
lea    (%rax,%rax,2),%ebx
mov    0x8(%rsp),%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbx,1),%esi
mov    %r12d,%edi
call   10b0 <ftruncate@plt>
test   %rax,%rax
jne    1859 <main+0x5d9>
mov    %ebp,0x14(%rsp)
xor    %edi,%edi
call   1100 <time@plt>
mov    %eax,0x54(%rsp)
mov    0x8(%rsp),%rdi
call   1060 <strlen@plt>
add    %eax,%ebx
mov    0x2bbb(%rip),%rax
mov    0x2b74(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2b99(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %ebx,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rbx
mov    0x2b3e(%rip),%rax
cmp    (%rax),%rbx
je     1859 <main+0x5d9>
mov    0x8(%rsp),%rdi
call   1060 <strlen@plt>
mov    %eax,%r12d
mov    0x2b29(%rip),%rax
mov    (%rax),%rdi
mov    0x2b3f(%rip),%rbp
mov    0x0(%rbp),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1120 <setvbuf@plt>
mov    0x0(%rbp),%edx
mov    0x80(%rsp),%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   1120 <setvbuf@plt>
mov    %r14d,%eax
cltd
idivl  0x4(%rsp)
mov    %edx,0x50(%rsp)
mov    %r13d,0x4c(%rsp)
cmp    %r13d,%eax
jge    17a8 <main+0x528>
mov    %rax,%rcx
movslq %r12d,%rax
movsd  0x58(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
xorpd  0xb2b(%rip),%xmm0
movapd %xmm0,0xd0(%rsp)
movsd  0x40(%rsp),%xmm0
subsd  0x78(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
mov    %rcx,%rdx
movslq %edx,%rsi
mov    0x4(%rsp),%ecx
movslq %ecx,%rdi
imul   %ecx,%edx
mov    %edx,%ebp
sub    %r14d,%ebp
mov    %rbp,0x38(%rsp)
add    %rbx,%rax
add    $0x1,%rax
mov    %rax,0x90(%rsp)
mov    %rdi,0x60(%rsp)
imul   %rsi,%rdi
mov    %rdi,0x30(%rsp)
add    0x14(%rsp),%r14d
sub    %r14d,%edx
mov    %rdx,0x68(%rsp)
mov    %ecx,%eax
mov    %rax,0x98(%rsp)
mov    %rsi,0xa8(%rsp)
mov    %rsi,0x20(%rsp)
mov    0x14(%rsp),%ebp
jmp    15a2 <main+0x322>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rcx
add    $0x1,%rcx
mov    0x38(%rsp),%rax
add    0x4(%rsp),%eax
mov    %rax,0x38(%rsp)
mov    0x30(%rsp),%rax
add    0x60(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0x98(%rsp),%rax
add    %rax,0x68(%rsp)
mov    %rcx,0x20(%rsp)
cmp    %ecx,0x4c(%rsp)
je     17a8 <main+0x528>
mov    0x20(%rsp),%rax
cmp    0xa8(%rsp),%rax
mov    $0x0,%eax
cmove  0x50(%rsp),%eax
cmp    0x4(%rsp),%eax
jge    1560 <main+0x2e0>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x20(%rsp),%xmm0
divsd  0xa0(%rsp),%xmm0
mulsd  0xd0(%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
movslq %eax,%rcx
mov    %eax,%edi
mov    0x38(%rsp),%rdx
lea    (%rax,%rdx,1),%r13d
mov    0x30(%rsp),%rsi
lea    (%rsi,%rcx,1),%rdx
lea    (%rdx,%rdx,2),%r14
add    0x90(%rsp),%r14
add    %esi,%eax
mov    %rax,0xb8(%rsp)
mov    0x68(%rsp),%rax
mov    %rdi,0xb0(%rsp)
add    %rdi,%rax
mov    %rax,0xc8(%rsp)
mov    0x60(%rsp),%r15
sub    %rcx,%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    0xc8(%rsp),%rax
add    %r12d,%eax
je     17a8 <main+0x528>
lea    (%r12,%r13,1),%rbx
mov    0xb8(%rsp),%rax
lea    (%rax,%r12,1),%rsi
lea    (%r12,%r13,1),%edx
lea    0xa53(%rip),%rdi
mov    %ebp,%ecx
xor    %eax,%eax
call   10a0 <printf@plt>
test   %ebx,%ebx
je     16b6 <main+0x436>
xor    %edi,%edi
call   1100 <time@plt>
sub    0x54(%rsp),%eax
imul   %ebp,%eax
lea    (%r12,%r13,1),%ecx
cltd
idiv   %ecx
movslq %eax,%rsi
imul   $0xffffffff88888889,%rsi,%rax
shr    $0x20,%rax
add    %eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x5,%esi
add    %eax,%esi
lea    0xa24(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
movb   $0x0,-0x1(%r14)
lea    0x18(%rsp),%rdi
call   10d0 <pipe@plt>
test   %rax,%rax
jne    1859 <main+0x5d9>
mov    0xb0(%rsp),%rax
add    %r12,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xc0(%rsp),%xmm0
mulsd  0x40(%rsp),%xmm0
addsd  0x78(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %eax,%eax
call   11a0 <fork@plt>
test   %eax,%eax
je     17e4 <main+0x564>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1859 <main+0x5d9>
mov    0x1c(%rsp),%edi
call   10c0 <close@plt>
mov    0x18(%rsp),%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
cmp    $0x1,%eax
jne    1859 <main+0x5d9>
mov    0x18(%rsp),%edi
lea    0x1(%r14),%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
cmp    $0x1,%eax
jne    1859 <main+0x5d9>
movzbl (%r14),%edx
movzbl 0x1(%r14),%ecx
mov    0x80(%rsp),%rdi
lea    0x9ac(%rip),%rsi
movsd  0x70(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    $0x2,%al
call   10f0 <fprintf@plt>
mov    0x18(%rsp),%edi
call   10c0 <close@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1130 <waitpid@plt>
add    $0x1,%r12
add    $0x3,%r14
cmp    %r12,%r15
jne    1640 <main+0x3c0>
jmp    1560 <main+0x2e0>
lea    0x979(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8b2(%rip),%rdi
jmp    17d8 <main+0x558>
lea    0x8c2(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%eax
jmp    17b6 <main+0x536>
mov    0x1c(%rsp),%edi
mov    $0x1,%esi
call   1090 <dup2@plt>
xor    %edi,%edi
call   10c0 <close@plt>
movq   $0x0,0x88(%rsp)
lea    0x8e5(%rip),%rsi
lea    0x88(%rsp),%rdi
movsd  0x70(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1110 <asprintf@plt>
mov    0x88(%rsp),%rdi
call   1080 <system@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    0x2770(%rip),%rax
movslq (%rax),%rcx
lea    0x7c6(%rip),%rdi
mov    $0x70,%esi
mov    $0x1,%edx
call   1190 <fwrite@plt>
mov    $0x1,%edi
call   1180 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [113 x i8] c"wrong invocation: want width, height, minphi1, maxphi1, minphi2, maxphi2, binoutpath, csvoutpath, starti, nofi!\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [23 x i8] c"can't open binout file\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [23 x i8] c"can't open csvout file\00"
@.str.4 = [14 x i8] c"P6\0A%d %d\0A255\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@stdout = global i32* null
@_IONBF = global i32 0
@.str.5 = [20 x i8] c"\0Dstep %d (%d of %d)\00"
@.str.6 = [30 x i8] c", ~%d minutes total \00"
@.str.7 = [38 x i8] c"./fast_pendulum.x --phi1 %f --phi2 %f\00"
@.str.8 = [17 x i8] c"%f,%f,%hhu,%hhu\0A\00"
@.str.9 = [43 x i8] c"\0Ddone! \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i32
%24 = alloca double
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca double
%29 = alloca i8*
%30 = alloca [2 x i32]
%31 = alloca i32
%32 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%33 = load i32, i32* %4
%34 = icmp ne i32 %33, 11
br i1 %34, label %35, label %41
35: ; preds = %2
%36 = load i32, i32* @stderr
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %2
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %6
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @atoi(i8* %48)
store i32 %49, i32* %7
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 3
%52 = load i8*, i8** %51
%53 = call double @strtod(i8* %52, i32* null)
store double %53, double* %8
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 4
%56 = load i8*, i8** %55
%57 = call double @strtod(i8* %56, i32* null)
store double %57, double* %9
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 5
%60 = load i8*, i8** %59
%61 = call double @strtod(i8* %60, i32* null)
store double %61, double* %10
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 6
%64 = load i8*, i8** %63
%65 = call double @strtod(i8* %64, i32* null)
store double %65, double* %11
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 7
%68 = load i8*, i8** %67
store i8* %68, i8** %12
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 8
%71 = load i8*, i8** %70
store i8* %71, i8** %13
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 9
%74 = load i8*, i8** %73
%75 = call i32 @atoi(i8* %74)
store i32 %75, i32* %14
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 10
%78 = load i8*, i8** %77
%79 = call i32 @atoi(i8* %78)
store i32 %79, i32* %15
%80 = load i8*, i8** %12
%81 = load i32, i32* @O_RDWR
%82 = load i32, i32* @O_CREAT
%83 = or i32 %81, %82
%84 = load i32, i32* @O_TRUNC
%85 = or i32 %83, %84
%86 = call i32 @open(i8* %80, i32 %85, i32 438)
store i32 %86, i32* %16
%87 = load i32, i32* %16
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %91
89: ; preds = %41
%90 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %325
91: ; preds = %41
%92 = load i8*, i8** %13
%93 = call i32* @fopen(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %93, i32** %17
%94 = load i32*, i32** %17
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %98
96: ; preds = %91
%97 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %325
98: ; preds = %91
store i8* null, i8** %18
%99 = load i32, i32* %6
%100 = sitofp i32 %99 to double
%101 = load i32, i32* %7
%102 = sitofp i32 %101 to double
%103 = call i32 @asprintf(i8** %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %100, double %102)
%104 = load i8*, i8** %18
%105 = icmp eq i8* %104, null
br i1 %105, label %106, label %108
106: ; preds = %98
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %98
%109 = load i32, i32* %16
%110 = load i8*, i8** %18
%111 = load i8*, i8** %18
%112 = call i32 @strlen(i8* %111)
%113 = call i64 @write(i32 %109, i8* %110, i32 %112)
%114 = load i8*, i8** %18
%115 = call i32 @strlen(i8* %114)
%116 = sext i32 %115 to i64
%117 = icmp ne i64 %113, %116
br i1 %117, label %118, label %120
118: ; preds = %108
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %108
%121 = load i32, i32* %6
%122 = mul nsw i32 3, %121
%123 = load i32, i32* %7
%124 = mul nsw i32 %122, %123
store i32 %124, i32* %19
%125 = load i32, i32* %16
%126 = load i8*, i8** %18
%127 = call i32 @strlen(i8* %126)
%128 = load i32, i32* %19
%129 = add nsw i32 %127, %128
%130 = call i64 @ftruncate(i32 %125, i32 %129)
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %134
132: ; preds = %120
%133 = call i32 @exit(i32 1)
unreachable
134: ; preds = %120
%135 = call i32 @time(i32* null)
store i32 %135, i32* %20
%136 = load i8*, i8** %18
%137 = call i32 @strlen(i8* %136)
%138 = load i32, i32* %19
%139 = add nsw i32 %137, %138
%140 = load i32, i32* @PROT_READ
%141 = load i32, i32* @PROT_WRITE
%142 = or i32 %140, %141
%143 = load i32, i32* @MAP_SHARED
%144 = load i32, i32* %16
%145 = call i8* @mmap(i32* null, i32 %139, i32 %142, i32 %143, i32 %144, i32 0)
store i8* %145, i8** %21
%146 = load i8*, i8** %21
%147 = load i8*, i8** @MAP_FAILED
%148 = icmp eq i8* %146, %147
br i1 %148, label %149, label %151
149: ; preds = %134
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %134
%152 = load i8*, i8** %21
%153 = load i8*, i8** %18
%154 = call i32 @strlen(i8* %153)
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i8, i8* %152, i64 %155
store i8* %156, i8** %22
%157 = load i32*, i32** @stdout
%158 = load i32, i32* @_IONBF
%159 = call i32 @setvbuf(i32* %157, i32* null, i32 %158, i32 0)
%160 = load i32*, i32** %17
%161 = load i32, i32* @_IONBF
%162 = call i32 @setvbuf(i32* %160, i32* null, i32 %161, i32 0)
%163 = load i32, i32* %14
%164 = load i32, i32* %6
%165 = sdiv i32 %163, %164
store i32 %165, i32* %23
br label %166
166: ; preds = %319, %151
%167 = load i32, i32* %23
%168 = load i32, i32* %7
%169 = icmp slt i32 %167, %168
br i1 %169, label %170, label %322
170: ; preds = %166
%171 = load double, double* %9
%172 = load double, double* %9
%173 = load double, double* %8
%174 = fsub double %172, %173
%175 = load i32, i32* %23
%176 = sitofp i32 %175 to double
%177 = load i32, i32* %7
%178 = sitofp i32 %177 to double
%179 = fdiv double %176, %178
%180 = fneg double %174
%181 = call double @llvm.fmuladd.f64(double %180, double %179, double %171)
store double %181, double* %24
%182 = load i32, i32* %23
%183 = load i32, i32* %14
%184 = load i32, i32* %6
%185 = sdiv i32 %183, %184
%186 = icmp eq i32 %182, %185
br i1 %186, label %187, label %191
187: ; preds = %170
%188 = load i32, i32* %14
%189 = load i32, i32* %6
%190 = srem i32 %188, %189
br label %192
191: ; preds = %170
br label %192
192: ; preds = %191, %187
%193 = phi i32 [ %190, %187 ], [ 0, %191 ]
store i32 %193, i32* %25
br label %194
194: ; preds = %315, %192
%195 = load i32, i32* %25
%196 = load i32, i32* %6
%197 = icmp slt i32 %195, %196
br i1 %197, label %198, label %318
198: ; preds = %194
%199 = load i32, i32* %23
%200 = load i32, i32* %6
%201 = mul nsw i32 %199, %200
%202 = load i32, i32* %25
%203 = add nsw i32 %201, %202
store i32 %203, i32* %26
%204 = load i32, i32* %26
%205 = load i32, i32* %14
%206 = load i32, i32* %15
%207 = add nsw i32 %205, %206
%208 = icmp eq i32 %204, %207
br i1 %208, label %209, label %210
209: ; preds = %198
br label %323
210: ; preds = %198
%211 = load i32, i32* %26
%212 = load i32, i32* %26
%213 = load i32, i32* %14
%214 = sub nsw i32 %212, %213
%215 = load i32, i32* %15
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %211, i32 %214, i32 %215)
%217 = load i32, i32* %26
%218 = load i32, i32* %14
%219 = icmp ne i32 %217, %218
br i1 %219, label %220, label %233
220: ; preds = %210
%221 = call i32 @time(i32* null)
%222 = load i32, i32* %20
%223 = sub nsw i32 %221, %222
store i32 %223, i32* %27
%224 = load i32, i32* %27
%225 = load i32, i32* %15
%226 = mul nsw i32 %224, %225
%227 = load i32, i32* %26
%228 = load i32, i32* %14
%229 = sub nsw i32 %227, %228
%230 = sdiv i32 %226, %229
%231 = sdiv i32 %230, 60
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %231)
br label %233
233: ; preds = %220, %210
%234 = load double, double* %10
%235 = load double, double* %11
%236 = load double, double* %10
%237 = fsub double %235, %236
%238 = load i32, i32* %25
%239 = sitofp i32 %238 to double
%240 = load i32, i32* %6
%241 = sitofp i32 %240 to double
%242 = fdiv double %239, %241
%243 = call double @llvm.fmuladd.f64(double %237, double %242, double %234)
store double %243, double* %28
%244 = load i8*, i8** %22
%245 = load i32, i32* %26
%246 = mul nsw i32 3, %245
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds i8, i8* %244, i64 %247
store i8* %248, i8** %29
%249 = load i8*, i8** %29
%250 = getelementptr inbounds i8, i8* %249, i64 0
store i8 0, i8* %250
%251 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%252 = call i64 @pipe(i32* %251)
%253 = icmp ne i64 %252, 0
br i1 %253, label %254, label %256
254: ; preds = %233
%255 = call i32 @exit(i32 1)
unreachable
256: ; preds = %233
%257 = call i32 (...) @fork()
store i32 %257, i32* %31
%258 = load i32, i32* %31
%259 = icmp eq i32 %258, -1
br i1 %259, label %260, label %262
260: ; preds = %256
%261 = call i32 @exit(i32 1)
unreachable
262: ; preds = %256
%263 = load i32, i32* %31
%264 = icmp eq i32 %263, 0
br i1 %264, label %265, label %276
265: ; preds = %262
%266 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 1
%267 = load i32, i32* %266
%268 = call i32 @dup2(i32 %267, i32 1)
%269 = call i32 @close(i32 0)
store i8* null, i8** %32
%270 = load double, double* %24
%271 = load double, double* %28
%272 = call i32 @asprintf(i8** %32, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), double %270, double %271)
%273 = load i8*, i8** %32
%274 = call i32 @system(i8* %273)
%275 = call i32 @exit(i32 0)
unreachable
276: ; preds = %262
%277 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 1
%278 = load i32, i32* %277
%279 = call i32 @close(i32 %278)
%280 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%281 = load i32, i32* %280
%282 = load i8*, i8** %29
%283 = getelementptr inbounds i8, i8* %282, i64 1
%284 = call i32 @read(i32 %281, i8* %283, i32 1)
%285 = icmp ne i32 %284, 1
br i1 %285, label %286, label %288
286: ; preds = %276
%287 = call i32 @exit(i32 1)
unreachable
288: ; preds = %276
%289 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%290 = load i32, i32* %289
%291 = load i8*, i8** %29
%292 = getelementptr inbounds i8, i8* %291, i64 2
%293 = call i32 @read(i32 %290, i8* %292, i32 1)
%294 = icmp ne i32 %293, 1
br i1 %294, label %295, label %297
295: ; preds = %288
%296 = call i32 @exit(i32 1)
unreachable
297: ; preds = %288
%298 = load i32*, i32** %17
%299 = load double, double* %24
%300 = load double, double* %28
%301 = load i8*, i8** %29
%302 = getelementptr inbounds i8, i8* %301, i64 1
%303 = load i8, i8* %302
%304 = zext i8 %303 to i32
%305 = load i8*, i8** %29
%306 = getelementptr inbounds i8, i8* %305, i64 2
%307 = load i8, i8* %306
%308 = zext i8 %307 to i32
%309 = call i32 (i32*, i8*, ...) @fprintf(i32* %298, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), double %299, double %300, i32 %304, i32 %308)
%310 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%311 = load i32, i32* %310
%312 = call i32 @close(i32 %311)
%313 = load i32, i32* %31
%314 = call i32 @waitpid(i32 %313, i32* null, i32 0)
br label %315
315: ; preds = %297
%316 = load i32, i32* %25
%317 = add nsw i32 %316, 1
store i32 %317, i32* %25
br label %194
318: ; preds = %194
br label %319
319: ; preds = %318
%320 = load i32, i32* %23
%321 = add nsw i32 %320, 1
store i32 %321, i32* %23
br label %166
322: ; preds = %166
br label %323
323: ; preds = %322, %209
%324 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
br label %325
325: ; preds = %323, %96, %89
%326 = load i32, i32* %3
ret i32 %326
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [113 x i8] c"wrong invocation: want width, height, minphi1, maxphi1, minphi2, maxphi2, binoutpath, csvoutpath, starti, nofi!\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [23 x i8] c"can't open binout file\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [23 x i8] c"can't open csvout file\00"
@.str.4 = [14 x i8] c"P6\0A%d %d\0A255\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@stdout = global i32* null
@_IONBF = global i32 0
@.str.5 = [20 x i8] c"\0Dstep %d (%d of %d)\00"
@.str.6 = [30 x i8] c", ~%d minutes total \00"
@.str.7 = [38 x i8] c"./fast_pendulum.x --phi1 %f --phi2 %f\00"
@.str.8 = [17 x i8] c"%f,%f,%hhu,%hhu\0A\00"
@str = [42 x i8] c"\0Ddone! \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca [2 x i32]
%5 = alloca i8*
%6 = icmp eq i32 %0, 11
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0), i64 112, i64 1, i32* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call double @strtod(i8* nocapture %21, i32* null)
%23 = getelementptr inbounds i8*, i8** %1, i64 4
%24 = load i8*, i8** %23
%25 = tail call double @strtod(i8* nocapture %24, i32* null)
%26 = getelementptr inbounds i8*, i8** %1, i64 5
%27 = load i8*, i8** %26
%28 = tail call double @strtod(i8* nocapture %27, i32* null)
%29 = getelementptr inbounds i8*, i8** %1, i64 6
%30 = load i8*, i8** %29
%31 = tail call double @strtod(i8* nocapture %30, i32* null)
%32 = getelementptr inbounds i8*, i8** %1, i64 7
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8*, i8** %1, i64 8
%35 = load i8*, i8** %34
%36 = getelementptr inbounds i8*, i8** %1, i64 9
%37 = load i8*, i8** %36
%38 = tail call i32 @atoi(i8* %37)
%39 = getelementptr inbounds i8*, i8** %1, i64 10
%40 = load i8*, i8** %39
%41 = tail call i32 @atoi(i8* %40)
%42 = load i32, i32* @O_RDWR
%43 = load i32, i32* @O_CREAT
%44 = or i32 %43, %42
%45 = load i32, i32* @O_TRUNC
%46 = or i32 %44, %45
%47 = tail call i32 @open(i8* %33, i32 %46, i32 438)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %13
%50 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %210
51: ; preds = %13
%52 = tail call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %210
56: ; preds = %51
%57 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%58 = sitofp i32 %16 to double
%59 = sitofp i32 %19 to double
%60 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %58, double %59)
%61 = load i8*, i8** %3
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %65
63: ; preds = %56
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %56
%66 = call i32 @strlen(i8* %61)
%67 = call i64 @write(i32 %47, i8* %61, i32 %66)
%68 = load i8*, i8** %3
%69 = call i32 @strlen(i8* %68)
%70 = sext i32 %69 to i64
%71 = icmp eq i64 %67, %70
br i1 %71, label %74, label %72
72: ; preds = %65
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %65
%75 = mul nsw i32 %16, 3
%76 = mul nsw i32 %75, %19
%77 = load i8*, i8** %3
%78 = call i32 @strlen(i8* %77)
%79 = add nsw i32 %78, %76
%80 = call i64 @ftruncate(i32 %47, i32 %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %84, label %82
82: ; preds = %74
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %74
%85 = call i32 @time(i32* null)
%86 = load i8*, i8** %3
%87 = call i32 @strlen(i8* %86)
%88 = add nsw i32 %87, %76
%89 = load i32, i32* @PROT_READ
%90 = load i32, i32* @PROT_WRITE
%91 = or i32 %90, %89
%92 = load i32, i32* @MAP_SHARED
%93 = call i8* @mmap(i32* null, i32 %88, i32 %91, i32 %92, i32 %47, i32 0)
%94 = load i8*, i8** @MAP_FAILED
%95 = icmp eq i8* %93, %94
br i1 %95, label %96, label %98
96: ; preds = %84
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %84
%99 = load i8*, i8** %3
%100 = call i32 @strlen(i8* %99)
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %93, i64 %101
%103 = load i32*, i32** @stdout
%104 = load i32, i32* @_IONBF
%105 = call i32 @setvbuf(i32* %103, i32* null, i32 %104, i32 0)
%106 = load i32, i32* @_IONBF
%107 = call i32 @setvbuf(i32* %52, i32* null, i32 %106, i32 0)
%108 = sdiv i32 %38, %16
%109 = srem i32 %38, %16
%110 = icmp slt i32 %108, %19
br i1 %110, label %111, label %208
111: ; preds = %98
%112 = fsub double %25, %22
%113 = fneg double %112
%114 = add nsw i32 %41, %38
%115 = fsub double %31, %28
%116 = bitcast [2 x i32]* %4 to i8*
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%118 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%119 = sext i32 %108 to i64
%120 = sext i32 %16 to i64
br label %121
121: ; preds = %111, %204
%122 = phi i64 [ %119, %111 ], [ %205, %204 ]
%123 = trunc i64 %122 to i32
%124 = sitofp i32 %123 to double
%125 = fdiv double %124, %59
%126 = call double @llvm.fmuladd.f64(double %113, double %125, double %25)
%127 = icmp eq i64 %122, %119
%128 = select i1 %127, i32 %109, i32 0
%129 = icmp slt i32 %128, %16
br i1 %129, label %130, label %204
130: ; preds = %121
%131 = mul nsw i64 %122, %120
%132 = sext i32 %128 to i64
%133 = trunc i64 %131 to i32
br label %134
134: ; preds = %130, %193
%135 = phi i64 [ %132, %130 ], [ %202, %193 ]
%136 = trunc i64 %135 to i32
%137 = add nsw i64 %135, %131
%138 = trunc i64 %137 to i32
%139 = icmp eq i32 %114, %138
br i1 %139, label %208, label %140
140: ; preds = %134
%141 = add nsw i32 %136, %133
%142 = sub nsw i32 %141, %38
%143 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %138, i32 %142, i32 %41)
%144 = icmp eq i32 %38, %138
br i1 %144, label %154, label %145
145: ; preds = %140
%146 = call i32 @time(i32* null)
%147 = sub nsw i32 %146, %85
%148 = mul nsw i32 %147, %41
%149 = trunc i64 %137 to i32
%150 = sub i32 %149, %38
%151 = sdiv i32 %148, %150
%152 = sdiv i32 %151, 60
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %152)
br label %154
154: ; preds = %145, %140
%155 = sitofp i32 %136 to double
%156 = fdiv double %155, %58
%157 = call double @llvm.fmuladd.f64(double %115, double %156, double %28)
%158 = mul nsw i64 %137, 3
%159 = getelementptr inbounds i8, i8* %102, i64 %158
store i8 0, i8* %159
%160 = call i64 @pipe(i32* %117)
%161 = icmp eq i64 %160, 0
br i1 %161, label %164, label %162
162: ; preds = %154
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %154
%165 = call i32 (...) @fork()
switch i32 %165, label %177 [
i32 -1, label %166
i32 0, label %168
]
166: ; preds = %164
%167 = call i32 @exit(i32 1)
unreachable
168: ; preds = %164
%169 = load i32, i32* %118
%170 = call i32 @dup2(i32 %169, i32 1)
%171 = call i32 @close(i32 0)
%172 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%173 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), double %126, double %157)
%174 = load i8*, i8** %5
%175 = call i32 @system(i8* %174)
%176 = call i32 @exit(i32 0)
unreachable
177: ; preds = %164
%178 = load i32, i32* %118
%179 = call i32 @close(i32 %178)
%180 = load i32, i32* %117
%181 = getelementptr inbounds i8, i8* %159, i64 1
%182 = call i32 @read(i32 %180, i8* %181, i32 1)
%183 = icmp eq i32 %182, 1
br i1 %183, label %186, label %184
184: ; preds = %177
%185 = call i32 @exit(i32 1)
unreachable
186: ; preds = %177
%187 = load i32, i32* %117
%188 = getelementptr inbounds i8, i8* %159, i64 2
%189 = call i32 @read(i32 %187, i8* %188, i32 1)
%190 = icmp eq i32 %189, 1
br i1 %190, label %193, label %191
191: ; preds = %186
%192 = call i32 @exit(i32 1)
unreachable
193: ; preds = %186
%194 = load i8, i8* %181
%195 = zext i8 %194 to i32
%196 = load i8, i8* %188
%197 = zext i8 %196 to i32
%198 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), double %126, double %157, i32 %195, i32 %197)
%199 = load i32, i32* %117
%200 = call i32 @close(i32 %199)
%201 = call i32 @waitpid(i32 %165, i32* null, i32 0)
%202 = add nsw i64 %135, 1
%203 = icmp eq i64 %202, %120
br i1 %203, label %204, label %134
204: ; preds = %193, %121
%205 = add nsw i64 %122, 1
%206 = trunc i64 %205 to i32
%207 = icmp eq i32 %19, %206
br i1 %207, label %208, label %121
208: ; preds = %204, %134, %98
%209 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %210
210: ; preds = %54, %208, %49
%211 = phi i32 [ 1, %49 ], [ 1, %54 ], [ 0, %208 ]
ret i32 %211
}