#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__ is_both_ways_truncatable(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  int sum = 0;
  int found = 0;
  for (i = 9; i < 1000000000; i += 2) {
    if (is_both_ways_truncatable(i)) {
      sum += i;
      found++;
      if (found == 11)
        break;
    }
  }
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x9,-0x14(%rbp)
cmpl   $0x3b9aca00,-0x14(%rbp)
jge    11a3 <main+0x83>
mov    -0x14(%rbp),%edi
call   1040 <is_both_ways_truncatable@plt>
cmp    $0x0,%rax
je     1190 <main+0x70>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xb,-0x1c(%rbp)
jne    118b <main+0x6b>
jmp    11a3 <main+0x83>
jmp    1190 <main+0x70>
jmp    1195 <main+0x75>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
mov    -0x18(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x9,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    113d <main+0x1d>
lea    0x2(%rbx),%eax
cmp    $0x3b9ac9fe,%ebx
mov    %eax,%ebx
jae    1159 <main+0x39>
mov    %ebx,%edi
call   1040 <is_both_ways_truncatable@plt>
test   %rax,%rax
je     1130 <main+0x10>
add    $0x1,%ebp
cmp    $0xb,%ebp
je     1156 <main+0x36>
add    %ebx,%r14d
jmp    1130 <main+0x10>
add    %ebx,%r14d
lea    0xea0(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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