#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 /*<<< orphan*/ formula(int, int, int);
scalar_t__ isPrime(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i, j, vrednost;
  int max = 0;
  int temp = 0;
  int prviKoef = 0;
  int drugiKoef = 0;
  for (i = -999; i <= 999; i++) {
    for (j = -999; j <= 999; j++) {
      temp = 0;
      while (isPrime(formula(temp, i, j))) {
        temp++;
        if (temp > max) {
          max = temp;
          prviKoef = i;
          drugiKoef = j;
        }
      }
    }
  }
  printf("Produced equation: n^2 %dn + %d\n", prviKoef, drugiKoef);
  printf("Product of its coefficients:\n");
  printf("%d\n", prviKoef * drugiKoef);
  printf("Produces primes for consecutive values from 0-%d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0xfffffc19,-0x8(%rbp)
cmpl   $0x3e7,-0x8(%rbp)
jg     11fb <main+0xcb>
movl   $0xfffffc19,-0xc(%rbp)
cmpl   $0x3e7,-0xc(%rbp)
jg     11e8 <main+0xb8>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <formula@plt>
mov    %eax,%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     11d5 <main+0xa5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11d0 <main+0xa0>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    118a <main+0x5a>
jmp    11da <main+0xaa>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x46>
jmp    11ed <main+0xbd>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x32>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
imul   -0x20(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xfffffc19,%r15d
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    116d <main+0x2d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    $0x3e8,%r15d
je     11de <main+0x9e>
mov    $0xfffffc19,%r12d
jmp    118d <main+0x4d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12d
cmp    $0x3e8,%r12d
je     1160 <main+0x20>
xor    %edi,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   1060 <formula@plt>
mov    %eax,%edi
call   1050 <isPrime@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbp),%eax
cmp    %ebx,%eax
cmovge %ebp,%ebx
cmovge %r15d,%r13d
cmovge %r12d,%r14d
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   1060 <formula@plt>
mov    %eax,%edi
call   1050 <isPrime@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    11b0 <main+0x70>
jmp    1180 <main+0x40>
lea    0xe1b(%rip),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
imul   %r13d,%r14d
lea    0xe14(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe07(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Produced equation: n^2 %dn + %d\0A\00"
@.str.1 = [30 x i8] c"Product of its coefficients:\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [50 x i8] c"Produces primes for consecutive values from 0-%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 -999, i32* %2
br label %9
9: ; preds = %40, %0
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 999
br i1 %11, label %12, label %43
12: ; preds = %9
store i32 -999, i32* %3
br label %13
13: ; preds = %36, %12
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 999
br i1 %15, label %16, label %39
16: ; preds = %13
store i32 0, i32* %6
br label %17
17: ; preds = %34, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @formula(i32 %18, i32 %19, i32 %20)
%22 = call i64 @isPrime(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %17
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = load i32, i32* %5
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = load i32, i32* %6
store i32 %31, i32* %5
%32 = load i32, i32* %2
store i32 %32, i32* %7
%33 = load i32, i32* %3
store i32 %33, i32* %8
br label %34
34: ; preds = %30, %24
br label %17
35: ; preds = %17
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %13
39: ; preds = %13
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %9
43: ; preds = %9
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %44, i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* %7
%49 = load i32, i32* %8
%50 = mul nsw i32 %48, %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %5
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Produced equation: n^2 %dn + %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [50 x i8] c"Produces primes for consecutive values from 0-%d\0A\00"
@str = [29 x i8] c"Product of its coefficients:\00"
define i32 @main() {
br label %1
1: ; preds = %0, %33
%2 = phi i32 [ 0, %0 ], [ %30, %33 ]
%3 = phi i32 [ 0, %0 ], [ %29, %33 ]
%4 = phi i32 [ 0, %0 ], [ %28, %33 ]
%5 = phi i32 [ -999, %0 ], [ %34, %33 ]
br label %6
6: ; preds = %1, %27
%7 = phi i32 [ %2, %1 ], [ %30, %27 ]
%8 = phi i32 [ %3, %1 ], [ %29, %27 ]
%9 = phi i32 [ %4, %1 ], [ %28, %27 ]
%10 = phi i32 [ -999, %1 ], [ %31, %27 ]
%11 = tail call i32 @formula(i32 0, i32 %5, i32 %10)
%12 = tail call i64 @isPrime(i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %6, %14
%15 = phi i32 [ %23, %14 ], [ %7, %6 ]
%16 = phi i32 [ %22, %14 ], [ %8, %6 ]
%17 = phi i32 [ %19, %14 ], [ 0, %6 ]
%18 = phi i32 [ %21, %14 ], [ %9, %6 ]
%19 = add nuw nsw i32 %17, 1
%20 = icmp slt i32 %17, %18
%21 = select i1 %20, i32 %18, i32 %19
%22 = select i1 %20, i32 %16, i32 %5
%23 = select i1 %20, i32 %15, i32 %10
%24 = tail call i32 @formula(i32 %19, i32 %5, i32 %10)
%25 = tail call i64 @isPrime(i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %14
27: ; preds = %14, %6
%28 = phi i32 [ %9, %6 ], [ %21, %14 ]
%29 = phi i32 [ %8, %6 ], [ %22, %14 ]
%30 = phi i32 [ %7, %6 ], [ %23, %14 ]
%31 = add nsw i32 %10, 1
%32 = icmp eq i32 %31, 1000
br i1 %32, label %33, label %6
33: ; preds = %27
%34 = add nsw i32 %5, 1
%35 = icmp eq i32 %34, 1000
br i1 %35, label %36, label %1
36: ; preds = %33
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%39 = mul nsw i32 %30, %29
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %28)
ret i32 0
}