#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, const char *argv[]) {
  int i, j;
  int max = 0;
  for (i = 999; i >= 0; i--) {
    for (j = 999; j >= 0; j--) {
      if (isPalindrome(i * j)) {
        if (i * j > max) {
          max = i * j;
          printf("%d\n", max);
        }
      }
    }
  }
  return 0;
}


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   $0x0,-0x1c(%rbp)
movl   $0x3e7,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11c9 <main+0xa9>
movl   $0x3e7,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     11b6 <main+0x96>
mov    -0x14(%rbp),%edi
imul   -0x18(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     11a3 <main+0x83>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    119e <main+0x7e>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x83>
jmp    11a8 <main+0x88>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1155 <main+0x35>
jmp    11bb <main+0x9b>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
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,%eax
xor    %ebx,%ebx
mov    $0xf3a71,%r15d
mov    $0xfffffc19,%r13d
lea    0xebb(%rip),%r12
jmp    1164 <main+0x44>
nopw   0x0(%rax,%rax,1)
add    $0xfffffc19,%r15d
add    $0x1,%r13d
mov    0x4(%rsp),%eax
sub    $0x1,%eax
jb     11a6 <main+0x86>
mov    %eax,0x4(%rsp)
mov    $0xfffffc18,%r14d
mov    %r15d,%ebp
jmp    1188 <main+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %r13d,%ebp
inc    %r14d
je     1150 <main+0x30>
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
test   %rax,%rax
je     1180 <main+0x60>
cmp    %ebx,%ebp
jle    1180 <main+0x60>
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %ebp,%ebx
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 999, i32* %6
br label %9
9: ; preds = %40, %2
%10 = load i32, i32* %6
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %43
12: ; preds = %9
store i32 999, i32* %7
br label %13
13: ; preds = %36, %12
%14 = load i32, i32* %7
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %39
16: ; preds = %13
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = mul nsw i32 %17, %18
%20 = call i64 @isPalindrome(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %35
22: ; preds = %16
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %8
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %34
28: ; preds = %22
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = mul nsw i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28, %22
br label %35
35: ; preds = %34, %16
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, -1
store i32 %38, i32* %7
br label %13
39: ; preds = %13
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, -1
store i32 %42, i32* %6
br label %9
43: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %20
%4 = phi i32 [ 0, %2 ], [ %17, %20 ]
%5 = phi i32 [ 999, %2 ], [ %21, %20 ]
br label %6
6: ; preds = %3, %16
%7 = phi i32 [ %4, %3 ], [ %17, %16 ]
%8 = phi i32 [ 999, %3 ], [ %18, %16 ]
%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
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %16
16: ; preds = %6, %14
%17 = phi i32 [ %9, %14 ], [ %7, %6 ]
%18 = add nsw i32 %8, -1
%19 = icmp eq i32 %8, 0
br i1 %19, label %20, label %6
20: ; preds = %16
%21 = add nsw i32 %5, -1
%22 = icmp eq i32 %5, 0
br i1 %22, label %23, label %3
23: ; preds = %20
ret i32 0
}