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

/* Variables and functions */
int P_rational_roots(long *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
long *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
long strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wall_clock_status(char *);
int main(int argc, char **argv) {
  long *coefficients;
  int n, terms;
  register int i;
  terms = argc - 1;
  n = terms - 1;
  if (n < 1) {
    fputs("Not a solvable polynomial.\n", stderr);
    return 1;
  }
  coefficients = malloc(sizeof(long) * terms);
  if (coefficients == NULL) {
    fputs("Too complex to solve with currently available RAM.\n", stderr);
    return -1;
  }
  for (i = 0; i < terms; i++)
    coefficients[i] = strtol(argv[i + 1], NULL, 0);
  if (coefficients[n - n] == 0) {
    fprintf(stderr,
            "Not a standard polynomial:  %s\n"
            "Try again without the \"%s\" at the beginning.\n",
            "Lead coefficient must be a real, nonzero number.", argv[0 + 1]);
    return -1;
  }
  if (coefficients[n - n] < 0)
    for (i = 0; i < terms; i++)
      coefficients[i] = -coefficients[i];
  puts("Now solving polynomial function for x, when f(x) = 0:");
  if (coefficients[n - n] == 1) {
  } else
    printf("%lu", coefficients[n - n]);
  putchar('x');
  if (n > 1)
    printf("^%u", n);
  putchar(' ');
  for (i = 0 + 1; i < terms - 1; i++) {
    if (coefficients[i] == 0)
      continue;
    if (coefficients[i] == -1)
      fputs("+ -x", stdout);
    else if (coefficients[i] == +1)
      fputs("+ x", stdout);
    else
      printf("+ %ldx", coefficients[i]);
    if (n - i > 1)
      printf("^%u", n - i);
    putchar(' ');
  }
  printf("+ %ld = 0", coefficients[n]);
  putchar('\n');
  wall_clock_status("Time spent decoding polynomial");
  putchar('\n');
  i = P_rational_roots(coefficients, n);
  printf("Total solutions found:  %i\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    11e3 <main+0x53>
mov    0x2e17(%rip),%rax
mov    (%rax),%esi
lea    0xe2e(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c4 <main+0x334>
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1222 <main+0x92>
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
lea    0xe0b(%rip),%rdi
call   1060 <fputs@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c4 <main+0x334>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    126e <main+0xde>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1229 <main+0x99>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12b6 <main+0x126>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdb2(%rip),%rsi
lea    0xdf8(%rip),%rdx
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c4 <main+0x334>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
jge    130e <main+0x17e>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1309 <main+0x179>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
xor    %edx,%edx
sub    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12d5 <main+0x145>
jmp    130e <main+0x17e>
lea    0xdb9(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
cmpq   $0x1,(%rax,%rcx,8)
jne    1337 <main+0x1a7>
jmp    1356 <main+0x1c6>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xdb3(%rip),%rdi
call   1050 <printf@plt>
mov    $0x78,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0x1c(%rbp)
jle    1379 <main+0x1e9>
mov    -0x1c(%rbp),%esi
lea    0xd94(%rip),%rdi
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1465 <main+0x2d5>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    13b3 <main+0x223>
jmp    1457 <main+0x2c7>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0xffffffffffffffff,(%rax,%rcx,8)
jne    13e0 <main+0x250>
mov    0x2c0b(%rip),%rax
mov    (%rax),%esi
lea    0xd36(%rip),%rdi
call   1060 <fputs@plt>
jmp    142c <main+0x29c>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x1,(%rax,%rcx,8)
jne    140d <main+0x27d>
mov    0x2bde(%rip),%rax
mov    (%rax),%esi
lea    0xd0e(%rip),%rdi
call   1060 <fputs@plt>
jmp    1427 <main+0x297>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xcf3(%rip),%rdi
call   1050 <printf@plt>
jmp    142c <main+0x29c>
mov    -0x1c(%rbp),%eax
sub    -0x24(%rbp),%eax
cmp    $0x1,%eax
jle    144d <main+0x2bd>
mov    -0x1c(%rbp),%esi
sub    -0x24(%rbp),%esi
lea    0xcc0(%rip),%rdi
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    138a <main+0x1fa>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xca2(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc96(%rip),%rdi
call   10b0 <wall_clock_status@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10a0 <P_rational_roots@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xc8d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jg     11c2 <main+0x32>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
lea    0xe4d(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%eax
jmp    14e2 <main+0x352>
mov    %rsi,%rbx
mov    %edi,%r15d
lea    -0x1(%r15),%ebp
lea    0x0(,%rbp,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     12f2 <main+0x162>
mov    %rax,%r12
lea    -0x2(%r15),%eax
mov    %eax,0xc(%rsp)
mov    %rbp,0x10(%rsp)
mov    %ebp,%r14d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbp),%r13
mov    0x8(%rbx,%rbp,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,(%r12,%rbp,8)
mov    %r13,%rbp
cmp    %r13,%r14
jne    1200 <main+0x70>
mov    (%r12),%rax
test   %rax,%rax
je     1311 <main+0x181>
jns    138d <main+0x1fd>
neg    %rax
mov    %rax,(%r12)
cmpl   $0x1,0x10(%rsp)
je     138d <main+0x1fd>
lea    -0x1(%r14),%rcx
mov    $0x1,%eax
cmp    $0x4,%rcx
jb     1380 <main+0x1f0>
mov    %rcx,%rax
and    $0xfffffffffffffffc,%rax
lea    -0x4(%rax),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     133b <main+0x1ab>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqu (%r12,%rdx,8),%xmm0
movdqu 0x10(%r12,%rdx,8),%xmm1
movdqu 0x20(%r12,%rdx,8),%xmm2
movdqu 0x30(%r12,%rdx,8),%xmm3
pxor   %xmm4,%xmm4
psubq  %xmm0,%xmm4
pxor   %xmm0,%xmm0
psubq  %xmm1,%xmm0
movdqu %xmm4,(%r12,%rdx,8)
movdqu %xmm0,0x10(%r12,%rdx,8)
pxor   %xmm0,%xmm0
psubq  %xmm2,%xmm0
pxor   %xmm1,%xmm1
psubq  %xmm3,%xmm1
movdqu %xmm0,0x20(%r12,%rdx,8)
movdqu %xmm1,0x30(%r12,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1290 <main+0x100>
jmp    1340 <main+0x1b0>
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
lea    0xd1a(%rip),%rdi
call   1060 <fputs@plt>
mov    $0xffffffff,%eax
jmp    14e2 <main+0x352>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
lea    0xd2b(%rip),%rsi
lea    0xd71(%rip),%rdx
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    14e2 <main+0x352>
mov    $0x1,%edx
test   $0x1,%sil
je     1370 <main+0x1e0>
movdqu (%r12,%rdx,8),%xmm0
movdqu 0x10(%r12,%rdx,8),%xmm1
pxor   %xmm2,%xmm2
pxor   %xmm3,%xmm3
psubq  %xmm0,%xmm3
psubq  %xmm1,%xmm2
movdqu %xmm3,(%r12,%rdx,8)
movdqu %xmm2,0x10(%r12,%rdx,8)
cmp    %rax,%rcx
je     138d <main+0x1fd>
or     $0x1,%rax
nopl   0x0(%rax)
negq   (%r12,%rax,8)
add    $0x1,%rax
cmp    %rax,%r14
jne    1380 <main+0x1f0>
lea    0xd3a(%rip),%rdi
call   1040 <puts@plt>
mov    (%r12),%rsi
cmp    $0x1,%rsi
je     13af <main+0x21f>
lea    0xd5a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x78,%edi
call   1030 <putchar@plt>
cmp    $0x3,%r15d
jle    1487 <main+0x2f7>
lea    0xd3e(%rip),%rbp
mov    %rbp,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%ebx
add    $0xfffffffd,%r15d
mov    $0x1,%r13d
mov    0x2be3(%rip),%r14
jmp    1422 <main+0x292>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15d,%esi
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0xffffffff,%r15d
cmp    %r13,%rbx
je     1491 <main+0x301>
mov    (%r12,%r13,8),%rsi
cmp    $0x1,%rsi
je     1450 <main+0x2c0>
test   %rsi,%rsi
je     1415 <main+0x285>
cmp    $0xffffffffffffffff,%rsi
jne    1470 <main+0x2e0>
mov    (%r14),%esi
lea    0xccb(%rip),%rdi
jmp    145a <main+0x2ca>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14),%esi
lea    0xcb7(%rip),%rdi
call   1060 <fputs@plt>
cmp    $0x2,%r15d
jl     140b <main+0x27b>
jmp    1400 <main+0x270>
nopw   0x0(%rax,%rax,1)
lea    0xc9e(%rip),%rdi
call   1050 <printf@plt>
cmp    $0x2,%r15d
jl     140b <main+0x27b>
jmp    1400 <main+0x270>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ebx
movslq %ebx,%rax
mov    (%r12,%rax,8),%esi
lea    0xc79(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc6d(%rip),%rdi
call   10b0 <wall_clock_status@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   10a0 <P_rational_roots@plt>
lea    0xc6c(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Not a solvable polynomial.\0A\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"Too complex to solve with currently available RAM.\0A\00"
@.str.2 = [77 x i8] c"Not a standard polynomial: %s\0ATry again without the \22%s\22 at the beginning.\0A\00"
@.str.3 = [49 x i8] c"Lead coefficient must be a real, nonzero number.\00"
@.str.4 = [54 x i8] c"Now solving polynomial function for x, when f(x) = 0:\00"
@.str.5 = [4 x i8] c"%lu\00"
@.str.6 = [4 x i8] c"^%u\00"
@.str.7 = [5 x i8] c"+ -x\00"
@stdout = global i32 0
@.str.8 = [4 x i8] c"+ x\00"
@.str.9 = [7 x i8] c"+ %ldx\00"
@.str.10 = [10 x i8] c"+ %ld = 0\00"
@.str.11 = [31 x i8] c"Time spent decoding polynomial\00"
@.str.12 = [28 x i8] c"Total solutions found: %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %17)
store i32 1, i32* %3
br label %197
19: ; preds = %2
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = mul i64 8, %21
%23 = trunc i64 %22 to i32
%24 = call i64* @malloc(i32 %23)
store i64* %24, i64** %6
%25 = load i64*, i64** %6
%26 = icmp eq i64* %25, null
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %28)
store i32 -1, i32* %3
br label %197
30: ; preds = %19
store i32 0, i32* %9
br label %31
31: ; preds = %47, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %50
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strtol(i8* %41, i32* null, i32 0)
%43 = load i64*, i64** %6
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i64, i64* %43, i64 %45
store i64 %42, i64* %46
br label %47
47: ; preds = %35
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %31
50: ; preds = %31
%51 = load i64*, i64** %6
%52 = load i32, i32* %7
%53 = load i32, i32* %7
%54 = sub nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i64, i64* %51, i64 %55
%57 = load i64, i64* %56
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %65
59: ; preds = %50
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* %63)
store i32 -1, i32* %3
br label %197
65: ; preds = %50
%66 = load i64*, i64** %6
%67 = load i32, i32* %7
%68 = load i32, i32* %7
%69 = sub nsw i32 %67, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i64, i64* %66, i64 %70
%72 = load i64, i64* %71
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %94
74: ; preds = %65
store i32 0, i32* %9
br label %75
75: ; preds = %90, %74
%76 = load i32, i32* %9
%77 = load i32, i32* %8
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %93
79: ; preds = %75
%80 = load i64*, i64** %6
%81 = load i32, i32* %9
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i64, i64* %80, i64 %82
%84 = load i64, i64* %83
%85 = sub nsw i64 0, %84
%86 = load i64*, i64** %6
%87 = load i32, i32* %9
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i64, i64* %86, i64 %88
store i64 %85, i64* %89
br label %90
90: ; preds = %79
%91 = load i32, i32* %9
%92 = add nsw i32 %91, 1
store i32 %92, i32* %9
br label %75
93: ; preds = %75
br label %94
94: ; preds = %93, %65
%95 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%96 = load i64*, i64** %6
%97 = load i32, i32* %7
%98 = load i32, i32* %7
%99 = sub nsw i32 %97, %98
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i64, i64* %96, i64 %100
%102 = load i64, i64* %101
%103 = icmp eq i64 %102, 1
br i1 %103, label %104, label %105
104: ; preds = %94
br label %115
105: ; preds = %94
%106 = load i64*, i64** %6
%107 = load i32, i32* %7
%108 = load i32, i32* %7
%109 = sub nsw i32 %107, %108
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i64, i64* %106, i64 %110
%112 = load i64, i64* %111
%113 = trunc i64 %112 to i32
%114 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %113)
br label %115
115: ; preds = %105, %104
%116 = call i32 @putchar(i8 signext 120)
%117 = load i32, i32* %7
%118 = icmp sgt i32 %117, 1
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = load i32, i32* %7
%121 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %120)
br label %122
122: ; preds = %119, %115
%123 = call i32 @putchar(i8 signext 32)
store i32 1, i32* %9
br label %124
124: ; preds = %178, %122
%125 = load i32, i32* %9
%126 = load i32, i32* %8
%127 = sub nsw i32 %126, 1
%128 = icmp slt i32 %125, %127
br i1 %128, label %129, label %181
129: ; preds = %124
%130 = load i64*, i64** %6
%131 = load i32, i32* %9
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i64, i64* %130, i64 %132
%134 = load i64, i64* %133
%135 = icmp eq i64 %134, 0
br i1 %135, label %136, label %137
136: ; preds = %129
br label %178
137: ; preds = %129
%138 = load i64*, i64** %6
%139 = load i32, i32* %9
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i64, i64* %138, i64 %140
%142 = load i64, i64* %141
%143 = icmp eq i64 %142, -1
br i1 %143, label %144, label %147
144: ; preds = %137
%145 = load i32, i32* @stdout
%146 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %145)
br label %166
147: ; preds = %137
%148 = load i64*, i64** %6
%149 = load i32, i32* %9
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i64, i64* %148, i64 %150
%152 = load i64, i64* %151
%153 = icmp eq i64 %152, 1
br i1 %153, label %154, label %157
154: ; preds = %147
%155 = load i32, i32* @stdout
%156 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %155)
br label %165
157: ; preds = %147
%158 = load i64*, i64** %6
%159 = load i32, i32* %9
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i64, i64* %158, i64 %160
%162 = load i64, i64* %161
%163 = trunc i64 %162 to i32
%164 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %163)
br label %165
165: ; preds = %157, %154
br label %166
166: ; preds = %165, %144
%167 = load i32, i32* %7
%168 = load i32, i32* %9
%169 = sub nsw i32 %167, %168
%170 = icmp sgt i32 %169, 1
br i1 %170, label %171, label %176
171: ; preds = %166
%172 = load i32, i32* %7
%173 = load i32, i32* %9
%174 = sub nsw i32 %172, %173
%175 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %174)
br label %176
176: ; preds = %171, %166
%177 = call i32 @putchar(i8 signext 32)
br label %178
178: ; preds = %176, %136
%179 = load i32, i32* %9
%180 = add nsw i32 %179, 1
store i32 %180, i32* %9
br label %124
181: ; preds = %124
%182 = load i64*, i64** %6
%183 = load i32, i32* %7
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i64, i64* %182, i64 %184
%186 = load i64, i64* %185
%187 = trunc i64 %186 to i32
%188 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %187)
%189 = call i32 @putchar(i8 signext 10)
%190 = call i32 @wall_clock_status(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%191 = call i32 @putchar(i8 signext 10)
%192 = load i64*, i64** %6
%193 = load i32, i32* %7
%194 = call i32 @P_rational_roots(i64* %192, i32 %193)
store i32 %194, i32* %9
%195 = load i32, i32* %9
%196 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %195)
store i32 0, i32* %3
br label %197
197: ; preds = %181, %59, %27, %16
%198 = load i32, i32* %3
ret i32 %198
}

