#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 */
double CLOCKS_PER_SEC;
double clock();
int pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int to_the_power(unsigned int, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  double start, end;
  unsigned int total = 0;
  printf("Algorithm starts, please wait...\n");
  start = clock();
  for (unsigned int i = 10; i < (int)((5 + 1) * pow(9, 5)); ++i) {
    if (i == to_the_power(i, 0)) {
      total += i;
    }
  }
  end = clock();
  printf("Algorithm end.\n");
  printf("Total time: %f\n", (end - start) / CLOCKS_PER_SEC);
  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)
movl   $0x0,-0x24(%rbp)
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
movsd  %xmm0,-0x18(%rbp)
movl   $0xa,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x9,%edi
mov    $0x5,%esi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   $0x6,%ecx,%ecx
cmp    %ecx,%eax
jae    11dc <main+0x9c>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%edi
xor    %esi,%esi
call   1030 <to_the_power@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jne    11c9 <main+0x89>
mov    -0x28(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11ce <main+0x8e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117e <main+0x3e>
mov    $0x0,%al
call   1040 <clock@plt>
movsd  %xmm0,-0x20(%rbp)
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    0x2de1(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <clock@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x9,%edi
mov    $0x5,%esi
call   1070 <pow@plt>
add    %eax,%eax
lea    (%rax,%rax,2),%eax
cmp    $0xb,%eax
jb     11b4 <main+0x64>
mov    $0xa,%ebx
nopl   0x0(%rax)
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <to_the_power@plt>
add    $0x1,%ebx
mov    $0x9,%edi
mov    $0x5,%esi
call   1070 <pow@plt>
add    %eax,%eax
lea    (%rax,%rax,2),%eax
cmp    %eax,%ebx
jb     1190 <main+0x40>
xor    %eax,%eax
call   1050 <clock@plt>
movsd  %xmm0,(%rsp)
lea    0xe6a(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mov    0x2e0a(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe17(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Algorithm starts, please wait...\0A\00"
@.str.1 = [16 x i8] c"Algorithm end.\0A\00"
@.str.2 = [16 x i8] c"Total time: %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%11 = call double (...) @clock()
store double %11, double* %6
store i32 10, i32* %9
br label %12
12: ; preds = %27, %2
%13 = load i32, i32* %9
%14 = call i32 @pow(i32 9, i32 5)
%15 = mul nsw i32 6, %14
%16 = icmp ult i32 %13, %15
br i1 %16, label %17, label %30
17: ; preds = %12
%18 = load i32, i32* %9
%19 = load i32, i32* %9
%20 = call i32 @to_the_power(i32 %19, i32 0)
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load i32, i32* %9
%24 = load i32, i32* %8
%25 = add i32 %24, %23
store i32 %25, i32* %8
br label %26
26: ; preds = %22, %17
br label %27
27: ; preds = %26
%28 = load i32, i32* %9
%29 = add i32 %28, 1
store i32 %29, i32* %9
br label %12
30: ; preds = %12
%31 = call double (...) @clock()
store double %31, double* %7
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%33 = load double, double* %7
%34 = load double, double* %6
%35 = fsub double %33, %34
%36 = load double, double* @CLOCKS_PER_SEC
%37 = fdiv double %35, %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %37)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"Total time: %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@str = [33 x i8] c"Algorithm starts, please wait...\00"
@str.3 = [15 x i8] c"Algorithm end.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%4 = tail call double (...) @clock()
%5 = tail call i32 @pow(i32 9, i32 5)
%6 = mul nsw i32 %5, 6
%7 = icmp ugt i32 %6, 10
br i1 %7, label %15, label %8
8: ; preds = %15, %2
%9 = tail call double (...) @clock()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
%11 = fsub double %9, %4
%12 = load double, double* @CLOCKS_PER_SEC
%13 = fdiv double %11, %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %13)
ret i32 0
15: ; preds = %2, %15
%16 = phi i32 [ %18, %15 ], [ 10, %2 ]
%17 = tail call i32 @to_the_power(i32 %16, i32 0)
%18 = add nuw i32 %16, 1
%19 = tail call i32 @pow(i32 9, i32 5)
%20 = mul nsw i32 %19, 6
%21 = icmp ult i32 %18, %20
br i1 %21, label %15, label %8
}