#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() {
  int i, j;
  i = 39;
  j = 565;
  int max_pal = 0;
  for (i = 1; i < 1000; i++) {
    for (j = i; j < 1000; j++) {
      if (is_palindrome(i * j) && i * j > max_pal) {
        max_pal = i * j;
      }
    }
  }
  printf("%d", max_pal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x27,-0x8(%rbp)
movl   $0x235,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11c1 <main+0xa1>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11ae <main+0x8e>
mov    -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     119b <main+0x7b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    119b <main+0x7b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a0 <main+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x3e>
jmp    11b3 <main+0x93>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <main+0x2b>
mov    -0x10(%rbp),%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    $0x3e7,%r14d
mov    $0x3,%eax
mov    $0x1,%r12d
mov    $0x1,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,(%rsp)
mov    %r12d,%ebp
mov    %r14d,0x4(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r15d
mov    %ebp,%edi
call   1030 <is_palindrome@plt>
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
test   %rax,%rax
cmove  %r15d,%ebx
add    %r13d,%ebp
add    $0xffffffff,%r14d
jne    1160 <main+0x40>
add    $0x1,%r13d
mov    0x4(%rsp),%r14d
add    $0xffffffff,%r14d
mov    (%rsp),%eax
add    %eax,%r12d
add    $0x2,%eax
cmp    $0x3e8,%r13d
jne    1150 <main+0x30>
lea    0xe5b(%rip),%rdi
mov    %ebx,%esi
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 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 39, i32* %2
store i32 565, i32* %3
store i32 0, i32* %4
store i32 1, i32* %2
br label %5
5: ; preds = %34, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %37
8: ; preds = %5
%9 = load i32, i32* %2
store i32 %9, i32* %3
br label %10
10: ; preds = %30, %8
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = mul nsw i32 %14, %15
%17 = call i64 @is_palindrome(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %13
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = mul nsw i32 %20, %21
%23 = load i32, i32* %4
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = mul nsw i32 %26, %27
store i32 %28, i32* %4
br label %29
29: ; preds = %25, %19, %13
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %10
33: ; preds = %10
br label %34
34: ; preds = %33
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %5
37: ; preds = %5
%38 = load i32, i32* %4
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
ret i32 0
}

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