LLVM IR (-O2):
@.str = [28 x i8] c"Not a solvable polynomial.\0A\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"Too complex to solve with currently available RAM.\0A\00"
@.str.2 = [77 x i8] c"Not a standard polynomial: %s\0ATry again without the \22%s\22 at the beginning.\0A\00"
@.str.3 = [49 x i8] c"Lead coefficient must be a real, nonzero number.\00"
@.str.4 = [54 x i8] c"Now solving polynomial function for x, when f(x) = 0:\00"
@.str.5 = [4 x i8] c"%lu\00"
@.str.6 = [4 x i8] c"^%u\00"
@.str.7 = [5 x i8] c"+ -x\00"
@stdout = global i32 0
@.str.8 = [4 x i8] c"+ x\00"
@.str.9 = [7 x i8] c"+ %ldx\00"
@.str.10 = [10 x i8] c"+ %ld = 0\00"
@.str.11 = [31 x i8] c"Time spent decoding polynomial\00"
@.str.12 = [28 x i8] c"Total solutions found: %i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -1
%4 = add i32 %0, -2
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %160
9: ; preds = %2
%10 = shl i32 %3, 3
%11 = tail call i64* @malloc(i32 %10)
%12 = icmp eq i64* %11, null
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = zext i32 %3 to i64
br label %18
15: ; preds = %9
%16 = load i32, i32* @stderr
%17 = tail call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %160
18: ; preds = %13, %18
%19 = phi i64 [ 0, %13 ], [ %20, %18 ]
%20 = add nuw nsw i64 %19, 1
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i64 @strtol(i8* nocapture %22, i32* null, i32 0)
%24 = getelementptr inbounds i64, i64* %11, i64 %19
store i64 %23, i64* %24
%25 = icmp eq i64 %20, %14
br i1 %25, label %26, label %18
26: ; preds = %18
%27 = load i64, i64* %11
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* %32)
br label %160
34: ; preds = %26
%35 = icmp slt i64 %27, 0
br i1 %35, label %36, label %109
36: ; preds = %34
%37 = zext i32 %3 to i64
%38 = sub nsw i64 0, %27
store i64 %38, i64* %11
%39 = icmp eq i32 %3, 1
br i1 %39, label %109, label %40
40: ; preds = %36
%41 = add nsw i64 %14, -1
%42 = icmp ult i64 %41, 4
br i1 %42, label %99, label %43
43: ; preds = %40
%44 = and i64 %41, -4
%45 = or i64 %44, 1
%46 = add nsw i64 %44, -4
%47 = lshr exact i64 %46, 2
%48 = add nuw nsw i64 %47, 1
%49 = and i64 %48, 1
%50 = icmp eq i64 %46, 0
br i1 %50, label %83, label %51
51: ; preds = %43
%52 = and i64 %48, 9223372036854775806
br label %53
53: ; preds = %53, %51
%54 = phi i64 [ 0, %51 ], [ %78, %53 ]
%55 = phi i64 [ 0, %51 ], [ %79, %53 ]
%56 = or i64 %54, 1
%57 = getelementptr inbounds i64, i64* %11, i64 %56
%58 = bitcast i64* %57 to <2 x i64>*
%59 = load <2 x i64>, <2 x i64>* %58
%60 = getelementptr inbounds i64, i64* %57, i64 2
%61 = bitcast i64* %60 to <2 x i64>*
%62 = load <2 x i64>, <2 x i64>* %61
%63 = sub nsw <2 x i64> zeroinitializer, %59
%64 = sub nsw <2 x i64> zeroinitializer, %62
%65 = bitcast i64* %57 to <2 x i64>*
store <2 x i64> %63, <2 x i64>* %65
%66 = bitcast i64* %60 to <2 x i64>*
store <2 x i64> %64, <2 x i64>* %66
%67 = or i64 %54, 5
%68 = getelementptr inbounds i64, i64* %11, i64 %67
%69 = bitcast i64* %68 to <2 x i64>*
%70 = load <2 x i64>, <2 x i64>* %69
%71 = getelementptr inbounds i64, i64* %68, i64 2
%72 = bitcast i64* %71 to <2 x i64>*
%73 = load <2 x i64>, <2 x i64>* %72
%74 = sub nsw <2 x i64> zeroinitializer, %70
%75 = sub nsw <2 x i64> zeroinitializer, %73
%76 = bitcast i64* %68 to <2 x i64>*
store <2 x i64> %74, <2 x i64>* %76
%77 = bitcast i64* %71 to <2 x i64>*
store <2 x i64> %75, <2 x i64>* %77
%78 = add nuw i64 %54, 8
%79 = add i64 %55, 2
%80 = icmp eq i64 %79, %52
br i1 %80, label %81, label %53
81: ; preds = %53
%82 = or i64 %78, 1
br label %83
83: ; preds = %81, %43
%84 = phi i64 [ 1, %43 ], [ %82, %81 ]
%85 = icmp eq i64 %49, 0
br i1 %85, label %97, label %86
86: ; preds = %83
%87 = getelementptr inbounds i64, i64* %11, i64 %84
%88 = bitcast i64* %87 to <2 x i64>*
%89 = load <2 x i64>, <2 x i64>* %88
%90 = getelementptr inbounds i64, i64* %87, i64 2
%91 = bitcast i64* %90 to <2 x i64>*
%92 = load <2 x i64>, <2 x i64>* %91
%93 = sub nsw <2 x i64> zeroinitializer, %89
%94 = sub nsw <2 x i64> zeroinitializer, %92
%95 = bitcast i64* %87 to <2 x i64>*
store <2 x i64> %93, <2 x i64>* %95
%96 = bitcast i64* %90 to <2 x i64>*
store <2 x i64> %94, <2 x i64>* %96
br label %97
97: ; preds = %83, %86
%98 = icmp eq i64 %41, %44
br i1 %98, label %109, label %99
99: ; preds = %40, %97
%100 = phi i64 [ 1, %40 ], [ %45, %97 ]
br label %101
101: ; preds = %99, %101
%102 = phi i64 [ %107, %101 ], [ %100, %99 ]
%103 = getelementptr inbounds i64, i64* %11, i64 %102
%104 = load i64, i64* %103
%105 = getelementptr inbounds i64, i64* %11, i64 %102
%106 = sub nsw i64 0, %104
store i64 %106, i64* %105
%107 = add nuw nsw i64 %102, 1
%108 = icmp eq i64 %107, %37
br i1 %108, label %109, label %101
109: ; preds = %101, %36, %97, %34
%110 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%111 = load i64, i64* %11
%112 = icmp eq i64 %111, 1
br i1 %112, label %116, label %113
113: ; preds = %109
%114 = trunc i64 %111 to i32
%115 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %114)
br label %116
116: ; preds = %109, %113
%117 = tail call i32 @putchar(i8 signext 120)
%118 = icmp sgt i32 %0, 3
br i1 %118, label %121, label %119
119: ; preds = %116
%120 = tail call i32 @putchar(i8 signext 32)
br label %149
121: ; preds = %116
%122 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %4)
%123 = tail call i32 @putchar(i8 signext 32)
%124 = zext i32 %4 to i64
br label %125
125: ; preds = %121, %146
%126 = phi i64 [ 1, %121 ], [ %147, %146 ]
%127 = getelementptr inbounds i64, i64* %11, i64 %126
%128 = load i64, i64* %127
switch i64 %128, label %135 [
i64 0, label %146
i64 -1, label %129
i64 1, label %132
]
129: ; preds = %125
%130 = load i32, i32* @stdout
%131 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %130)
br label %138
132: ; preds = %125
%133 = load i32, i32* @stdout
%134 = tail call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %133)
br label %138
135: ; preds = %125
%136 = trunc i64 %128 to i32
%137 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %136)
br label %138
138: ; preds = %132, %135, %129
%139 = trunc i64 %126 to i32
%140 = sub nsw i32 %4, %139
%141 = icmp sgt i32 %140, 1
br i1 %141, label %142, label %144
142: ; preds = %138
%143 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %140)
br label %144
144: ; preds = %142, %138
%145 = tail call i32 @putchar(i8 signext 32)
br label %146
146: ; preds = %125, %144
%147 = add nuw nsw i64 %126, 1
%148 = icmp eq i64 %147, %124
br i1 %148, label %149, label %125
149: ; preds = %146, %119
%150 = sext i32 %4 to i64
%151 = getelementptr inbounds i64, i64* %11, i64 %150
%152 = load i64, i64* %151
%153 = trunc i64 %152 to i32
%154 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %153)
%155 = tail call i32 @putchar(i8 signext 10)
%156 = tail call i32 @wall_clock_status(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%157 = tail call i32 @putchar(i8 signext 10)
%158 = tail call i32 @P_rational_roots(i64* %11, i32 %4)
%159 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %158)
br label %160
160: ; preds = %149, %29, %15, %6
%161 = phi i32 [ 1, %6 ], [ -1, %15 ], [ -1, %29 ], [ 0, %149 ]
ret i32 %161
}