#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 = 999, j;
  int largest_palindrome = 0;
  int temp;
  while (i > 99) {
    j = 999;
    while (j >= i) {
      temp = j * i;
      if (temp > largest_palindrome && isPalindrome(temp)) {
        largest_palindrome = temp;
      }
      j--;
    }
    i--;
  }
  printf("%d\n", largest_palindrome);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e7,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x63,-0x8(%rbp)
jle    11a4 <main+0x84>
movl   $0x3e7,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1196 <main+0x76>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1188 <main+0x68>
mov    -0x14(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     1188 <main+0x68>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe52(%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
xor    %r13d,%r13d
mov    $0x3e7,%r12d
mov    $0xf3a71,%r14d
mov    $0xfffffc19,%r15d
jmp    1169 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%r12),%eax
add    $0xfffffc19,%r14d
add    $0x1,%r15d
cmp    $0x64,%r12d
mov    %eax,%r12d
jbe    11a0 <main+0x80>
mov    $0x3e8,%ebx
mov    %r14d,%ebp
jmp    118b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebx
add    %r15d,%ebp
cmp    %r12d,%ebx
jbe    1150 <main+0x30>
cmp    %r13d,%ebp
jle    1180 <main+0x60>
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
test   %rax,%rax
cmovne %ebp,%r13d
jmp    1180 <main+0x60>
lea    0xe59(%rip),%rdi
mov    %r13d,%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"%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 999, i32* %2
store i32 0, i32* %4
br label %6
6: ; preds = %30, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 99
br i1 %8, label %9, label %33
9: ; preds = %6
store i32 999, i32* %3
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %30
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* %5
%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* %5
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %21, %14
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
br label %10
30: ; preds = %10
%31 = load i32, i32* %2
%32 = add nsw i32 %31, -1
store i32 %32, i32* %2
br label %6
33: ; preds = %6
%34 = load i32, i32* %4
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %17, %0
%2 = phi i32 [ 999, %0 ], [ %18, %17 ]
%3 = phi i32 [ 0, %0 ], [ %14, %17 ]
br label %4
4: ; preds = %1, %13
%5 = phi i32 [ %14, %13 ], [ %3, %1 ]
%6 = phi i32 [ %15, %13 ], [ 999, %1 ]
%7 = mul nuw nsw i32 %6, %2
%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 nsw i32 %6, -1
%16 = icmp ugt i32 %6, %2
br i1 %16, label %4, label %17
17: ; preds = %13
%18 = add nsw i32 %2, -1
%19 = icmp ugt i32 %2, 100
br i1 %19, label %1, label %20
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
}