#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*/ DoTests();
int fibSumEven(int, int, int, int /*<<< orphan*/);
int getSumDiv();
int largestPrimeFactor(int);
int maxPalProd(int);
int maxProd1000dig(int);
int nPrimeNumber(int);
int /*<<< orphan*/ printf(char *, int);
int pythTriplet(int);
int sumPrimes(int);
int sumSqrtDiff(int);
int main() {
  DoTests();
  printf("Problem 1 result: %d\n", getSumDiv());
  printf("Problem 2 result: %d\n", fibSumEven(1, 1, 4000000, 0));
  printf("Problem 3 result: %lld\n", largestPrimeFactor(600851475143));
  printf("Problem 4 result: %d\n", maxPalProd(3));
  printf("Problem 6 result: %d\n", sumSqrtDiff(100));
  printf("Problem 7 result: %lld\n", nPrimeNumber(10001));
  printf("Problem 8 result: %lld\n", maxProd1000dig(13));
  printf("Problem 9 result: %d\n", pythTriplet(1000));
  printf("Problem 10 result: %lld\n", sumPrimes(2000000));
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <DoTests@plt>
mov    $0x0,%al
call   10b0 <getSumDiv@plt>
mov    %eax,%esi
lea    0xe2a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%esi
mov    $0x3d0900,%edx
xor    %ecx,%ecx
mov    %esi,%edi
call   10a0 <fibSumEven@plt>
mov    %eax,%esi
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
mov    $0xe589eac7,%edi
call   1030 <largestPrimeFactor@plt>
mov    %eax,%esi
lea    0xe1d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3,%edi
call   10c0 <maxPalProd@plt>
mov    %eax,%esi
lea    0xe1d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   10d0 <sumSqrtDiff@plt>
mov    %eax,%esi
lea    0xe1b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2711,%edi
call   1060 <nPrimeNumber@plt>
mov    %eax,%esi
lea    0xe19(%rip),%rdi
call   1050 <printf@plt>
mov    $0xd,%edi
call   1090 <maxProd1000dig@plt>
mov    %eax,%esi
lea    0xe19(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3e8,%edi
call   1040 <pythTriplet@plt>
mov    %eax,%esi
lea    0xe19(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1e8480,%edi
call   1070 <sumPrimes@plt>
mov    %eax,%esi
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <DoTests@plt>
xor    %eax,%eax
call   10b0 <getSumDiv@plt>
lea    0xe3a(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x3d0900,%edx
xor    %ecx,%ecx
call   10a0 <fibSumEven@plt>
lea    0xe2c(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0xe589eac7,%edi
call   1030 <largestPrimeFactor@plt>
lea    0xe2a(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x3,%edi
call   10c0 <maxPalProd@plt>
lea    0xe2a(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x64,%edi
call   10d0 <sumSqrtDiff@plt>
lea    0xe28(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x2711,%edi
call   1060 <nPrimeNumber@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0xd,%edi
call   1090 <maxProd1000dig@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x3e8,%edi
call   1040 <pythTriplet@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1e8480,%edi
call   1070 <sumPrimes@plt>
lea    0xe24(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Problem 1 result: %d\0A\00"
@.str.1 = [22 x i8] c"Problem 2 result: %d\0A\00"
@.str.2 = [24 x i8] c"Problem 3 result: %lld\0A\00"
@.str.3 = [22 x i8] c"Problem 4 result: %d\0A\00"
@.str.4 = [22 x i8] c"Problem 6 result: %d\0A\00"
@.str.5 = [24 x i8] c"Problem 7 result: %lld\0A\00"
@.str.6 = [24 x i8] c"Problem 8 result: %lld\0A\00"
@.str.7 = [22 x i8] c"Problem 9 result: %d\0A\00"
@.str.8 = [25 x i8] c"Problem 10 result: %lld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @DoTests()
%3 = call i32 (...) @getSumDiv()
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @fibSumEven(i32 1, i32 1, i32 4000000, i32 0)
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @largestPrimeFactor(i32 -443946297)
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = call i32 @maxPalProd(i32 3)
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = call i32 @sumSqrtDiff(i32 100)
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = call i32 @nPrimeNumber(i32 10001)
%14 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = call i32 @maxProd1000dig(i32 13)
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = call i32 @pythTriplet(i32 1000)
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = call i32 @sumPrimes(i32 2000000)
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %19)
ret i32 1
}

LLVM IR (-O2):
@.str = [22 x i8] c"Problem 1 result: %d\0A\00"
@.str.1 = [22 x i8] c"Problem 2 result: %d\0A\00"
@.str.2 = [24 x i8] c"Problem 3 result: %lld\0A\00"
@.str.3 = [22 x i8] c"Problem 4 result: %d\0A\00"
@.str.4 = [22 x i8] c"Problem 6 result: %d\0A\00"
@.str.5 = [24 x i8] c"Problem 7 result: %lld\0A\00"
@.str.6 = [24 x i8] c"Problem 8 result: %lld\0A\00"
@.str.7 = [22 x i8] c"Problem 9 result: %d\0A\00"
@.str.8 = [25 x i8] c"Problem 10 result: %lld\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @DoTests()
%2 = tail call i32 (...) @getSumDiv()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @fibSumEven(i32 1, i32 1, i32 4000000, i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @largestPrimeFactor(i32 -443946297)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @maxPalProd(i32 3)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = tail call i32 @sumSqrtDiff(i32 100)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = tail call i32 @nPrimeNumber(i32 10001)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = tail call i32 @maxProd1000dig(i32 13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %14)
%16 = tail call i32 @pythTriplet(i32 1000)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %16)
%18 = tail call i32 @sumPrimes(i32 2000000)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %18)
ret i32 1
}