#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__ is_palindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int product = 0;
  while (1) {
    for (int i = 999; i > 100; --i) {
      for (int j = i; j > 100; --j) {
        product = i * j;
        if (is_palindrome(product))
          goto finish;
      }
    }
  }
finish:
  printf("LARGEST PALINDROME: %d\n", product);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3e7,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jle    119e <main+0x7e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jle    118b <main+0x6b>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1178 <main+0x58>
jmp    11a3 <main+0x83>
jmp    117d <main+0x5d>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x2d>
jmp    1190 <main+0x70>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x3e7,%eax
mov    %rax,(%rsp)
mov    $0x3e8,%r13d
mov    $0xfffff833,%r14d
mov    $0xf3a71,%r12d
mov    $0xfffffc19,%ebp
mov    %r12d,%ebx
mov    %r13d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <is_palindrome@plt>
test   %rax,%rax
jne    1198 <main+0x78>
add    $0xffffffff,%r15d
add    %ebp,%ebx
cmp    $0x66,%r15d
jge    1160 <main+0x40>
mov    (%rsp),%rcx
lea    -0x1(%rcx),%eax
add    $0xffffffff,%r13d
add    %r14d,%r12d
add    $0x2,%r14d
add    $0x1,%ebp
cmp    $0x65,%ecx
mov    %rax,(%rsp)
ja     114b <main+0x2b>
jmp    112b <main+0xb>
lea    0xe61(%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 = [24 x i8] c"LARGEST PALINDROME: %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* %2
br label %5
5: ; preds = %0, %30
store i32 999, i32* %3
br label %6
6: ; preds = %27, %5
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 100
br i1 %8, label %9, label %30
9: ; preds = %6
%10 = load i32, i32* %3
store i32 %10, i32* %4
br label %11
11: ; preds = %23, %9
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 100
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = call i64 @is_palindrome(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %14
br label %31
22: ; preds = %14
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, -1
store i32 %25, i32* %4
br label %11
26: ; preds = %11
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
br label %6
30: ; preds = %6
br label %5
31: ; preds = %21
%32 = load i32, i32* %2
%33 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}

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