#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 = 100; a < 1000; a++) {
    for (b = a; b < 1000; b++) {
      product = a * b;
      if (isPalindrome(product)) {
        if (product > large) {
          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   $0x64,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11b6 <main+0x96>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    11a3 <main+0x83>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     1190 <main+0x70>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    118b <main+0x6b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1190 <main+0x70>
jmp    1195 <main+0x75>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1150 <main+0x30>
jmp    11a8 <main+0x88>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
mov    -0x20(%rbp),%esi
lea    0xe40(%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    $0x64,%r14d
mov    $0x384,%r15d
mov    $0xc9,%eax
mov    $0x2710,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,(%rsp)
mov    %r13d,%ebp
mov    %r15d,0x4(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r12d
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
test   %rax,%rax
cmove  %r12d,%ebx
add    %r14d,%ebp
add    $0xffffffff,%r15d
jne    1160 <main+0x40>
add    $0x1,%r14d
mov    0x4(%rsp),%r15d
add    $0xffffffff,%r15d
mov    (%rsp),%eax
add    %eax,%r13d
add    $0x2,%eax
cmp    $0x3e8,%r14d
jne    1150 <main+0x30>
lea    0xe5b(%rip),%rdi
mov    %ebx,%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 100, i32* %6
br label %10
10: ; preds = %37, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = load i32, i32* %6
store i32 %14, i32* %7
br label %15
15: ; preds = %33, %13
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 1000
br i1 %17, label %18, label %36
18: ; preds = %15
%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 = call i64 @isPalindrome(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %8
store i32 %30, i32* %9
br label %31
31: ; preds = %29, %25
br label %32
32: ; preds = %31, %18
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %15
36: ; preds = %15
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 = %17, %2
%4 = phi i32 [ undef, %2 ], [ %14, %17 ]
%5 = phi i32 [ 100, %2 ], [ %18, %17 ]
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %14, %6 ], [ %4, %3 ]
%8 = phi i32 [ %15, %6 ], [ %5, %3 ]
%9 = mul nsw i32 %8, %5
%10 = tail call i64 @isPalindrome(i32 %9)
%11 = icmp ne i64 %10, 0
%12 = icmp sgt i32 %9, %7
%13 = select i1 %11, i1 %12, i1 false
%14 = select i1 %13, i32 %9, i32 %7
%15 = add nuw nsw i32 %8, 1
%16 = icmp eq i32 %15, 1000
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = add nuw nsw i32 %5, 1
%19 = icmp eq i32 %18, 1000
br i1 %19, label %20, label %3
20: ; preds = %17
%21 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}