#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__ time_t;

/* Variables and functions */
scalar_t__ isReversible(long);
int /*<<< orphan*/ printf(char *, long, scalar_t__);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  long num, count = 0;
  time_t start = time(NULL);
  for (num = 1; num < 1000000000; num++) {
    if (isReversible(num)) {
      count++;
    }
  }
  printf("Count = %ld, Time = %ld", count, time(NULL) - start);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x20(%rbp)
movq   $0x1,-0x10(%rbp)
cmpq   $0x3b9aca00,-0x10(%rbp)
3b
jge    119f <main+0x6f>
mov    -0x10(%rbp),%rdi
call   1040 <isReversible@plt>
cmp    $0x0,%rax
je     1189 <main+0x59>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    118e <main+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115c <main+0x2c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
sub    -0x20(%rbp),%rdx
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %r15d,%r15d
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%r14
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <isReversible@plt>
cmp    $0x1,%rax
sbb    $0xffffffffffffffff,%r15
add    $0x1,%rbx
cmp    $0x3b9aca00,%rbx
jne    1150 <main+0x20>
xor    %edi,%edi
call   1050 <time@plt>
sub    %r14,%rax
lea    0xe82(%rip),%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Count = %ld, Time = %ld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
%5 = call i64 @time(i32* null)
store i64 %5, i64* %4
store i64 1, i64* %2
br label %6
6: ; preds = %17, %0
%7 = load i64, i64* %2
%8 = icmp slt i64 %7, 1000000000
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i64, i64* %2
%11 = call i64 @isReversible(i64 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i64, i64* %3
%15 = add nsw i64 %14, 1
store i64 %15, i64* %3
br label %16
16: ; preds = %13, %9
br label %17
17: ; preds = %16
%18 = load i64, i64* %2
%19 = add nsw i64 %18, 1
store i64 %19, i64* %2
br label %6
20: ; preds = %6
%21 = load i64, i64* %3
%22 = call i64 @time(i32* null)
%23 = load i64, i64* %4
%24 = sub nsw i64 %22, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %21, i64 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Count = %ld, Time = %ld\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 1, %0 ], [ %9, %2 ]
%4 = phi i64 [ 0, %0 ], [ %8, %2 ]
%5 = tail call i64 @isReversible(i64 %3)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = add nuw nsw i64 %4, %7
%9 = add nuw nsw i64 %3, 1
%10 = icmp eq i64 %9, 1000000000
br i1 %10, label %11, label %2
11: ; preds = %2
%12 = tail call i64 @time(i32* null)
%13 = sub nsw i64 %12, %1
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %13)
ret i32 0
}