#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__ isPalindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int num1 = 999, num2, largest = 0, current;
  for (; num1 >= 100; num1--) {
    for (num2 = num1; num2 >= 100; num2--) {
      current = num1 * num2;
      if (isPalindrome(current)) {
        if (current > largest) {
          largest = current;
        }
      }
    }
  }
  printf("%d\n", largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e7,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x8(%rbp)
jl     11b0 <main+0x90>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jl     119d <main+0x7d>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     118a <main+0x6a>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1185 <main+0x65>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    118a <main+0x6a>
jmp    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x2d>
jmp    11a2 <main+0x82>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe46(%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   %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   1040 <isPalindrome@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
test   %rax,%rax
cmove  %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    0xe42(%rip),%rdi
mov    %ebx,%esi
call   1030 <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 = [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
store i32 0, i32* %1
store i32 999, i32* %2
store i32 0, i32* %4
br label %6
6: ; preds = %33, %0
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 100
br i1 %8, label %9, label %36
9: ; preds = %6
%10 = load i32, i32* %2
store i32 %10, i32* %3
br label %11
11: ; preds = %29, %9
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 100
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = call i64 @isPalindrome(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %14
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %5
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %21
br label %28
28: ; preds = %27, %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, -1
store i32 %31, i32* %3
br label %11
32: ; preds = %11
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = add nsw i32 %34, -1
store i32 %35, i32* %2
br label %6
36: ; preds = %6
%37 = load i32, i32* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %15, %0
%2 = phi i32 [ 999, %0 ], [ %16, %15 ]
%3 = phi i32 [ 0, %0 ], [ %12, %15 ]
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ %12, %4 ], [ %3, %1 ]
%6 = phi i32 [ %13, %4 ], [ %2, %1 ]
%7 = mul nsw i32 %6, %2
%8 = tail call i64 @isPalindrome(i32 %7)
%9 = icmp ne i64 %8, 0
%10 = icmp sgt i32 %7, %5
%11 = select i1 %9, i1 %10, i1 false
%12 = select i1 %11, i32 %7, i32 %5
%13 = add nsw i32 %6, -1
%14 = icmp sgt i32 %6, 100
br i1 %14, label %4, label %15
15: ; preds = %4
%16 = add nsw i32 %2, -1
%17 = icmp ugt i32 %2, 100
br i1 %17, label %1, label %18
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
}