#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(void) {
  int x = 0;
  int y = 0;
  int dec = 0;
  int largest = 0;
  for (x = 999; x >= 100; x--) {
    if (x % 11 == 0) {
      y = 999;
      dec = 1;
    } else {
      y = 990;
      dec = 11;
    }
    for (; x <= y; y -= dec) {
      if (y < 100)
        continue;
      int num = x * y;
      int num_rev = rev(num);
      if (num == num_rev && largest < num)
        largest = num;
    }
  }
  printf("%d\n", largest);
}


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   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x3e7,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jl     120c <main+0xec>
mov    -0x8(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1183 <main+0x63>
movl   $0x3e7,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    1191 <main+0x71>
movl   $0x3de,-0xc(%rbp)
movl   $0xb,-0x10(%rbp)
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f9 <main+0xd9>
cmpl   $0x64,-0xc(%rbp)
jge    11b1 <main+0x91>
jmp    11e9 <main+0xc9>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <rev@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11e4 <main+0xc4>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e4 <main+0xc4>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e9 <main+0xc9>
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1196 <main+0x76>
jmp    11fe <main+0xde>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
mov    -0x14(%rbp),%esi
lea    0xdea(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%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,%r15d
jmp    114d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%r15),%eax
cmp    $0x64,%r15d
mov    %eax,%r15d
jbe    11b3 <main+0x93>
imul   $0xba2e8ba3,%r15d,%eax
xor    %ecx,%ecx
cmp    $0x1745d175,%eax
setb   %cl
mov    $0xfffffff5,%r14d
mov    $0xffffffff,%eax
cmovb  %eax,%r14d
lea    (%rcx,%rcx,8),%ebx
add    $0x3de,%ebx
cmp    %ebx,%r15d
ja     1140 <main+0x20>
mov    %ebx,%ebp
imul   %r15d,%ebp
mov    %r14d,%r12d
imul   %r15d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <rev@plt>
cmp    %ebp,%r13d
mov    %r13d,%ecx
cmovl  %ebp,%ecx
cmp    %eax,%ebp
cmove  %ecx,%r13d
add    %r14d,%ebx
add    %r12d,%ebp
cmp    %ebx,%r15d
jle    1190 <main+0x70>
jmp    1140 <main+0x20>
lea    0xe46(%rip),%rdi
mov    %r13d,%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
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 999, i32* %2
br label %8
8: ; preds = %47, %0
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 100
br i1 %10, label %11, label %50
11: ; preds = %8
%12 = load i32, i32* %2
%13 = srem i32 %12, 11
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 999, i32* %3
store i32 1, i32* %4
br label %17
16: ; preds = %11
store i32 990, i32* %3
store i32 11, i32* %4
br label %17
17: ; preds = %16, %15
br label %18
18: ; preds = %42, %17
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %46
22: ; preds = %18
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 100
br i1 %24, label %25, label %26
25: ; preds = %22
br label %42
26: ; preds = %22
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = mul nsw i32 %27, %28
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @rev(i32 %30)
store i32 %31, i32* %7
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %41
35: ; preds = %26
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = load i32, i32* %6
store i32 %40, i32* %5
br label %41
41: ; preds = %39, %35, %26
br label %42
42: ; preds = %41, %25
%43 = load i32, i32* %4
%44 = load i32, i32* %3
%45 = sub nsw i32 %44, %43
store i32 %45, i32* %3
br label %18
46: ; preds = %18
br label %47
47: ; preds = %46
%48 = load i32, i32* %2
%49 = add nsw i32 %48, -1
store i32 %49, i32* %2
br label %8
50: ; preds = %8
%51 = load i32, i32* %5
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %20
%2 = phi i32 [ 999, %0 ], [ %22, %20 ]
%3 = phi i32 [ 0, %0 ], [ %21, %20 ]
%4 = urem i32 %2, 11
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -1, i32 -11
%7 = select i1 %5, i32 999, i32 990
%8 = icmp ugt i32 %2, %7
br i1 %8, label %20, label %9
9: ; preds = %1, %9
%10 = phi i32 [ %18, %9 ], [ %7, %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 slt i32 %11, %12
%16 = select i1 %14, i1 %15, i1 false
%17 = select i1 %16, i32 %12, i32 %11
%18 = add nsw i32 %10, %6
%19 = icmp sgt i32 %2, %18
br i1 %19, label %20, label %9
20: ; preds = %9, %1
%21 = phi i32 [ %3, %1 ], [ %17, %9 ]
%22 = add nsw i32 %2, -1
%23 = icmp ugt i32 %2, 100
br i1 %23, label %1, label %24
24: ; preds = %20
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
}