#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 */
scalar_t__ hasOdd(int);
scalar_t__ log10(int);
int /*<<< orphan*/ printf(char *, int);
int reverse(int);
int main() {
  const int N = 1000000000;
  int i, ri, ans;
  ans = 0;
  for (i = 1; i < N; ++i) {
    ri = reverse(i);
    if (hasOdd(i + ri) && (int)log10(i) == (int)log10(ri)) {
      ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3b9aca00,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x3b9aca00,-0xc(%rbp)
jge    11ce <main+0x8e>
mov    -0xc(%rbp),%edi
call   1030 <reverse@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
add    -0x10(%rbp),%edi
call   1050 <hasOdd@plt>
cmp    $0x0,%rax
je     11bb <main+0x7b>
mov    -0xc(%rbp),%edi
call   1060 <log10@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <log10@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    11bb <main+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c0 <main+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %r14d,%r14d
jmp    116b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x3b9aca00,%ebx
je     119f <main+0x5f>
mov    %ebx,%edi
call   1030 <reverse@plt>
mov    %eax,%ebp
lea    (%rbx,%rbp,1),%edi
call   1050 <hasOdd@plt>
test   %rax,%rax
je     1160 <main+0x20>
mov    %ebx,%edi
call   1060 <log10@plt>
mov    %rax,%r15
mov    %ebp,%edi
call   1060 <log10@plt>
xor    %ecx,%ecx
cmp    %eax,%r15d
sete   %cl
add    %ecx,%r14d
jmp    1160 <main+0x20>
lea    0xe5a(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1000000000, i32* %2
store i32 0, i32* %5
store i32 1, i32* %3
br label %6
6: ; preds = %29, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1000000000
br i1 %8, label %9, label %32
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i32 @reverse(i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
%15 = call i64 @hasOdd(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %9
%18 = load i32, i32* %3
%19 = call i64 @log10(i32 %18)
%20 = trunc i64 %19 to i32
%21 = load i32, i32* %4
%22 = call i64 @log10(i32 %21)
%23 = trunc i64 %22 to i32
%24 = icmp eq i32 %20, %23
br i1 %24, label %25, label %28
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %28
28: ; preds = %25, %17, %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %6
32: ; preds = %6
%33 = load i32, i32* %5
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %16
%2 = phi i32 [ 0, %0 ], [ %17, %16 ]
%3 = phi i32 [ 1, %0 ], [ %18, %16 ]
%4 = tail call i32 @reverse(i32 %3)
%5 = add nsw i32 %4, %3
%6 = tail call i64 @hasOdd(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %1
%9 = tail call i64 @log10(i32 %3)
%10 = trunc i64 %9 to i32
%11 = tail call i64 @log10(i32 %4)
%12 = trunc i64 %11 to i32
%13 = icmp eq i32 %10, %12
%14 = zext i1 %13 to i32
%15 = add nsw i32 %2, %14
br label %16
16: ; preds = %8, %1
%17 = phi i32 [ %2, %1 ], [ %15, %8 ]
%18 = add nuw nsw i32 %3, 1
%19 = icmp eq i32 %18, 1000000000
br i1 %19, label %20, label %1
20: ; preds = %16
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}