#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 *, int, double);
int solve1();
int solve2();
int main() {
  clock_t begin = clock();
  int result = solve1();
  clock_t end = clock();
  double time = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("%d [in %f seconds]\n", result, time);
  clock_t begin2 = clock();
  int result2 = solve2();
  clock_t end2 = clock();
  double time2 = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("%d [in %f seconds]\n", result2, time2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <solve1@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e6c(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <solve2@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e1b(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <solve1@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x2e71(%rip),%r14
divsd  (%r14),%xmm0
lea    0xe7d(%rip),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1060 <solve2@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <clock@plt>
movsd  0x8(%rsp),%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [20 x i8] c"%d [in %f seconds]\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i64
%4 = alloca double
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
%8 = alloca double
%9 = call i64 (...) @clock()
store i64 %9, i64* %1
%10 = call i32 (...) @solve1()
store i32 %10, i32* %2
%11 = call i64 (...) @clock()
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = load i64, i64* %1
%14 = sub nsw i64 %12, %13
%15 = sitofp i64 %14 to double
%16 = load double, double* @CLOCKS_PER_SEC
%17 = fdiv double %15, %16
store double %17, double* %4
%18 = load i32, i32* %2
%19 = load double, double* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %18, double %19)
%21 = call i64 (...) @clock()
store i64 %21, i64* %5
%22 = call i32 (...) @solve2()
store i32 %22, i32* %6
%23 = call i64 (...) @clock()
store i64 %23, i64* %7
%24 = load i64, i64* %3
%25 = load i64, i64* %1
%26 = sub nsw i64 %24, %25
%27 = sitofp i64 %26 to double
%28 = load double, double* @CLOCKS_PER_SEC
%29 = fdiv double %27, %28
store double %29, double* %8
%30 = load i32, i32* %6
%31 = load double, double* %8
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %30, double %31)
ret i32 0
}

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