#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__ isPalindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i, j, ans, x;
  ans = 0;
  for (i = 1; i < 1000; i++) {
    for (j = 1; j < 1000; j++) {
      x = i * j;
      if (isPalindrome(x) && x > ans)
        ans = x;
    }
  }
  printf("%d\n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11b2 <main+0x92>
movl   $0x1,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    119f <main+0x7f>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     118c <main+0x6c>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    118c <main+0x6c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1191 <main+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
jmp    11a4 <main+0x84>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebx,%ebx
mov    $0x1,%r14d
mov    $0x3e7,%r15d
mov    %r14d,%ebp
nopl   0x0(%rax)
mov    %ebx,%r12d
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
test   %rax,%rax
cmove  %r12d,%ebx
add    %r14d,%ebp
add    $0xffffffff,%r15d
jne    1140 <main+0x20>
add    $0x1,%r14d
cmp    $0x3e8,%r14d
jne    1130 <main+0x10>
lea    0xe8d(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
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 0, i32* %4
store i32 1, i32* %2
br label %6
6: ; preds = %31, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %34
9: ; preds = %6
store i32 1, i32* %3
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = mul nsw i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = call i64 @isPalindrome(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32, i32* %5
store i32 %25, i32* %4
br label %26
26: ; preds = %24, %20, %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %10
30: ; preds = %10
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %6
34: ; preds = %6
%35 = load i32, i32* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
ret i32 0
}

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