#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 */
float CLOCKS_PER_SEC;
int atoi(char *);
scalar_t__ clock();
int frequency_of_primes(int);
int /*<<< orphan*/ printf(char *, char *, int, ...);
int main(int argc, char *argv[]) {
  clock_t t;
  int f;
  char *id = argv[1];
  int n = atoi(argv[2]);
  t = clock();
  printf("ID %s Calculating %d...\n", id, n);
  f = frequency_of_primes(n);
  t = clock() - t;
  float tiempo = (float)t / CLOCKS_PER_SEC;
  printf("ID %s It took me %d clicks (%f seconds).\n", id, (int)t, tiempo);
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%edi
call   1050 <frequency_of_primes@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
cvtsi2ssq -0x18(%rbp),%xmm0
mov    0x2e2f(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %eax,%edx
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
lea    0xe9c(%rip),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <frequency_of_primes@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
cvtsi2ss %rax,%xmm0
mov    0x2e5b(%rip),%rcx
divss  (%rcx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"ID %s Calculating %d...\0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [42 x i8] c"ID %s It took me %d clicks (%f seconds).\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 i8*
%9 = alloca i32
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %8
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %9
%18 = call i64 (...) @clock()
store i64 %18, i64* %6
%19 = load i8*, i8** %8
%20 = load i32, i32* %9
%21 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20)
%22 = load i32, i32* %9
%23 = call i32 @frequency_of_primes(i32 %22)
store i32 %23, i32* %7
%24 = call i64 (...) @clock()
%25 = load i64, i64* %6
%26 = sub nsw i64 %24, %25
store i64 %26, i64* %6
%27 = load i64, i64* %6
%28 = sitofp i64 %27 to float
%29 = load float, float* @CLOCKS_PER_SEC
%30 = fdiv float %28, %29
store float %30, float* %10
%31 = load i8*, i8** %8
%32 = load i64, i64* %6
%33 = trunc i64 %32 to i32
%34 = load float, float* %10
%35 = fpext float %34 to double
%36 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %33, double %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"ID %s Calculating %d...\0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [42 x i8] c"ID %s It took me %d clicks (%f seconds).\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i64 (...) @clock()
%9 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %7)
%10 = tail call i32 @frequency_of_primes(i32 %7)
%11 = tail call i64 (...) @clock()
%12 = sub nsw i64 %11, %8
%13 = sitofp i64 %12 to float
%14 = load float, float* @CLOCKS_PER_SEC
%15 = fdiv float %13, %14
%16 = trunc i64 %12 to i32
%17 = fpext float %15 to double
%18 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %16, double %17)
ret i32 0
}