#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 double clock_t;

/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
int EXIT_SUCCESS;
int FE_DIVBYZERO;
int FE_INVALID;
int FE_OVERFLOW;
int FE_UNDERFLOW;
scalar_t__ FLT_EPSILON;
float RAND_MAX;
double clock();
scalar_t__ fabs(float);
int /*<<< orphan*/ feenableexcept(int);
int /*<<< orphan*/ printf(char *, double, ...);
int rand();
int solve_cubic(float, float, float, float, float *);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int seed = time(NULL);
  clock_t t0;
  double dt;
  int i;
  feenableexcept(FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID);
  if (argc == 2) {
    sscanf(argv[1], "%x", &seed);
  }
  srand(seed);
  printf("seed: %x\n", seed);
  for (i = 0; i < 128 * 128; ++i) {
    float a = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float b = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float c = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float d = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float px[3];
    int j;
    int n;
    const char *type = "";
    n = solve_cubic(a, b, c, d, px);
    if (fabs(a) > FLT_EPSILON && fabs(d) > FLT_EPSILON) {
      type = "cubic";
    } else if (fabs(b) > FLT_EPSILON) {
      type = "quadratic";
    } else {
      type = "linear";
    }
    printf("i=%i a=%f b=%f c=%f d=%f n=%i (%s)\n", i, a, b, c, d, n, type);
    for (j = 0; j < n; ++j) {
      float x = px[j];
      float zero = a * x * x * x + b * x * x + c * x + d;
      if (zero * zero <= 1e-5f) {
        printf("\tx%i=%f zero=%f\n", j, x, zero);
      } else {
        printf("\tx%i=%f zero=%f (bad)\n", j, x, zero);
      }
    }
  }
  t0 = clock();
  for (i = 0; i < 1024 * 1024; ++i) {
    float a = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float b = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float c = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float d = (((float)rand()) / RAND_MAX) * ((rand() % 8) - 4);
    float px[3];
    int n;
    n = solve_cubic(a, b, c, d, px);
  }
  dt = (clock() - t0) / ((double)CLOCKS_PER_SEC);
  printf("time: %f\n", dt);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
