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

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, double);
long sum_sieves(int);
int main(int argc, char *argv[]) {
  clock_t begin, end;
  double time_spent;
  begin = clock();
  long tmp = sum_sieves(2000000);
  printf("%ld", tmp);
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("\n%f", time_spent);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1e8480,%edi
call   1050 <sum_sieves@plt>
mov    %rax,-0x30(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e5f(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
mov    $0x1e8480,%edi
call   1050 <sum_sieves@plt>
cvtsi2sd %rax,%xmm0
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2e79(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [4 x i8] c"\0A%f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
%8 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = call i64 (...) @clock()
store i64 %9, i64* %5
%10 = call i64 @sum_sieves(i32 2000000)
store i64 %10, i64* %8
%11 = load i64, i64* %8
%12 = sitofp i64 %11 to double
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
%14 = call i64 (...) @clock()
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = load i64, i64* %5
%17 = sub nsw i64 %15, %16
%18 = sitofp i64 %17 to double
%19 = load double, double* @CLOCKS_PER_SEC
%20 = fdiv double %18, %19
store double %20, double* %7
%21 = load double, double* %7
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [4 x i8] c"\0A%f\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @clock()
%4 = tail call i64 @sum_sieves(i32 2000000)
%5 = sitofp i64 %4 to double
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %5)
%7 = tail call i64 (...) @clock()
%8 = sub nsw i64 %7, %3
%9 = sitofp i64 %8 to double
%10 = load double, double* @CLOCKS_PER_SEC
%11 = fdiv double %9, %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 0
}