#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 pow3(int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  int count = 0;
  int i, j, k, d;
  clock_t start, finish;
  double duration;
  start = clock();
  for (i = 1; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      for (k = 0; k <= 9; k++) {
        d = pow3(i) + pow3(j) + pow3(k);
        if (d == i * 100 + j * 10 + k) {
          count++;
          printf("%d\n", d);
        }
      }
    }
  }
  finish = clock();
  duration = (double)(finish - start) / CLOCKS_PER_SEC;
  printf("%d\n", count);
  printf("%f seconds\n", duration);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     121e <main+0xee>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jg     120b <main+0xdb>
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jg     11f8 <main+0xc8>
mov    -0xc(%rbp),%edi
call   1050 <pow3@plt>
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <pow3@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <pow3@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
imul   $0x64,-0xc(%rbp),%ecx
imul   $0xa,-0x10(%rbp),%edx
add    %edx,%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    11e5 <main+0xb5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xba>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117a <main+0x4a>
jmp    11fd <main+0xcd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1169 <main+0x39>
jmp    1210 <main+0xe0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x28>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
sub    -0x20(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2dab(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xdae(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xda1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,0x10(%rsp)
mov    $0x1,%r12d
mov    $0x64,%eax
jmp    1171 <main+0x41>
nop
add    $0x1,%r12d
mov    0x8(%rsp),%eax
add    $0x64,%eax
cmp    $0xa,%r12d
je     11ec <main+0xbc>
mov    %eax,0x8(%rsp)
mov    %eax,%r15d
xor    %r13d,%r13d
jmp    118e <main+0x5e>
nopl   (%rax)
add    $0x1,%r13d
add    $0xa,%r15d
cmp    $0xa,%r13d
je     1160 <main+0x30>
xor    %ebp,%ebp
jmp    11a8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    $0xa,%ebp
je     1180 <main+0x50>
mov    %r12d,%edi
call   1050 <pow3@plt>
mov    %eax,%ebx
mov    %r13d,%edi
call   1050 <pow3@plt>
mov    %eax,%r14d
add    %ebx,%r14d
mov    %ebp,%edi
call   1050 <pow3@plt>
add    %r14d,%eax
lea    (%r15,%rbp,1),%ecx
cmp    %eax,%ecx
jne    11a0 <main+0x70>
addl   $0x1,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
jmp    11a0 <main+0x70>
xor    %eax,%eax
call   1030 <clock@plt>
sub    0x10(%rsp),%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2de1(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
lea    0xddf(%rip),%rdi
call   1040 <printf@plt>
lea    0xdd7(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [12 x i8] c"%f seconds\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @clock()
br label %2
2: ; preds = %0, %32
%3 = phi i32 [ 0, %0 ], [ %26, %32 ]
%4 = phi i32 [ 1, %0 ], [ %33, %32 ]
%5 = mul nuw nsw i32 %4, 100
br label %6
6: ; preds = %2, %29
%7 = phi i32 [ %3, %2 ], [ %26, %29 ]
%8 = phi i32 [ 0, %2 ], [ %30, %29 ]
%9 = mul nuw nsw i32 %8, 10
%10 = add nuw nsw i32 %9, %5
br label %11
11: ; preds = %6, %25
%12 = phi i32 [ %7, %6 ], [ %26, %25 ]
%13 = phi i32 [ 0, %6 ], [ %27, %25 ]
%14 = tail call i32 @pow3(i32 %4)
%15 = tail call i32 @pow3(i32 %8)
%16 = add nsw i32 %15, %14
%17 = tail call i32 @pow3(i32 %13)
%18 = add nsw i32 %16, %17
%19 = add nuw nsw i32 %10, %13
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %11
%22 = add nsw i32 %12, 1
%23 = sitofp i32 %18 to double
%24 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %23)
br label %25
25: ; preds = %11, %21
%26 = phi i32 [ %22, %21 ], [ %12, %11 ]
%27 = add nuw nsw i32 %13, 1
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %11
29: ; preds = %25
%30 = add nuw nsw i32 %8, 1
%31 = icmp eq i32 %30, 10
br i1 %31, label %32, label %6
32: ; preds = %29
%33 = add nuw nsw i32 %4, 1
%34 = icmp eq i32 %33, 10
br i1 %34, label %35, label %2
35: ; preds = %32
%36 = tail call i64 (...) @clock()
%37 = sub nsw i64 %36, %1
%38 = sitofp i64 %37 to double
%39 = load double, double* @CLOCKS_PER_SEC
%40 = fdiv double %38, %39
%41 = sitofp i32 %26 to double
%42 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %41)
%43 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %40)
ret i32 0
}