#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 = 100; 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    11b7 <main+0x97>
movl   $0x64,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    11a4 <main+0x84>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     1191 <main+0x71>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    118c <main+0x6c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1191 <main+0x71>
jmp    1196 <main+0x76>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <main+0x31>
jmp    11a9 <main+0x89>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
mov    -0x20(%rbp),%esi
lea    0xe3f(%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    $0x2710,%r15d
nopw   0x0(%rax,%rax,1)
mov    $0x384,%r12d
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    %ebx,%r13d
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
test   %rax,%rax
cmove  %r13d,%ebx
add    %r14d,%ebp
add    $0xffffffff,%r12d
jne    1150 <main+0x30>
add    $0x1,%r14d
add    $0x64,%r15d
cmp    $0x3e8,%r14d
jne    1140 <main+0x20>
lea    0xe79(%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 = %36, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %39
13: ; preds = %10
store i32 100, i32* %7
br label %14
14: ; preds = %32, %13
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 1000
br i1 %16, label %17, label %35
17: ; preds = %14
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = call i64 @isPalindrome(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %17
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* %8
store i32 %29, i32* %9
br label %30
30: ; preds = %28, %24
br label %31
31: ; preds = %30, %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %14
35: ; preds = %14
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %10
39: ; preds = %10
%40 = load i32, i32* %9
%41 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %3
ret i32 %42
}

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, %17
%4 = phi i32 [ undef, %2 ], [ %14, %17 ]
%5 = phi i32 [ 100, %2 ], [ %18, %17 ]
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %4, %3 ], [ %14, %6 ]
%8 = phi i32 [ 100, %3 ], [ %15, %6 ]
%9 = mul nuw 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
}