#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 */
unsigned int ReverseNumber(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned short i = 0, j = 0;
  char found = 0;
  unsigned int num = 0, rev_num = 0;
  unsigned int max_palindrome = 0;
  for (i = 999; i >= 100 && i <= 999; i--) {
    for (j = 999; j >= 100 && j <= 999; j--) {
      num = i * j;
      rev_num = ReverseNumber(num);
      if (num == rev_num && num > max_palindrome) {
        max_palindrome = num;
      }
    }
  }
  printf("%d", max_palindrome);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movw   $0x3e7,-0x6(%rbp)
movzwl -0x6(%rbp),%ecx
xor    %eax,%eax
cmp    $0x64,%ecx
mov    %al,-0x19(%rbp)
jl     117b <main+0x5b>
movzwl -0x6(%rbp),%eax
cmp    $0x3e7,%eax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    118b <main+0x6b>
jmp    1225 <main+0x105>
movw   $0x3e7,-0x8(%rbp)
movzwl -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    $0x64,%ecx
mov    %al,-0x1a(%rbp)
jl     11b2 <main+0x92>
movzwl -0x8(%rbp),%eax
cmp    $0x3e7,%eax
setle  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    11c2 <main+0xa2>
jmp    120f <main+0xef>
movzwl -0x6(%rbp),%eax
movzwl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <ReverseNumber@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11f9 <main+0xd9>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jbe    11f9 <main+0xd9>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11fe <main+0xde>
mov    -0x8(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x8(%rbp)
jmp    1191 <main+0x71>
jmp    1214 <main+0xf4>
mov    -0x6(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x6(%rbp)
jmp    115a <main+0x3a>
mov    -0x18(%rbp),%esi
lea    0xdd1(%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    $0x3e7,%r14d
mov    $0x383,%r15w
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%r12d
lea    0x64(%r15),%eax
movzwl %ax,%ebp
imul   %r14d,%ebp
mov    %ebp,%edi
call   1040 <ReverseNumber@plt>
cmp    %ebx,%ebp
cmova  %ebp,%ebx
cmp    %eax,%ebp
cmovne %r12d,%ebx
add    $0xffffffff,%r15d
movzwl %r15w,%eax
cmp    $0x384,%eax
jb     1140 <main+0x20>
lea    -0x65(%r14),%eax
mov    %r14d,%ecx
add    $0xffffffff,%ecx
movzwl %cx,%ecx
movzwl %ax,%eax
mov    %ecx,%r14d
cmp    $0x384,%eax
jb     1130 <main+0x10>
lea    0xe70(%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 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i16 0, i16* %2
store i16 0, i16* %3
store i8 0, i8* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i16 999, i16* %2
br label %8
8: ; preds = %51, %0
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = icmp sge i32 %10, 100
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i16, i16* %2
%14 = zext i16 %13 to i32
%15 = icmp sle i32 %14, 999
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ false, %8 ], [ %15, %12 ]
br i1 %17, label %18, label %54
18: ; preds = %16
store i16 999, i16* %3
br label %19
19: ; preds = %47, %18
%20 = load i16, i16* %3
%21 = zext i16 %20 to i32
%22 = icmp sge i32 %21, 100
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i16, i16* %3
%25 = zext i16 %24 to i32
%26 = icmp sle i32 %25, 999
br label %27
27: ; preds = %23, %19
%28 = phi i1 [ false, %19 ], [ %26, %23 ]
br i1 %28, label %29, label %50
29: ; preds = %27
%30 = load i16, i16* %2
%31 = zext i16 %30 to i32
%32 = load i16, i16* %3
%33 = zext i16 %32 to i32
%34 = mul nsw i32 %31, %33
store i32 %34, i32* %5
%35 = load i32, i32* %5
%36 = call i32 @ReverseNumber(i32 %35)
store i32 %36, i32* %6
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %46
40: ; preds = %29
%41 = load i32, i32* %5
%42 = load i32, i32* %7
%43 = icmp ugt i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load i32, i32* %5
store i32 %45, i32* %7
br label %46
46: ; preds = %44, %40, %29
br label %47
47: ; preds = %46
%48 = load i16, i16* %3
%49 = add i16 %48, -1
store i16 %49, i16* %3
br label %19
50: ; preds = %27
br label %51
51: ; preds = %50
%52 = load i16, i16* %2
%53 = add i16 %52, -1
store i16 %53, i16* %2
br label %8
54: ; preds = %16
%55 = load i32, i32* %7
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %55)
ret i32 0
}

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