#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(void) {
  int largest = 0;
  const int min = 100, max = 999;
  for (int i = max; i >= min; --i) {
    for (int j = max; j >= min; --j) {
      int check = i * j;
      if (largest >= check) {
        continue;
      }
      if (is_palindrome(check)) {
        printf("found: %d (%d * %d)\n", check, i, j);
        largest = check;
      }
    }
  }
  printf("LARGEST: %d\n", largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0x3e7,-0x10(%rbp)
movl   $0x3e7,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jl     11d6 <main+0xb6>
movl   $0x3e7,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jl     11c3 <main+0xa3>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1181 <main+0x61>
jmp    11b5 <main+0x95>
mov    -0x1c(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     11b0 <main+0x90>
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b5 <main+0x95>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <main+0x3c>
jmp    11c8 <main+0xa8>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
mov    -0x8(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
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    $0x3e7,%r15d
mov    $0xf3a71,%r13d
mov    $0xfffffc19,%r14d
xor    %r12d,%r12d
jmp    1168 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%r15),%eax
add    $0xfffffc19,%r13d
add    $0x1,%r14d
cmp    $0x64,%r15d
mov    %eax,%r15d
jbe    11b6 <main+0x96>
mov    $0x3e8,%ebx
mov    %r13d,%ebp
jmp    1188 <main+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %r14d,%ebp
cmp    $0x64,%ebx
jbe    1150 <main+0x30>
add    $0xffffffff,%ebx
cmp    %ebp,%r12d
jge    1180 <main+0x60>
mov    %ebp,%edi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1180 <main+0x60>
lea    0xe5d(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%r12d
jmp    1180 <main+0x60>
lea    0xe58(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
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 = [21 x i8] c"found: %d (%d * %d)\0A\00"
@.str.1 = [13 x i8] c"LARGEST: %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 100, i32* %3
store i32 999, i32* %4
store i32 999, i32* %5
br label %8
8: ; preds = %38, %0
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 100
br i1 %10, label %11, label %41
11: ; preds = %8
store i32 999, i32* %6
br label %12
12: ; preds = %34, %11
%13 = load i32, i32* %6
%14 = icmp sge i32 %13, 100
br i1 %14, label %15, label %37
15: ; preds = %12
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = mul nsw i32 %16, %17
store i32 %18, i32* %7
%19 = load i32, i32* %2
%20 = load i32, i32* %7
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %15
br label %34
23: ; preds = %15
%24 = load i32, i32* %7
%25 = call i64 @is_palindrome(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i32, i32* %7
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
%32 = load i32, i32* %7
store i32 %32, i32* %2
br label %33
33: ; preds = %27, %23
br label %34
34: ; preds = %33, %22
%35 = load i32, i32* %6
%36 = add nsw i32 %35, -1
store i32 %36, i32* %6
br label %12
37: ; preds = %12
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, -1
store i32 %40, i32* %5
br label %8
41: ; preds = %8
%42 = load i32, i32* %2
%43 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %42)
ret i32 0
}

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