#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 argc, char *argv[]) {
  int a, b, product, large;
  for (a = 1000; a > 100; a--) {
    for (b = 1000; b > a; b--) {
      product = a * b;
      if (product < large) {
        break;
      }
      if (isPalindrome(product)) {
        large = product;
      }
    }
  }
  printf("Largest is %d\n", large);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jle    11b3 <main+0x93>
movl   $0x3e8,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11a0 <main+0x80>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1175 <main+0x55>
jmp    11a0 <main+0x80>
mov    -0x1c(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     118d <main+0x6d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1192 <main+0x72>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <main+0x2e>
jmp    11a5 <main+0x85>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
mov    -0x20(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1030 <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
mov    $0x3e8,%r12d
mov    $0xf4240,%r14d
mov    $0xfffffc18,%r15d
jmp    1159 <main+0x39>
nop
lea    -0x1(%r12),%eax
add    $0xfffffc18,%r14d
add    $0x1,%r15d
cmp    $0x65,%r12d
mov    %eax,%r12d
jbe    1190 <main+0x70>
cmp    $0x3e7,%r12d
ja     1140 <main+0x20>
mov    $0x3e8,%ebx
mov    %r14d,%ebp
nopw   0x0(%rax,%rax,1)
cmp    %r13d,%ebp
jl     1140 <main+0x20>
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
test   %rax,%rax
cmovne %ebp,%r13d
add    $0xffffffff,%ebx
add    %r15d,%ebp
cmp    %r12d,%ebx
ja     1170 <main+0x50>
jmp    1140 <main+0x20>
lea    0xe69(%rip),%rdi
mov    %r13d,%esi
call   1030 <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 = [15 x i8] c"Largest is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000, i32* %6
br label %10
10: ; preds = %37, %2
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 100
br i1 %12, label %13, label %40
13: ; preds = %10
store i32 1000, i32* %7
br label %14
14: ; preds = %33, %13
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = mul nsw i32 %19, %20
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %18
br label %36
26: ; preds = %18
%27 = load i32, i32* %8
%28 = call i64 @isPalindrome(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32, i32* %8
store i32 %31, i32* %9
br label %32
32: ; preds = %30, %26
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, -1
store i32 %35, i32* %7
br label %14
36: ; preds = %25, %14
br label %37
37: ; preds = %36
%38 = load i32, i32* %6
%39 = add nsw i32 %38, -1
store i32 %39, i32* %6
br label %10
40: ; preds = %10
%41 = load i32, i32* %9
%42 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %3
ret i32 %43
}

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