mov    0x2e0b(%rip),%rax
or     (%rax),%edi
mov    0x2de2(%rip),%rax
or     (%rax),%edi
mov    0x2e19(%rip),%rax
or     (%rax),%edi
call   1060 <feenableexcept@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1200 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0d(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    -0x14(%rbp),%edi
call   1070 <srand@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
lea    0xdf3(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4000,-0x2c(%rbp)
jge    1523 <main+0x393>
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2d97(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x90(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2d52(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x8c(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2d0d(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x88(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2cc8(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x84(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
lea    0xd29(%rip),%rax
mov    %rax,-0x58(%rbp)
movss  -0x30(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
movss  -0x3c(%rbp),%xmm3
lea    -0x48(%rbp),%rdi
call   1030 <solve_cubic@plt>
mov    %eax,-0x50(%rbp)
movss  -0x30(%rbp),%xmm0
call   1080 <fabs@plt>
mov    0x2c39(%rip),%rcx
cmp    (%rcx),%rax
jle    13b2 <main+0x222>
movss  -0x3c(%rbp),%xmm0
call   1080 <fabs@plt>
mov    0x2c1f(%rip),%rcx
cmp    (%rcx),%rax
jle    13b2 <main+0x222>
lea    0xc68(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    13ec <main+0x25c>
movss  -0x34(%rbp),%xmm0
call   1080 <fabs@plt>
mov    0x2bf5(%rip),%rcx
cmp    (%rcx),%rax
jle    13dc <main+0x24c>
lea    0xc44(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    13e7 <main+0x257>
lea    0xc3e(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    13ec <main+0x25c>
cvtsi2sdl -0x2c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x34(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x38(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x3c(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
mov    -0x50(%rbp),%esi
mov    -0x58(%rbp),%rdx
lea    0xc05(%rip),%rdi
mov    $0x5,%al
call   1050 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1510 <main+0x380>
movslq -0x4c(%rbp),%rax
movss  -0x48(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x30(%rbp),%xmm1
mulss  -0x5c(%rbp),%xmm1
mulss  -0x5c(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm2
movss  -0x34(%rbp),%xmm0
mulss  -0x5c(%rbp),%xmm0
mulss  -0x5c(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
movss  -0x5c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x60(%rbp),%xmm1
mulss  -0x60(%rbp),%xmm1
movss  0xb5b(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     14d8 <main+0x348>
cvtsi2sdl -0x4c(%rbp),%xmm0
movss  -0x5c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x60(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xb80(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
jmp    14fd <main+0x36d>
cvtsi2sdl -0x4c(%rbp),%xmm0
movss  -0x5c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x60(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xb67(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
jmp    1502 <main+0x372>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1431 <main+0x2a1>
jmp    1515 <main+0x385>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1222 <main+0x92>
mov    $0x0,%al
call   1040 <clock@plt>
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x100000,-0x2c(%rbp)
jge    1685 <main+0x4f5>
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2a83(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0xa0(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x2a3e(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x9c(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x29f9(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x98(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x98(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2ss %eax,%xmm0
mov    0x29b4(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x94(%rbp)
ff
mov    $0x0,%al
call   10b0 <rand@plt>
movss  -0x94(%rbp),%xmm0
ff
mov    $0x8,%ecx
cltd
idiv   %ecx
sub    $0x4,%edx
cvtsi2ss %edx,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x64(%rbp),%xmm0
movss  -0x68(%rbp),%xmm1
movss  -0x6c(%rbp),%xmm2
movss  -0x70(%rbp),%xmm3
lea    -0x7c(%rbp),%rdi
call   1030 <solve_cubic@plt>
mov    %eax,-0x80(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1536 <main+0x3a6>
mov    $0x0,%al
call   1040 <clock@plt>
subsd  -0x20(%rbp),%xmm0
mov    0x2948(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0x9c2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x28e8(%rip),%rax
mov    (%rax),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
xor    %edi,%edi
call   1090 <time@plt>
mov    0x2e17(%rip),%rcx
mov    0x2e18(%rip),%rdx
mov    (%rdx),%edi
or     (%rcx),%edi
mov    %eax,%ebp
mov    0x2deb(%rip),%rax
or     (%rax),%edi
mov    %ebp,0x1c(%rsp)
mov    0x2e1e(%rip),%rax
or     (%rax),%edi
call   1060 <feenableexcept@plt>
cmp    $0x2,%ebx
jne    11f7 <main+0x67>
mov    0x8(%r14),%rdi
lea    0xe27(%rip),%rsi
lea    0x1c(%rsp),%rdx
call   10a0 <sscanf@plt>
mov    0x1c(%rsp),%ebp
mov    %ebp,%edi
call   1070 <srand@plt>
cvtsi2sdl 0x1c(%rsp),%xmm0
lea    0xe08(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x2db5(%rip),%rbp
mov    0x2d8e(%rip),%rbx
lea    0xe38(%rip),%r13
lea    0xe20(%rip),%r14
xor    %r15d,%r15d
jmp    126c <main+0xdc>
nopl   (%rax)
movsd  0x20(%rsp),%xmm0
addsd  0xdba(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
add    $0x1,%r15d
cmp    $0x4000,%r15d
mov    0x2d72(%rip),%rbp
je     14bf <main+0x32f>
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
cvtsi2ss %eax,%xmm3
mulss  0x18(%rsp),%xmm3
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  %xmm3,0x18(%rsp)
lea    0x2c(%rsp),%rdi
call   1030 <solve_cubic@plt>
mov    %eax,%ebp
movss  0x10(%rsp),%xmm0
call   1080 <fabs@plt>
cmp    (%rbx),%rax
jle    13c2 <main+0x232>
movss  0x18(%rsp),%xmm0
call   1080 <fabs@plt>
lea    0xc60(%rip),%rdx
cmp    (%rbx),%rax
jg     13e2 <main+0x252>
movss  0xc(%rsp),%xmm0
call   1080 <fabs@plt>
cmp    (%rbx),%rax
lea    0xc56(%rip),%rdx
lea    0xc45(%rip),%rax
cmovg  %rax,%rdx
movss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movss  0x14(%rsp),%xmm0
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm4
lea    0xc1a(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    %ebp,%esi
mov    $0x5,%al
call   1050 <printf@plt>
test   %ebp,%ebp
jle    1240 <main+0xb0>
mov    %ebp,%ebp
xor    %r12d,%r12d
jmp    1464 <main+0x2d4>
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     1240 <main+0xb0>
movss  0x2c(%rsp,%r12,4),%xmm1
movss  0x10(%rsp),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
movss  0x14(%rsp),%xmm2
mulss  %xmm1,%xmm2
addss  %xmm0,%xmm2
addss  0x18(%rsp),%xmm2
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
movss  0xb4e(%rip),%xmm3
ucomiss %xmm0,%xmm3
mov    %r13,%rdi
jb     1440 <main+0x2b0>
mov    %r14,%rdi
jmp    1440 <main+0x2b0>
xor    %eax,%eax
call   1040 <clock@plt>
movsd  %xmm0,0x20(%rsp)
mov    $0x100000,%ebx
lea    0x2c(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x0(%rbp),%xmm0
movss  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xfffffffc,%eax
cvtsi2ss %eax,%xmm3
mulss  0x18(%rsp),%xmm3
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
mov    %r14,%rdi
call   1030 <solve_cubic@plt>
add    $0xffffffff,%ebx
jne    14e0 <main+0x350>
xor    %eax,%eax
call   1040 <clock@plt>
subsd  0x20(%rsp),%xmm0
mov    0x29be(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
lea    0xa4b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2965(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@FE_DIVBYZERO = global i32 0
@FE_UNDERFLOW = global i32 0
@FE_OVERFLOW = global i32 0
@FE_INVALID = global i32 0
@.str = [3 x i8] c"%x\00"
@.str.1 = [10 x i8] c"seed: %x\0A\00"
@RAND_MAX = global float 0.000000e+00
@.str.2 = [1 x i8] zeroinitializer
@FLT_EPSILON = global i64 0
@.str.3 = [6 x i8] c"cubic\00"
@.str.4 = [10 x i8] c"quadratic\00"
@.str.5 = [7 x i8] c"linear\00"
@.str.6 = [36 x i8] c"i=%i a=%f b=%f c=%f d=%f n=%i (%s)\0A\00"
@.str.7 = [17 x i8] c"\09x%i=%f zero=%f\0A\00"
@.str.8 = [23 x i8] c"\09x%i=%f zero=%f (bad)\0A\00"
@CLOCKS_PER_SEC = global i64 0
@.str.9 = [10 x i8] c"time: %f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca [3 x float]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca [3 x float]
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = call i32 @time(i32* null)
store i32 %26, i32* %6
%27 = load i32, i32* @FE_DIVBYZERO
%28 = load i32, i32* @FE_UNDERFLOW
%29 = or i32 %27, %28
%30 = load i32, i32* @FE_OVERFLOW
%31 = or i32 %29, %30
%32 = load i32, i32* @FE_INVALID
%33 = or i32 %31, %32
%34 = call i32 @feenableexcept(i32 %33)
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 2
br i1 %36, label %37, label %42
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @sscanf(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %42
42: ; preds = %37, %2
%43 = load i32, i32* %6
%44 = call i32 @srand(i32 %43)
%45 = load i32, i32* %6
%46 = sitofp i32 %45 to double
%47 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %46)
store i32 0, i32* %9
br label %48
48: ; preds = %177, %42
%49 = load i32, i32* %9
%50 = icmp slt i32 %49, 16384
br i1 %50, label %51, label %180
51: ; preds = %48
%52 = call i32 (...) @rand()
%53 = sitofp i32 %52 to float
%54 = load float, float* @RAND_MAX
%55 = fdiv float %53, %54
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 8
%58 = sub nsw i32 %57, 4
%59 = sitofp i32 %58 to float
%60 = fmul float %55, %59
store float %60, float* %10
%61 = call i32 (...) @rand()
%62 = sitofp i32 %61 to float
%63 = load float, float* @RAND_MAX
%64 = fdiv float %62, %63
%65 = call i32 (...) @rand()
%66 = srem i32 %65, 8
%67 = sub nsw i32 %66, 4
%68 = sitofp i32 %67 to float
%69 = fmul float %64, %68
store float %69, float* %11
%70 = call i32 (...) @rand()
%71 = sitofp i32 %70 to float
%72 = load float, float* @RAND_MAX
%73 = fdiv float %71, %72
%74 = call i32 (...) @rand()
%75 = srem i32 %74, 8
%76 = sub nsw i32 %75, 4
%77 = sitofp i32 %76 to float
%78 = fmul float %73, %77
store float %78, float* %12
%79 = call i32 (...) @rand()
%80 = sitofp i32 %79 to float
%81 = load float, float* @RAND_MAX
%82 = fdiv float %80, %81
%83 = call i32 (...) @rand()
%84 = srem i32 %83, 8
%85 = sub nsw i32 %84, 4
%86 = sitofp i32 %85 to float
%87 = fmul float %82, %86
store float %87, float* %13
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %17
%88 = load float, float* %10
%89 = load float, float* %11
%90 = load float, float* %12
%91 = load float, float* %13
%92 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%93 = call i32 @solve_cubic(float %88, float %89, float %90, float %91, float* %92)
store i32 %93, i32* %16
%94 = load float, float* %10
%95 = call i64 @fabs(float %94)
%96 = load i64, i64* @FLT_EPSILON
%97 = icmp sgt i64 %95, %96
br i1 %97, label %98, label %104
98: ; preds = %51
%99 = load float, float* %13
%100 = call i64 @fabs(float %99)
%101 = load i64, i64* @FLT_EPSILON
%102 = icmp sgt i64 %100, %101
br i1 %102, label %103, label %104
103: ; preds = %98
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %17
br label %112
104: ; preds = %98, %51
%105 = load float, float* %11
%106 = call i64 @fabs(float %105)
%107 = load i64, i64* @FLT_EPSILON
%108 = icmp sgt i64 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %104
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %17
br label %111
110: ; preds = %104
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %17
br label %111
111: ; preds = %110, %109
br label %112
112: ; preds = %111, %103
%113 = load i32, i32* %9
%114 = sitofp i32 %113 to double
%115 = load float, float* %10
%116 = fpext float %115 to double
%117 = load float, float* %11
%118 = fpext float %117 to double
%119 = load float, float* %12
%120 = fpext float %119 to double
%121 = load float, float* %13
%122 = fpext float %121 to double
%123 = load i32, i32* %16
%124 = load i8*, i8** %17
%125 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %114, double %116, double %118, double %120, double %122, i32 %123, i8* %124)
store i32 0, i32* %15
br label %126
126: ; preds = %173, %112
%127 = load i32, i32* %15
%128 = load i32, i32* %16
%129 = icmp slt i32 %127, %128
br i1 %129, label %130, label %176
130: ; preds = %126
%131 = load i32, i32* %15
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 %132
%134 = load float, float* %133
store float %134, float* %18
%135 = load float, float* %10
%136 = load float, float* %18
%137 = fmul float %135, %136
%138 = load float, float* %18
%139 = fmul float %137, %138
%140 = load float, float* %18
%141 = load float, float* %11
%142 = load float, float* %18
%143 = fmul float %141, %142
%144 = load float, float* %18
%145 = fmul float %143, %144
%146 = call float @llvm.fmuladd.f32(float %139, float %140, float %145)
%147 = load float, float* %12
%148 = load float, float* %18
%149 = call float @llvm.fmuladd.f32(float %147, float %148, float %146)
%150 = load float, float* %13
%151 = fadd float %149, %150
store float %151, float* %19
%152 = load float, float* %19
%153 = load float, float* %19
%154 = fmul float %152, %153
%155 = fcmp ole float %154, 0x3EE4F8B580000000
br i1 %155, label %156, label %164
156: ; preds = %130
%157 = load i32, i32* %15
%158 = sitofp i32 %157 to double
%159 = load float, float* %18
%160 = fpext float %159 to double
%161 = load float, float* %19
%162 = fpext float %161 to double
%163 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), double %158, double %160, double %162)
br label %172
164: ; preds = %130
%165 = load i32, i32* %15
%166 = sitofp i32 %165 to double
%167 = load float, float* %18
%168 = fpext float %167 to double
%169 = load float, float* %19
%170 = fpext float %169 to double
%171 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), double %166, double %168, double %170)
br label %172
172: ; preds = %164, %156
br label %173
173: ; preds = %172
%174 = load i32, i32* %15
%175 = add nsw i32 %174, 1
store i32 %175, i32* %15
br label %126
176: ; preds = %126
br label %177
177: ; preds = %176
%178 = load i32, i32* %9
%179 = add nsw i32 %178, 1
store i32 %179, i32* %9
br label %48
180: ; preds = %48
%181 = call double (...) @clock()
store double %181, double* %7
store i32 0, i32* %9
br label %182
182: ; preds = %228, %180
%183 = load i32, i32* %9
%184 = icmp slt i32 %183, 1048576
br i1 %184, label %185, label %231
185: ; preds = %182
%186 = call i32 (...) @rand()
%187 = sitofp i32 %186 to float
%188 = load float, float* @RAND_MAX
%189 = fdiv float %187, %188
%190 = call i32 (...) @rand()
%191 = srem i32 %190, 8
%192 = sub nsw i32 %191, 4
%193 = sitofp i32 %192 to float
%194 = fmul float %189, %193
store float %194, float* %20
%195 = call i32 (...) @rand()
%196 = sitofp i32 %195 to float
%197 = load float, float* @RAND_MAX
%198 = fdiv float %196, %197
%199 = call i32 (...) @rand()
%200 = srem i32 %199, 8
%201 = sub nsw i32 %200, 4
%202 = sitofp i32 %201 to float
%203 = fmul float %198, %202
store float %203, float* %21
%204 = call i32 (...) @rand()
%205 = sitofp i32 %204 to float
%206 = load float, float* @RAND_MAX
%207 = fdiv float %205, %206
%208 = call i32 (...) @rand()
%209 = srem i32 %208, 8
%210 = sub nsw i32 %209, 4
%211 = sitofp i32 %210 to float
%212 = fmul float %207, %211
store float %212, float* %22
%213 = call i32 (...) @rand()
%214 = sitofp i32 %213 to float
%215 = load float, float* @RAND_MAX
%216 = fdiv float %214, %215
%217 = call i32 (...) @rand()
%218 = srem i32 %217, 8
%219 = sub nsw i32 %218, 4
%220 = sitofp i32 %219 to float
%221 = fmul float %216, %220
store float %221, float* %23
%222 = load float, float* %20
%223 = load float, float* %21
%224 = load float, float* %22
%225 = load float, float* %23
%226 = getelementptr inbounds [3 x float], [3 x float]* %24, i64 0, i64 0
%227 = call i32 @solve_cubic(float %222, float %223, float %224, float %225, float* %226)
store i32 %227, i32* %25
br label %228
228: ; preds = %185
%229 = load i32, i32* %9
%230 = add nsw i32 %229, 1
store i32 %230, i32* %9
br label %182
231: ; preds = %182
%232 = call double (...) @clock()
%233 = load double, double* %7
%234 = fsub double %232, %233
%235 = load i64, i64* @CLOCKS_PER_SEC
%236 = sitofp i64 %235 to double
%237 = fdiv double %234, %236
store double %237, double* %8
%238 = load double, double* %8
%239 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), double %238)
%240 = load i32, i32* @EXIT_SUCCESS
ret i32 %240
}

LLVM IR (-O2):
@FE_DIVBYZERO = global i32 0
@FE_UNDERFLOW = global i32 0
@FE_OVERFLOW = global i32 0
@FE_INVALID = global i32 0
@.str = [3 x i8] c"%x\00"
@.str.1 = [10 x i8] c"seed: %x\0A\00"
@RAND_MAX = global float 0.000000e+00
@FLT_EPSILON = global i64 0
@.str.3 = [6 x i8] c"cubic\00"
@.str.4 = [10 x i8] c"quadratic\00"
@.str.5 = [7 x i8] c"linear\00"
@.str.6 = [36 x i8] c"i=%i a=%f b=%f c=%f d=%f n=%i (%s)\0A\00"
@.str.7 = [17 x i8] c"\09x%i=%f zero=%f\0A\00"
@.str.8 = [23 x i8] c"\09x%i=%f zero=%f (bad)\0A\00"
@CLOCKS_PER_SEC = global i64 0
@.str.9 = [10 x i8] c"time: %f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [3 x float]
%5 = alloca [3 x float]
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %3
%8 = load i32, i32* @FE_DIVBYZERO
%9 = load i32, i32* @FE_UNDERFLOW
%10 = or i32 %9, %8
%11 = load i32, i32* @FE_OVERFLOW
%12 = or i32 %10, %11
%13 = load i32, i32* @FE_INVALID
%14 = or i32 %12, %13
%15 = tail call i32 @feenableexcept(i32 %14)
%16 = icmp eq i32 %0, 2
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
br label %22
22: ; preds = %17, %2
%23 = phi i32 [ %21, %17 ], [ %7, %2 ]
%24 = call i32 @srand(i32 %23)
%25 = load i32, i32* %3
%26 = sitofp i32 %25 to double
%27 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = bitcast [3 x float]* %4 to i8*
%29 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 0
br label %30
30: ; preds = %22, %113
%31 = phi i32 [ 0, %22 ], [ %114, %113 ]
%32 = call i32 (...) @rand()
%33 = sitofp i32 %32 to float
%34 = load float, float* @RAND_MAX
%35 = fdiv float %33, %34
%36 = call i32 (...) @rand()
%37 = srem i32 %36, 8
%38 = add nsw i32 %37, -4
%39 = sitofp i32 %38 to float
%40 = fmul float %35, %39
%41 = call i32 (...) @rand()
%42 = sitofp i32 %41 to float
%43 = load float, float* @RAND_MAX
%44 = fdiv float %42, %43
%45 = call i32 (...) @rand()
%46 = srem i32 %45, 8
%47 = add nsw i32 %46, -4
%48 = sitofp i32 %47 to float
%49 = fmul float %44, %48
%50 = call i32 (...) @rand()
%51 = sitofp i32 %50 to float
%52 = load float, float* @RAND_MAX
%53 = fdiv float %51, %52
%54 = call i32 (...) @rand()
%55 = srem i32 %54, 8
%56 = add nsw i32 %55, -4
%57 = sitofp i32 %56 to float
%58 = fmul float %53, %57
%59 = call i32 (...) @rand()
%60 = sitofp i32 %59 to float
%61 = load float, float* @RAND_MAX
%62 = fdiv float %60, %61
%63 = call i32 (...) @rand()
%64 = srem i32 %63, 8
%65 = add nsw i32 %64, -4
%66 = sitofp i32 %65 to float
%67 = fmul float %62, %66
%68 = call i32 @solve_cubic(float %40, float %49, float %58, float %67, float* %29)
%69 = call i64 @fabs(float %40)
%70 = load i64, i64* @FLT_EPSILON
%71 = icmp sgt i64 %69, %70
br i1 %71, label %72, label %76
72: ; preds = %30
%73 = call i64 @fabs(float %67)
%74 = load i64, i64* @FLT_EPSILON
%75 = icmp sgt i64 %73, %74
br i1 %75, label %81, label %76
76: ; preds = %72, %30
%77 = call i64 @fabs(float %49)
%78 = load i64, i64* @FLT_EPSILON
%79 = icmp sgt i64 %77, %78
%80 = select i1 %79, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0)
br label %81
81: ; preds = %76, %72
%82 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %72 ], [ %80, %76 ]
%83 = sitofp i32 %31 to double
%84 = fpext float %40 to double
%85 = fpext float %49 to double
%86 = fpext float %58 to double
%87 = fpext float %67 to double
%88 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %83, double %84, double %85, double %86, double %87, i32 %68, i8* %82)
%89 = icmp sgt i32 %68, 0
br i1 %89, label %90, label %113
90: ; preds = %81
%91 = zext i32 %68 to i64
br label %92
92: ; preds = %90, %92
%93 = phi i64 [ 0, %90 ], [ %111, %92 ]
%94 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 %93
%95 = load float, float* %94
%96 = fmul float %40, %95
%97 = fmul float %95, %96
%98 = fmul float %49, %95
%99 = fmul float %95, %98
%100 = call float @llvm.fmuladd.f32(float %97, float %95, float %99)
%101 = call float @llvm.fmuladd.f32(float %58, float %95, float %100)
%102 = fadd float %67, %101
%103 = fmul float %102, %102
%104 = fcmp ugt float %103, 0x3EE4F8B580000000
%105 = trunc i64 %93 to i32
%106 = sitofp i32 %105 to double
%107 = fpext float %95 to double
%108 = fpext float %102 to double
%109 = select i1 %104, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0)
%110 = call i32 (i8*, double, ...) @printf(i8* %109, double %106, double %107, double %108)
%111 = add nuw nsw i64 %93, 1
%112 = icmp eq i64 %111, %91
br i1 %112, label %113, label %92
113: ; preds = %92, %81
%114 = add nuw nsw i32 %31, 1
%115 = icmp eq i32 %114, 16384
br i1 %115, label %116, label %30
116: ; preds = %113
%117 = call double (...) @clock()
%118 = bitcast [3 x float]* %5 to i8*
%119 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
br label %120
120: ; preds = %116, %120
%121 = phi i32 [ 0, %116 ], [ %159, %120 ]
%122 = call i32 (...) @rand()
%123 = sitofp i32 %122 to float
%124 = load float, float* @RAND_MAX
%125 = fdiv float %123, %124
%126 = call i32 (...) @rand()
%127 = srem i32 %126, 8
%128 = add nsw i32 %127, -4
%129 = sitofp i32 %128 to float
%130 = fmul float %125, %129
%131 = call i32 (...) @rand()
%132 = sitofp i32 %131 to float
%133 = load float, float* @RAND_MAX
%134 = fdiv float %132, %133
%135 = call i32 (...) @rand()
%136 = srem i32 %135, 8
%137 = add nsw i32 %136, -4
%138 = sitofp i32 %137 to float
%139 = fmul float %134, %138
%140 = call i32 (...) @rand()
%141 = sitofp i32 %140 to float
%142 = load float, float* @RAND_MAX
%143 = fdiv float %141, %142
%144 = call i32 (...) @rand()
%145 = srem i32 %144, 8
%146 = add nsw i32 %145, -4
%147 = sitofp i32 %146 to float
%148 = fmul float %143, %147
%149 = call i32 (...) @rand()
%150 = sitofp i32 %149 to float
%151 = load float, float* @RAND_MAX
%152 = fdiv float %150, %151
%153 = call i32 (...) @rand()
%154 = srem i32 %153, 8
%155 = add nsw i32 %154, -4
%156 = sitofp i32 %155 to float
%157 = fmul float %152, %156
%158 = call i32 @solve_cubic(float %130, float %139, float %148, float %157, float* %119)
%159 = add nuw nsw i32 %121, 1
%160 = icmp eq i32 %159, 1048576
br i1 %160, label %161, label %120
161: ; preds = %120
%162 = call double (...) @clock()
%163 = fsub double %162, %117
%164 = load i64, i64* @CLOCKS_PER_SEC
%165 = sitofp i64 %164 to double
%166 = fdiv double %163, %165
%167 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), double %166)
%168 = load i32, i32* @EXIT_SUCCESS
ret i32 %168
}