#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 */
int /*<<< orphan*/ is_palindrome(int);
int /*<<< orphan*/ is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 999; i >= 2; i -= 2) {
    if (!is_palindrome(i) || !is_prime(i))
      continue;
    printf("%d\n", i);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e7,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1199 <main+0x69>
mov    -0x8(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%eax
je     1172 <main+0x42>
mov    -0x8(%rbp),%edi
call   1050 <is_prime@plt>
cmp    $0x0,%eax
jne    1177 <main+0x47>
jmp    118b <main+0x5b>
mov    -0x8(%rbp),%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
jmp    1199 <main+0x69>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3e7,%ebx
jmp    114a <main+0x1a>
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
cmp    $0x3,%ebx
mov    %eax,%ebx
jbe    116e <main+0x3e>
mov    %ebx,%edi
call   1030 <is_palindrome@plt>
test   %eax,%eax
je     1140 <main+0x10>
mov    %ebx,%edi
call   1050 <is_prime@plt>
test   %eax,%eax
je     1140 <main+0x10>
lea    0xe99(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 999, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 2
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @is_palindrome(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @is_prime(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10, %6
br label %18
15: ; preds = %10
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %21
18: ; preds = %14
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 2
store i32 %20, i32* %2
br label %3
21: ; preds = %15, %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 999, %0 ], [ %11, %10 ]
%3 = tail call i32 @is_palindrome(i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 @is_prime(i32 %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %13
10: ; preds = %1, %5
%11 = add nsw i32 %2, -2
%12 = icmp ugt i32 %2, 3
br i1 %12, label %1, label %13
13: ; preds = %10, %8
ret i32 0
}