#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 */
int M_PI;
void *atoi(char const *);
float const cos(float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
float const sin(float);
int main(int argc, const char *argv[]) {
  if (argc < 4) {
    printf("Usage: visualize c1 c2 c3 c4 [generation]\n");
    return 1;
  }
  const int c_c_position = atoi(argv[1]);
  const int c_c_velocity = atoi(argv[2]);
  const int c_p_angle = atoi(argv[3]);
  const int c_p_velocity = atoi(argv[4]);
  int generation = -1;
  if (argc > 5) {
    generation = atoi(argv[5]);
  }
  const float fail_position = 2.4;
  const float fail_angle = M_PI / 6;
  const float g_acceleration = -9.81;
  const float abs_force = 10;
  const float p_length = 0.5;
  const float p_mass = 0.1;
  const float c_mass = 1;
  const int time_total = 60000;
  const int time_step = 25;
  float c_position = 0;
  float c_velocity = 0;
  float c_acceleration = 0;
  float p_angle = M_PI / 36;
  float p_velocity = 0;
  float p_acceleration = 0;
  float force;
  FILE *stream = fopen("data.txt", "wt");
  fprintf(stream, "c_position p_angle\n");
  const float delta = ((float)time_step / (float)1000);
  int t;
  for (t = 0; t < time_total; t += time_step) {
    c_position = c_position + delta * c_velocity;
    p_angle = p_angle + delta * p_velocity;
    force = abs_force * (c_c_position * c_position + c_c_velocity * c_velocity +
                         c_p_angle * p_angle + c_p_velocity * p_velocity) >
                    0
                ? 1
                : -1;
    fprintf(stream, "%f %f %f\n", c_position, p_angle, force);
    c_acceleration =
        (force + p_mass * p_length * sin(p_angle) * p_velocity * p_velocity -
         p_mass * g_acceleration * cos(p_angle) * sin(p_angle)) /
        (c_mass + p_mass - p_mass * cos(p_angle) * cos(p_angle));
    p_acceleration =
        (force * cos(p_angle) -
         g_acceleration * (c_mass + p_mass) * sin(p_angle) +
         p_mass * p_length * cos(p_angle) * sin(p_angle) * p_velocity) /
        (p_mass * p_length * cos(p_angle) * cos(p_angle) -
         (c_mass + p_mass) * p_length);
    c_velocity = c_velocity + delta * c_acceleration;
    p_velocity = p_velocity - delta * p_acceleration;
    if (c_position * (c_position > 0 ? 1 : -1) >= fail_position ||
        p_angle * (p_angle > 0 ? 1 : -1) > fail_angle) {
      break;
    }
  }
  fclose(stream);
  stream = fopen("header.txt", "wt");
  fprintf(stream,
          "generation fitness k l m n time_step fail_position fail_angle\n");
  fprintf(stream, "%d %d %d %d %d %d %d %f %f\n", generation, t, c_c_position,
          c_c_velocity, c_p_angle, c_p_velocity, time_step, fail_position,
          fail_angle);
  fclose(stream);
  printf("%d\n", t);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11ad <main+0x3d>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1747 <main+0x5d7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
cmpl   $0x5,-0x8(%rbp)
jle    120e <main+0x9e>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
movss  0xe02(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xdd7(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xdc6(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xdb5(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xda4(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xd93(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movl   $0xea60,-0x44(%rbp)
movl   $0x19,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    0x2d45(%rip),%rax
mov    (%rax),%eax
mov    $0x24,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x60(%rbp)
lea    0xd9e(%rip),%rdi
lea    0xda0(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movss  0xd09(%rip),%xmm0
movss  %xmm0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0xea60,-0x78(%rbp)
jge    16ac <main+0x53c>
movss  -0x4c(%rbp),%xmm1
movss  -0x50(%rbp),%xmm0
movss  0xcde(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x58(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm0
movss  0xcbf(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm1
movss  -0x4c(%rbp),%xmm2
cvtsi2ssl -0x18(%rbp),%xmm0
mulss  -0x50(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
cvtsi2ssl -0x1c(%rbp),%xmm0
movss  -0x58(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xc7a(%rip),%xmm0
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x70(%rbp),%rdi
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x58(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x64(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xcaf(%rip),%rsi
mov    $0x3,%al
call   1050 <fprintf@plt>
movss  -0x64(%rbp),%xmm0
movss  %xmm0,-0xa4(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1060 <sin@plt>
movss  -0xa4(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  0xc17(%rip),%xmm0
mulss  %xmm2,%xmm0
mulss  -0x5c(%rbp),%xmm0
movss  -0x5c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xbf0(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1060 <sin@plt>
movss  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x9c(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x94(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xb6d(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x98(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movss  -0x98(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x94(%rbp),%xmm0
ff
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xb4f(%rip),%xmm2
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x90(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1060 <sin@plt>
movss  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movss  -0x8c(%rbp),%xmm0
ff
movss  0xafa(%rip),%xmm1
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xac0(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x58(%rbp),%xmm0
call   1060 <sin@plt>
movss  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x84(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
movss  -0x5c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x7c(%rbp)
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xa6c(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movss  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x7c(%rbp),%xmm0
mulss  %xmm2,%xmm1
movss  0xa3c(%rip),%xmm2
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x50(%rbp),%xmm1
movss  -0x54(%rbp),%xmm0
movss  0x9fd(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x5c(%rbp),%xmm1
movss  -0x60(%rbp),%xmm0
movss  0x9fa(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x4c(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
xorps  %xmm2,%xmm2
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomiss %xmm2,%xmm1
cmova  %ecx,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  0x9bc(%rip),%xmm1
ucomiss %xmm1,%xmm0
jae    1694 <main+0x524>
movss  -0x58(%rbp),%xmm0
movss  -0x58(%rbp),%xmm1
xorps  %xmm2,%xmm2
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomiss %xmm2,%xmm1
cmova  %ecx,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1699 <main+0x529>
jmp    16ac <main+0x53c>
jmp    169e <main+0x52e>
mov    -0x78(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0x78(%rbp)
jmp    1303 <main+0x193>
mov    -0x70(%rbp),%rdi
call   1030 <fclose@plt>
lea    0x9d9(%rip),%rdi
lea    0x9b1(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
lea    0x9c9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x78(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%r10d
mov    -0x20(%rbp),%eax
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
lea    0x9d8(%rip),%rsi
movsd  0x929(%rip),%xmm0
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x19,0x10(%rsp)
mov    $0x2,%al
call   1050 <fprintf@plt>
mov    -0x70(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x78(%rbp),%esi
lea    0x9c2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
cmp    $0x3,%edi
jg     11bc <main+0x2c>
lea    0xf6f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    160c <main+0x47c>
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r14
mov    0x10(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %rax,0x58(%rsp)
mov    0x18(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r12
mov    0x20(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r15
mov    $0xffffffff,%eax
cmp    $0x6,%ebx
jb     1206 <main+0x76>
mov    0x28(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %rax,0x88(%rsp)
mov    0x2dd3(%rip),%rax
movslq (%rax),%rax
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
cvtsi2ss %ecx,%xmm0
movss  %xmm0,0x1c(%rsp)
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movaps %xmm0,(%rsp)
lea    0xe2c(%rip),%rdi
lea    0xe2e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r13
lea    0xe22(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
mov    %r14,0x98(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
movss  %xmm0,0x2c(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ssl 0x58(%rsp),%xmm0
movss  %xmm0,0x28(%rsp)
mov    %r12,0x90(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r12d,%xmm0
movss  %xmm0,0x24(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
movss  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm3
xorps  %xmm1,%xmm1
shufps $0xe2,%xmm1,%xmm3
xor    %ebp,%ebp
mov    $0xffffffe7,%ebx
lea    0xd91(%rip),%r12
lea    0xdba(%rip),%r14
xchg   %ax,%ax
movaps %xmm1,%xmm2
mulps  0xd06(%rip),%xmm2
addps  %xmm3,%xmm2
movaps %xmm2,%xmm3
shufps $0x55,%xmm2,%xmm3
movaps %xmm1,%xmm0
mulss  0x28(%rsp),%xmm0
movaps %xmm1,%xmm4
movaps %xmm1,0x70(%rsp)
movss  0x2c(%rsp),%xmm1
mulss  %xmm2,%xmm1
movaps %xmm2,0xe0(%rsp)
addss  %xmm0,%xmm1
movss  0x24(%rsp),%xmm0
mulss  %xmm3,%xmm0
movaps %xmm3,(%rsp)
addss  %xmm1,%xmm0
shufps $0x55,%xmm4,%xmm4
movaps %xmm4,0x40(%rsp)
movss  0x20(%rsp),%xmm1
mulss  %xmm4,%xmm1
addss  %xmm0,%xmm1
mulss  0xd04(%rip),%xmm1
xor    %eax,%eax
ucomiss 0xd0b(%rip),%xmm1
seta   %al
movss  (%r12,%rax,4),%xmm4
movaps %xmm4,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm4,%xmm2
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0x3,%al
call   1060 <fprintf@plt>
movaps (%rsp),%xmm0
call   1070 <sin@plt>
movaps %xmm0,%xmm1
movss  0xcbb(%rip),%xmm0
mulss  %xmm0,%xmm1
mulss  0x40(%rsp),%xmm1
movaps %xmm1,0x60(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,0xc0(%rsp)
movaps (%rsp),%xmm0
call   1070 <sin@plt>
movaps %xmm0,0xb0(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,0x40(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,0xd0(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,0xa0(%rsp)
movaps (%rsp),%xmm0
call   1070 <sin@plt>
mulss  0xc4d(%rip),%xmm0
movaps 0x30(%rsp),%xmm2
movaps 0x60(%rsp),%xmm3
unpcklps %xmm2,%xmm3
movaps 0x70(%rsp),%xmm1
movaps 0xa0(%rsp),%xmm4
shufps $0xd4,%xmm1,%xmm4
shufps $0x52,%xmm1,%xmm4
mulps  %xmm3,%xmm4
movaps %xmm2,%xmm1
unpcklps %xmm0,%xmm1
addps  %xmm4,%xmm1
movaps %xmm1,0x30(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
mulss  0xc05(%rip),%xmm0
movaps 0xbaa(%rip),%xmm1
unpcklps %xmm0,%xmm1
movaps %xmm1,0x60(%rsp)
movaps (%rsp),%xmm0
call   1070 <sin@plt>
movaps 0xc0(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  0x60(%rsp),%xmm1
movaps 0x70(%rsp),%xmm2
movaps 0xb0(%rsp),%xmm0
movss  %xmm0,%xmm2
mulps  %xmm1,%xmm2
addps  0x30(%rsp),%xmm2
movaps %xmm2,0x30(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps 0x40(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  0xb63(%rip),%xmm1
movaps %xmm1,0x40(%rsp)
movaps (%rsp),%xmm0
call   1080 <cos@plt>
movaps 0x30(%rsp),%xmm5
movaps 0xb79(%rip),%xmm4
movaps 0xe0(%rsp),%xmm3
movaps 0xd0(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  0x40(%rsp),%xmm1
addps  0xb3a(%rip),%xmm1
divps  %xmm1,%xmm5
mulps  0xb40(%rip),%xmm5
movaps %xmm3,%xmm0
xorps  %xmm4,%xmm0
xorps  %xmm1,%xmm1
cmpltss %xmm3,%xmm1
movaps %xmm1,%xmm2
andps  %xmm3,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
ucomiss 0xb4b(%rip),%xmm1
jae    1566 <main+0x3d6>
xorps  %xmm0,%xmm0
movaps (%rsp),%xmm2
cmpltss %xmm2,%xmm0
movaps %xmm0,%xmm1
andps  %xmm2,%xmm1
xorps  %xmm4,%xmm2
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
ucomiss 0x1c(%rsp),%xmm0
ja     156b <main+0x3db>
movaps 0x70(%rsp),%xmm1
addps  %xmm5,%xmm1
add    $0x19,%ebp
add    $0x19,%ebx
cmp    $0xea47,%ebx
jb     12f0 <main+0x160>
mov    $0xea60,%ebp
jmp    156b <main+0x3db>
add    $0x19,%ebx
mov    %ebx,%ebp
mov    %r13,%rdi
call   1040 <fclose@plt>
lea    0xb38(%rip),%rdi
lea    0xb10(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xb2d(%rip),%rdi
mov    $0x3e,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
movss  0x1c(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
sub    $0x8,%rsp
lea    0xb42(%rip),%rsi
movsd  0xabe(%rip),%xmm0
mov    %rbx,%rdi
mov    0x90(%rsp),%rdx
mov    %ebp,%ecx
mov    0xa0(%rsp),%r8
mov    0x60(%rsp),%r9
mov    $0x2,%al
push   $0x19
push   %r15
push   0xa8(%rsp)
call   1060 <fprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xb17(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Usage: visualize c1 c2 c3 c4 [generation]\0A\00"
@M_PI = global i32 0
@.str.1 = [9 x i8] c"data.txt\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [20 x i8] c"c_position p_angle\0A\00"
@.str.4 = [10 x i8] c"%f %f %f\0A\00"
@.str.5 = [11 x i8] c"header.txt\00"
@.str.6 = [63 x i8] c"generation fitness k l m n time_step fail_position fail_angle\0A\00"
@.str.7 = [28 x i8] c"%d %d %d %d %d %d %d %f %f\0A\00"
@.str.8 = [4 x i8] c"%d\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca i32
%19 = alloca i32
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
%26 = alloca float
%27 = alloca i32*
%28 = alloca float
%29 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %34
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %207
34: ; preds = %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i8* @atoi(i8* %37)
%39 = ptrtoint i8* %38 to i32
store i32 %39, i32* %6
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i8* @atoi(i8* %42)
%44 = ptrtoint i8* %43 to i32
store i32 %44, i32* %7
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i8* @atoi(i8* %47)
%49 = ptrtoint i8* %48 to i32
store i32 %49, i32* %8
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 4
%52 = load i8*, i8** %51
%53 = call i8* @atoi(i8* %52)
%54 = ptrtoint i8* %53 to i32
store i32 %54, i32* %9
store i32 -1, i32* %10
%55 = load i32, i32* %4
%56 = icmp sgt i32 %55, 5
br i1 %56, label %57, label %63
57: ; preds = %34
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 5
%60 = load i8*, i8** %59
%61 = call i8* @atoi(i8* %60)
%62 = ptrtoint i8* %61 to i32
store i32 %62, i32* %10
br label %63
63: ; preds = %57, %34
store float 0x4003333340000000, float* %11
%64 = load i32, i32* @M_PI
%65 = sdiv i32 %64, 6
%66 = sitofp i32 %65 to float
store float %66, float* %12
store float 0xC0239EB860000000, float* %13
store float 1.000000e+01, float* %14
store float 5.000000e-01, float* %15
store float 0x3FB99999A0000000, float* %16
store float 1.000000e+00, float* %17
store i32 60000, i32* %18
store i32 25, i32* %19
store float 0.000000e+00, float* %20
store float 0.000000e+00, float* %21
store float 0.000000e+00, float* %22
%67 = load i32, i32* @M_PI
%68 = sdiv i32 %67, 36
%69 = sitofp i32 %68 to float
store float %69, float* %23
store float 0.000000e+00, float* %24
store float 0.000000e+00, float* %25
%70 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %70, i32** %27
%71 = load i32*, i32** %27
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store float 0x3F999999A0000000, float* %28
store i32 0, i32* %29
br label %73
73: ; preds = %184, %63
%74 = load i32, i32* %29
%75 = icmp slt i32 %74, 60000
br i1 %75, label %76, label %187
76: ; preds = %73
%77 = load float, float* %20
%78 = load float, float* %21
%79 = call float @llvm.fmuladd.f32(float 0x3F999999A0000000, float %78, float %77)
store float %79, float* %20
%80 = load float, float* %23
%81 = load float, float* %24
%82 = call float @llvm.fmuladd.f32(float 0x3F999999A0000000, float %81, float %80)
store float %82, float* %23
%83 = load i32, i32* %6
%84 = sitofp i32 %83 to float
%85 = load float, float* %20
%86 = load i32, i32* %7
%87 = sitofp i32 %86 to float
%88 = load float, float* %21
%89 = fmul float %87, %88
%90 = call float @llvm.fmuladd.f32(float %84, float %85, float %89)
%91 = load i32, i32* %8
%92 = sitofp i32 %91 to float
%93 = load float, float* %23
%94 = call float @llvm.fmuladd.f32(float %92, float %93, float %90)
%95 = load i32, i32* %9
%96 = sitofp i32 %95 to float
%97 = load float, float* %24
%98 = call float @llvm.fmuladd.f32(float %96, float %97, float %94)
%99 = fmul float 1.000000e+01, %98
%100 = fcmp ogt float %99, 0.000000e+00
%101 = zext i1 %100 to i64
%102 = select i1 %100, i32 1, i32 -1
%103 = sitofp i32 %102 to float
store float %103, float* %26
%104 = load i32*, i32** %27
%105 = load float, float* %20
%106 = fpext float %105 to double
%107 = load float, float* %23
%108 = fpext float %107 to double
%109 = load float, float* %26
%110 = fpext float %109 to double
%111 = call i32 (i32*, i8*, ...) @fprintf(i32* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %106, double %108, double %110)
%112 = load float, float* %26
%113 = load float, float* %23
%114 = call float @sin(float %113)
%115 = fmul float 0x3FA99999A0000000, %114
%116 = load float, float* %24
%117 = fmul float %115, %116
%118 = load float, float* %24
%119 = call float @llvm.fmuladd.f32(float %117, float %118, float %112)
%120 = load float, float* %23
%121 = call float @cos(float %120)
%122 = fmul float 0xBFEF645A40000000, %121
%123 = load float, float* %23
%124 = call float @sin(float %123)
%125 = fneg float %122
%126 = call float @llvm.fmuladd.f32(float %125, float %124, float %119)
%127 = load float, float* %23
%128 = call float @cos(float %127)
%129 = fmul float 0x3FB99999A0000000, %128
%130 = load float, float* %23
%131 = call float @cos(float %130)
%132 = fneg float %129
%133 = call float @llvm.fmuladd.f32(float %132, float %131, float 0x3FF19999A0000000)
%134 = fdiv float %126, %133
store float %134, float* %22
%135 = load float, float* %26
%136 = load float, float* %23
%137 = call float @cos(float %136)
%138 = load float, float* %23
%139 = call float @sin(float %138)
%140 = fmul float 0xC02594FE00000000, %139
%141 = fneg float %140
%142 = call float @llvm.fmuladd.f32(float %135, float %137, float %141)
%143 = load float, float* %23
%144 = call float @cos(float %143)
%145 = fmul float 0x3FA99999A0000000, %144
%146 = load float, float* %23
%147 = call float @sin(float %146)
%148 = fmul float %145, %147
%149 = load float, float* %24
%150 = call float @llvm.fmuladd.f32(float %148, float %149, float %142)
%151 = load float, float* %23
%152 = call float @cos(float %151)
%153 = fmul float 0x3FA99999A0000000, %152
%154 = load float, float* %23
%155 = call float @cos(float %154)
%156 = call float @llvm.fmuladd.f32(float %153, float %155, float 0xBFE19999A0000000)
%157 = fdiv float %150, %156
store float %157, float* %25
%158 = load float, float* %21
%159 = load float, float* %22
%160 = call float @llvm.fmuladd.f32(float 0x3F999999A0000000, float %159, float %158)
store float %160, float* %21
%161 = load float, float* %24
%162 = load float, float* %25
%163 = call float @llvm.fmuladd.f32(float 0xBF999999A0000000, float %162, float %161)
store float %163, float* %24
%164 = load float, float* %20
%165 = load float, float* %20
%166 = fcmp ogt float %165, 0.000000e+00
%167 = zext i1 %166 to i64
%168 = select i1 %166, i32 1, i32 -1
%169 = sitofp i32 %168 to float
%170 = fmul float %164, %169
%171 = fcmp oge float %170, 0x4003333340000000
br i1 %171, label %182, label %172
172: ; preds = %76
%173 = load float, float* %23
%174 = load float, float* %23
%175 = fcmp ogt float %174, 0.000000e+00
%176 = zext i1 %175 to i64
%177 = select i1 %175, i32 1, i32 -1
%178 = sitofp i32 %177 to float
%179 = fmul float %173, %178
%180 = load float, float* %12
%181 = fcmp ogt float %179, %180
br i1 %181, label %182, label %183
182: ; preds = %172, %76
br label %187
183: ; preds = %172
br label %184
184: ; preds = %183
%185 = load i32, i32* %29
%186 = add nsw i32 %185, 25
store i32 %186, i32* %29
br label %73
187: ; preds = %182, %73
%188 = load i32*, i32** %27
%189 = call i32 @fclose(i32* %188)
%190 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %190, i32** %27
%191 = load i32*, i32** %27
%192 = call i32 (i32*, i8*, ...) @fprintf(i32* %191, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0))
%193 = load i32*, i32** %27
%194 = load i32, i32* %10
%195 = load i32, i32* %29
%196 = load i32, i32* %6
%197 = load i32, i32* %7
%198 = load i32, i32* %8
%199 = load i32, i32* %9
%200 = load float, float* %12
%201 = fpext float %200 to double
%202 = call i32 (i32*, i8*, ...) @fprintf(i32* %193, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %194, i32 %195, i32 %196, i32 %197, i32 %198, i32 %199, i32 25, double 0x4003333340000000, double %201)
%203 = load i32*, i32** %27
%204 = call i32 @fclose(i32* %203)
%205 = load i32, i32* %29
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %205)
store i32 0, i32* %3
br label %207
207: ; preds = %187, %32
%208 = load i32, i32* %3
ret i32 %208
}

LLVM IR (-O2):
@M_PI = global i32 0
@.str.1 = [9 x i8] c"data.txt\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [20 x i8] c"c_position p_angle\0A\00"
@.str.4 = [10 x i8] c"%f %f %f\0A\00"
@.str.5 = [11 x i8] c"header.txt\00"
@.str.6 = [63 x i8] c"generation fitness k l m n time_step fail_position fail_angle\0A\00"
@.str.7 = [28 x i8] c"%d %d %d %d %d %d %d %f %f\0A\00"
@.str.8 = [4 x i8] c"%d\0A\00"
@str = [42 x i8] c"Usage: visualize c1 c2 c3 c4 [generation]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %125
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i8* @atoi(i8* %8)
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i8* @atoi(i8* %13)
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i8* @atoi(i8* %18)
%20 = ptrtoint i8* %19 to i64
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds i8*, i8** %1, i64 4
%23 = load i8*, i8** %22
%24 = tail call i8* @atoi(i8* %23)
%25 = ptrtoint i8* %24 to i64
%26 = trunc i64 %25 to i32
%27 = icmp ugt i32 %0, 5
br i1 %27, label %28, label %34
28: ; preds = %6
%29 = getelementptr inbounds i8*, i8** %1, i64 5
%30 = load i8*, i8** %29
%31 = tail call i8* @atoi(i8* %30)
%32 = ptrtoint i8* %31 to i64
%33 = trunc i64 %32 to i32
br label %34
34: ; preds = %28, %6
%35 = phi i32 [ %33, %28 ], [ -1, %6 ]
%36 = load i32, i32* @M_PI
%37 = sdiv i32 %36, 6
%38 = sitofp i32 %37 to float
%39 = sdiv i32 %36, 36
%40 = sitofp i32 %39 to float
%41 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%42 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 19, i64 1, i32* %41)
%43 = sitofp i32 %11 to float
%44 = sitofp i32 %16 to float
%45 = sitofp i32 %21 to float
%46 = sitofp i32 %26 to float
%47 = insertelement <2 x float> <float 0.000000e+00, float poison>, float %40, i64 1
br label %48
48: ; preds = %34, %113
%49 = phi i32 [ 0, %34 ], [ %114, %113 ]
%50 = phi <2 x float> [ %47, %34 ], [ %52, %113 ]
%51 = phi <2 x float> [ zeroinitializer, %34 ], [ %103, %113 ]
%52 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %51, <2 x float> <float 0x3F999999A0000000, float 0x3F999999A0000000>, <2 x float> %50)
%53 = extractelement <2 x float> %51, i64 0
%54 = fmul float %53, %44
%55 = extractelement <2 x float> %52, i64 0
%56 = tail call float @llvm.fmuladd.f32(float %43, float %55, float %54)
%57 = extractelement <2 x float> %52, i64 1
%58 = tail call float @llvm.fmuladd.f32(float %45, float %57, float %56)
%59 = extractelement <2 x float> %51, i64 1
%60 = tail call float @llvm.fmuladd.f32(float %46, float %59, float %58)
%61 = fmul float %60, 1.000000e+01
%62 = fcmp ogt float %61, 0.000000e+00
%63 = select i1 %62, float 1.000000e+00, float -1.000000e+00
%64 = fpext float %55 to double
%65 = fpext float %57 to double
%66 = fpext float %63 to double
%67 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %64, double %65, double %66)
%68 = tail call float @sin(float %57)
%69 = fmul float %68, 0x3FA99999A0000000
%70 = fmul float %59, %69
%71 = tail call float @cos(float %57)
%72 = tail call float @sin(float %57)
%73 = tail call float @cos(float %57)
%74 = tail call float @cos(float %57)
%75 = tail call float @cos(float %57)
%76 = tail call float @sin(float %57)
%77 = fmul float %76, 0x402594FE00000000
%78 = insertelement <2 x float> poison, float %70, i64 0
%79 = insertelement <2 x float> %78, float %63, i64 1
%80 = insertelement <2 x float> poison, float %59, i64 0
%81 = insertelement <2 x float> %80, float %75, i64 1
%82 = insertelement <2 x float> poison, float %63, i64 0
%83 = insertelement <2 x float> %82, float %77, i64 1
%84 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %79, <2 x float> %81, <2 x float> %83)
%85 = tail call float @cos(float %57)
%86 = fmul float %85, 0x3FA99999A0000000
%87 = tail call float @sin(float %57)
%88 = insertelement <2 x float> <float 0x3FEF645A40000000, float poison>, float %86, i64 1
%89 = insertelement <2 x float> poison, float %71, i64 0
%90 = insertelement <2 x float> %89, float %87, i64 1
%91 = fmul <2 x float> %88, %90
%92 = insertelement <2 x float> %51, float %72, i64 0
%93 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %91, <2 x float> %92, <2 x float> %84)
%94 = tail call float @cos(float %57)
%95 = insertelement <2 x float> poison, float %73, i64 0
%96 = insertelement <2 x float> %95, float %94, i64 1
%97 = fmul <2 x float> %96, <float 0xBFB99999A0000000, float 0x3FA99999A0000000>
%98 = tail call float @cos(float %57)
%99 = insertelement <2 x float> poison, float %74, i64 0
%100 = insertelement <2 x float> %99, float %98, i64 1
%101 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %97, <2 x float> %100, <2 x float> <float 0x3FF19999A0000000, float 0xBFE19999A0000000>)
%102 = fdiv <2 x float> %93, %101
%103 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %102, <2 x float> <float 0x3F999999A0000000, float 0xBF999999A0000000>, <2 x float> %51)
%104 = fcmp ogt float %55, 0.000000e+00
%105 = fneg float %55
%106 = select i1 %104, float %55, float %105
%107 = fcmp ult float %106, 0x4003333340000000
br i1 %107, label %108, label %116
108: ; preds = %48
%109 = fcmp ogt float %57, 0.000000e+00
%110 = fneg float %57
%111 = select i1 %109, float %57, float %110
%112 = fcmp ogt float %111, %38
br i1 %112, label %116, label %113
113: ; preds = %108
%114 = add nuw nsw i32 %49, 25
%115 = icmp ult i32 %49, 59975
br i1 %115, label %48, label %116
116: ; preds = %48, %108, %113
%117 = phi i32 [ %49, %48 ], [ %49, %108 ], [ 60000, %113 ]
%118 = tail call i32 @fclose(i32* %41)
%119 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%120 = tail call i64 @fwrite(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i64 62, i64 1, i32* %119)
%121 = fpext float %38 to double
%122 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %35, i32 %117, i32 %11, i32 %16, i32 %21, i32 %26, i32 25, double 0x4003333340000000, double %121)
%123 = tail call i32 @fclose(i32* %119)
%124 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %117)
br label %125
125: ; preds = %116, %4
%126 = phi i32 [ 1, %4 ], [ 0, %116 ]
ret i32 %126
}