#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() {
  int i, j, p, max = 0;
  for (i = 100; i < 1000; i++)
    for (j = i; j < 1000; j++) {
      p = i * j;
      if (p > max && isPalindrome(p))
        max = p;
    }
  printf("%u\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x64,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    119e <main+0x7e>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    118b <main+0x6b>
mov    -0x10(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     118b <main+0x6b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <main+0x70>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
jmp    11a3 <main+0x83>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x14(%rbp),%esi
lea    0xe45(%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   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x64,%r14d
xor    %ebx,%ebx
mov    $0x384,%r15d
mov    $0xc9,%r12d
mov    $0x2710,%r13d
jmp    116d <main+0x4d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14d
mov    0x4(%rsp),%r15d
add    $0xffffffff,%r15d
add    %r12d,%r13d
add    $0x2,%r12d
cmp    $0x3e8,%r14d
je     119c <main+0x7c>
mov    %r13d,%ebp
mov    %r15d,0x4(%rsp)
jmp    1189 <main+0x69>
nopw   0x0(%rax,%rax,1)
add    %r14d,%ebp
add    $0xffffffff,%r15d
je     1150 <main+0x30>
cmp    %ebx,%ebp
jle    1180 <main+0x60>
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
test   %rax,%rax
cmovne %ebp,%ebx
jmp    1180 <main+0x60>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\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* %5
store i32 100, i32* %2
br label %6
6: ; preds = %32, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i32, i32* %2
store i32 %10, i32* %3
br label %11
11: ; preds = %28, %9
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1000
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* %4
%23 = call i64 @isPalindrome(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %4
store i32 %26, i32* %5
br label %27
27: ; preds = %25, %21, %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %11
31: ; preds = %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %6
35: ; preds = %6
%36 = load i32, i32* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
ret i32 0
}

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