#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 max(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, j;
  int result = 0;
  for (i = 0; i < 1000; i++)
    for (j = 0; j < 1000; j++)
      if (is_palindrome(i * j))
        result = max(result, i * j);
  printf("%d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11bc <main+0x8c>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11a9 <main+0x79>
mov    -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1196 <main+0x66>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
call   1050 <max@plt>
mov    %eax,-0x10(%rbp)
jmp    119b <main+0x6b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x31>
jmp    11ae <main+0x7e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe3a(%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   %rbx
push   %rax
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    114d <main+0x1d>
nop
add    $0x1,%r14d
cmp    $0x3e8,%r14d
je     1183 <main+0x53>
mov    $0x3e8,%ebx
xor    %ebp,%ebp
jmp    1168 <main+0x38>
cs nopw 0x0(%rax,%rax,1)
add    %r14d,%ebp
add    $0xffffffff,%ebx
je     1140 <main+0x10>
mov    %ebp,%edi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <max@plt>
mov    %eax,%r15d
jmp    1160 <main+0x30>
lea    0xe76(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %2
br label %5
5: ; preds = %29, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = mul nsw i32 %13, %14
%16 = call i64 @is_palindrome(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = mul nsw i32 %20, %21
%23 = call i32 @max(i32 %19, i32 %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %18, %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %9
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %5
32: ; preds = %5
%33 = load i32, i32* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
ret i32 0
}

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