#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*/ minhafuncao();
int /*<<< orphan*/ printf(char *, double);
int main() {
  clock_t begin, end;
  double time_spent;
  int x;
  begin = clock();
  for (int i = 0; i < 300000000; i++)
    ;
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("Tempo gasto %.2lf segundos.\n", time_spent);
  begin = clock();
  for (int i = 0; i < 300000000; i++)
    minhafuncao();
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("Tempo gasto %.2lf segundos.\n", time_spent);
  begin = clock();
  for (int i = 0; i < 300000000; i++)
    x++;
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("Tempo gasto %.2lf segundos.\n", time_spent);
  x++;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x11e1a300,-0x28(%rbp)
jge    1171 <main+0x41>
jmp    1163 <main+0x33>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1151 <main+0x21>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e58(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x11e1a300,-0x2c(%rbp)
jge    11de <main+0xae>
mov    $0x0,%al
call   1050 <minhafuncao@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bc <main+0x8c>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2deb(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x11e1a300,-0x30(%rbp)
jge    124d <main+0x11d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1229 <main+0xf9>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2d7c(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xd7f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e91(%rip),%r15
divsd  (%r15),%xmm0
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
mov    $0x11e1a300,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <minhafuncao@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x50>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r15),%xmm0
lea    0xe56(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r15),%xmm0
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [29 x i8] c"Tempo gasto %.2lf segundos.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i64 (...) @clock()
store i64 %9, i64* %2
store i32 0, i32* %6
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 300000000
br i1 %12, label %13, label %17
13: ; preds = %10
br label %14
14: ; preds = %13
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
br label %10
17: ; preds = %10
%18 = call i64 (...) @clock()
store i64 %18, i64* %3
%19 = load i64, i64* %3
%20 = load i64, i64* %2
%21 = sub nsw i64 %19, %20
%22 = sitofp i64 %21 to double
%23 = load double, double* @CLOCKS_PER_SEC
%24 = fdiv double %22, %23
store double %24, double* %4
%25 = load double, double* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %25)
%27 = call i64 (...) @clock()
store i64 %27, i64* %2
store i32 0, i32* %7
br label %28
28: ; preds = %33, %17
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 300000000
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = call i32 (...) @minhafuncao()
br label %33
33: ; preds = %31
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %28
36: ; preds = %28
%37 = call i64 (...) @clock()
store i64 %37, i64* %3
%38 = load i64, i64* %3
%39 = load i64, i64* %2
%40 = sub nsw i64 %38, %39
%41 = sitofp i64 %40 to double
%42 = load double, double* @CLOCKS_PER_SEC
%43 = fdiv double %41, %42
store double %43, double* %4
%44 = load double, double* %4
%45 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %44)
%46 = call i64 (...) @clock()
store i64 %46, i64* %2
store i32 0, i32* %8
br label %47
47: ; preds = %53, %36
%48 = load i32, i32* %8
%49 = icmp slt i32 %48, 300000000
br i1 %49, label %50, label %56
50: ; preds = %47
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %53
53: ; preds = %50
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %47
56: ; preds = %47
%57 = call i64 (...) @clock()
store i64 %57, i64* %3
%58 = load i64, i64* %3
%59 = load i64, i64* %2
%60 = sub nsw i64 %58, %59
%61 = sitofp i64 %60 to double
%62 = load double, double* @CLOCKS_PER_SEC
%63 = fdiv double %61, %62
store double %63, double* %4
%64 = load double, double* %4
%65 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %64)
%66 = load i32, i32* %5
%67 = add nsw i32 %66, 1
store i32 %67, i32* %5
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [29 x i8] c"Tempo gasto %.2lf segundos.\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @clock()
%2 = tail call i64 (...) @clock()
%3 = sub nsw i64 %2, %1
%4 = sitofp i64 %3 to double
%5 = load double, double* @CLOCKS_PER_SEC
%6 = fdiv double %4, %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %6)
%8 = tail call i64 (...) @clock()
br label %23
9: ; preds = %23
%10 = tail call i64 (...) @clock()
%11 = sub nsw i64 %10, %8
%12 = sitofp i64 %11 to double
%13 = load double, double* @CLOCKS_PER_SEC
%14 = fdiv double %12, %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %14)
%16 = tail call i64 (...) @clock()
%17 = tail call i64 (...) @clock()
%18 = sub nsw i64 %17, %16
%19 = sitofp i64 %18 to double
%20 = load double, double* @CLOCKS_PER_SEC
%21 = fdiv double %19, %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %21)
ret i32 0
23: ; preds = %0, %23
%24 = phi i32 [ 0, %0 ], [ %26, %23 ]
%25 = tail call i32 (...) @minhafuncao()
%26 = add nuw nsw i32 %24, 1
%27 = icmp eq i32 %26, 300000000
br i1 %27, label %9, label %23
}