#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(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int main(int argc, char *argv[]) {
  int max = 0;
  for (int i = 100; i < 1000; i++) {
    for (int j = i; j < 1000; j++) {
      char letters[6] = {0};
      snprintf(letters, 6, "%i", i * j);
      if (is_palindrome(letters)) {
        if (i * j > max) {
          max = i * j;
        }
      }
    }
  }
  printf("%i", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x64,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    1208 <main+0xc8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11f5 <main+0xb5>
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1060 <memset@plt>
lea    -0x22(%rbp),%rdi
mov    -0x18(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    $0x6,%esi
lea    0xe55(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x22(%rbp),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     11e2 <main+0xa2>
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11dd <main+0x9d>
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e2 <main+0xa2>
jmp    11e7 <main+0xa7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1177 <main+0x37>
jmp    11fa <main+0xba>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
mov    $0x64,%r12d
mov    $0x384,%r13d
mov    $0xc9,%eax
mov    $0x2710,%ebp
lea    0xea3(%rip),%r14
lea    0x10(%rsp),%r15
jmp    1193 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r12d
mov    0xc(%rsp),%r13d
add    $0xffffffff,%r13d
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ebp
add    %eax,%ebp
add    $0x2,%eax
cmp    $0x3e8,%r12d
je     11f2 <main+0xc2>
mov    %eax,0x8(%rsp)
mov    %ebp,0x4(%rsp)
mov    %r13d,0xc(%rsp)
jmp    11bf <main+0x8f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %rax,%rax
cmovne %ecx,%ebx
add    %r12d,%ebp
add    $0xffffffff,%r13d
je     1170 <main+0x40>
movw   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
mov    %r15,%rdi
mov    $0x6,%esi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1050 <snprintf@plt>
mov    %r15,%rdi
call   1030 <is_palindrome@plt>
mov    %ebp,%ecx
cmp    %ebx,%ebp
jg     11b0 <main+0x80>
mov    %ebx,%ecx
jmp    11b0 <main+0x80>
lea    0xe07(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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