#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_palindrome(unsigned long);
int /*<<< orphan*/ printf(char *, unsigned long);
int main() {
  is_palindrome(9008);
  long unsigned int largest = 0;
  long unsigned int result = 0;
  for (int m = 100; m < 1000; m++) {
    for (int n = 100; n <= m; n++) {
      result = m * n;
      if (result > largest && is_palindrome(result)) {
        largest = result;
      }
    }
  }
  printf("%lu\n", largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2330,%edi
call   1030 <is_palindrome@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11cc <main+0xac>
movl   $0x64,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11b9 <main+0x99>
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    11a6 <main+0x86>
mov    -0x18(%rbp),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     11a6 <main+0x86>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11ab <main+0x8b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1164 <main+0x44>
jmp    11be <main+0x9e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <main+0x30>
mov    -0x10(%rbp),%rsi
lea    0xe29(%rip),%rdi
call   1040 <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    $0x2330,%edi
call   1030 <is_palindrome@plt>
mov    $0x64,%r15d
mov    $0x2710,%r12d
mov    $0x1,%r13d
xor    %r14d,%r14d
jmp    1165 <main+0x45>
nopl   0x0(%rax)
add    $0x1,%r15
add    $0x64,%r12
add    $0x1,%r13
cmp    $0x3e8,%r15
je     118f <main+0x6f>
mov    %r13,%rbp
mov    %r12,%rbx
jmp    1179 <main+0x59>
nopl   (%rax)
add    %r15,%rbx
add    $0xffffffffffffffff,%rbp
je     1150 <main+0x30>
cmp    %rbx,%r14
jae    1170 <main+0x50>
mov    %rbx,%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
cmovne %rbx,%r14
jmp    1170 <main+0x50>
lea    0xe6a(%rip),%rdi
mov    %r14,%rsi
call   1040 <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 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i64 @is_palindrome(i64 9008)
store i64 0, i64* %2
store i64 0, i64* %3
store i32 100, i32* %4
br label %7
7: ; preds = %34, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 1000
br i1 %9, label %10, label %37
10: ; preds = %7
store i32 100, i32* %5
br label %11
11: ; preds = %30, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = mul nsw i32 %16, %17
%19 = sext i32 %18 to i64
store i64 %19, i64* %3
%20 = load i64, i64* %3
%21 = load i64, i64* %2
%22 = icmp ugt i64 %20, %21
br i1 %22, label %23, label %29
23: ; preds = %15
%24 = load i64, i64* %3
%25 = call i64 @is_palindrome(i64 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i64, i64* %3
store i64 %28, i64* %2
br label %29
29: ; preds = %27, %23, %15
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %11
33: ; preds = %11
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %7
37: ; preds = %7
%38 = load i64, i64* %2
%39 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %38)
ret i32 0
}

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