#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 reverse(int);
int main() {
  int a;
  int b;
  int curr = 0;
  for (a = 100; a < 1000; a++)
    for (b = 100; b < 1000; b++)
      if ((a * b == reverse(a * b)) && (a * b) > curr)
        curr = a * b;
  printf("%d\n", curr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x64,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11c1 <main+0xa1>
movl   $0x64,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11ae <main+0x8e>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
call   1030 <reverse@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jne    119b <main+0x7b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    119b <main+0x7b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a0 <main+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
jmp    11b3 <main+0x93>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe35(%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    $0x64,%r14d
xor    %ebx,%ebx
mov    $0x2710,%r15d
nopl   0x0(%rax)
mov    $0x384,%r12d
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    %ebx,%r13d
mov    %ebp,%edi
call   1030 <reverse@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
cmp    %eax,%ebp
cmovne %r13d,%ebx
add    %r14d,%ebp
add    $0xffffffff,%r12d
jne    1150 <main+0x30>
add    $0x1,%r14d
add    $0x64,%r15d
cmp    $0x3e8,%r14d
jne    1140 <main+0x20>
lea    0xe7a(%rip),%rdi
mov    %ebx,%esi
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 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 100, i32* %2
br label %5
5: ; preds = %36, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %39
8: ; preds = %5
store i32 100, i32* %3
br label %9
9: ; preds = %32, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
%19 = call i32 @reverse(i32 %18)
%20 = icmp eq i32 %15, %19
br i1 %20, label %21, label %31
21: ; preds = %12
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %4
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = mul nsw i32 %28, %29
store i32 %30, i32* %4
br label %31
31: ; preds = %27, %21, %12
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %9
35: ; preds = %9
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %5
39: ; preds = %5
%40 = load i32, i32* %4
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %40)
ret i32 0
}

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