#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 */
int /*<<< orphan*/ printf(char *, int);
int rev(int);
int main() {
  int product = 0, palin = 0;
  for (int i = 999; i > 99; i--) {
    for (int j = i; j > 99; j--) {
      product = i * j;
      if ((product == rev(product)) && (product > palin))
        palin = product;
    }
  }
  printf("%d", palin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3e7,-0x10(%rbp)
cmpl   $0x63,-0x10(%rbp)
jle    11bb <main+0x9b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x63,-0x14(%rbp)
jle    11a8 <main+0x88>
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <rev@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    1195 <main+0x75>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1195 <main+0x75>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    119a <main+0x7a>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
jmp    11ad <main+0x8d>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe3b(%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
sub    $0x18,%rsp
xor    %ebx,%ebx
mov    $0x3e7,%eax
mov    $0x3e8,%r14d
mov    $0xfffff833,%ecx
mov    $0xf3a71,%r12d
mov    $0xfffffc19,%r13d
nopl   0x0(%rax)
mov    %rax,0x10(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r12d,%ebp
mov    %r14d,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r15d
mov    %ebp,%edi
call   1030 <rev@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
cmp    %eax,%ebp
cmovne %r15d,%ebx
add    $0xffffffff,%r14d
add    %r13d,%ebp
cmp    $0x64,%r14d
jg     1170 <main+0x50>
mov    0x10(%rsp),%rdx
lea    -0x1(%rdx),%eax
mov    0xc(%rsp),%r14d
add    $0xffffffff,%r14d
mov    0x8(%rsp),%ecx
add    %ecx,%r12d
add    $0x2,%ecx
add    $0x1,%r13d
cmp    $0x64,%edx
ja     1150 <main+0x30>
lea    0xe43(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 999, i32* %4
br label %6
6: ; preds = %33, %0
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 99
br i1 %8, label %9, label %36
9: ; preds = %6
%10 = load i32, i32* %4
store i32 %10, i32* %5
br label %11
11: ; preds = %29, %9
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 99
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = call i32 @rev(i32 %19)
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %28
22: ; preds = %14
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %2
store i32 %27, i32* %3
br label %28
28: ; preds = %26, %22, %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, -1
store i32 %31, i32* %5
br label %11
32: ; preds = %11
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, -1
store i32 %35, i32* %4
br label %6
36: ; preds = %6
%37 = load i32, i32* %3
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}

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