#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__ palindrome(long const);
int /*<<< orphan*/ printf(char *, long);
int main(int argc, char **argv) {
  long int largest = 0;
  for (int i = 100; i < 1000; i++) {
    for (int j = i; j < 1000; j++) {
      const long product = i * j;
      if (product > largest && palindrome(product)) {
        largest = product;
      }
    }
  }
  printf("%ld\n", largest);
}


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)
movq   $0x0,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11c1 <main+0xa1>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x3e8,-0x20(%rbp)
jge    11ae <main+0x8e>
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    119b <main+0x7b>
mov    -0x28(%rbp),%rdi
call   1040 <palindrome@plt>
cmp    $0x0,%rax
je     119b <main+0x7b>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    11a0 <main+0x80>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1158 <main+0x38>
jmp    11b3 <main+0x93>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <main+0x25>
mov    -0x18(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%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
mov    $0x64,%r15d
mov    $0xc9,%eax
mov    $0x2710,%r13d
mov    $0x384,%r12d
xor    %r14d,%r14d
jmp    1172 <main+0x52>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%r13
add    %rax,%r13
add    $0x2,%rax
add    $0xffffffffffffffff,%r12
cmp    $0x3e8,%r15
je     11b2 <main+0x92>
mov    %rax,0x10(%rsp)
mov    %r12,%rbp
mov    %r13,0x8(%rsp)
jmp    1199 <main+0x79>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %r15,%r13
add    $0xffffffffffffffff,%rbp
je     1150 <main+0x30>
mov    %r13d,%ebx
cmp    %rbx,%r14
jge    1190 <main+0x70>
mov    %rbx,%rdi
call   1040 <palindrome@plt>
test   %rax,%rax
cmovne %rbx,%r14
jmp    1190 <main+0x70>
lea    0xe47(%rip),%rdi
mov    %r14,%rsi
call   1030 <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 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i32 100, i32* %7
br label %10
10: ; preds = %37, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = load i32, i32* %7
store i32 %14, i32* %8
br label %15
15: ; preds = %33, %13
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 1000
br i1 %17, label %18, label %36
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = mul nsw i32 %19, %20
%22 = sext i32 %21 to i64
store i64 %22, i64* %9
%23 = load i64, i64* %9
%24 = load i64, i64* %6
%25 = icmp sgt i64 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %18
%27 = load i64, i64* %9
%28 = call i64 @palindrome(i64 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i64, i64* %9
store i64 %31, i64* %6
br label %32
32: ; preds = %30, %26, %18
br label %33
33: ; preds = %32
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %15
36: ; preds = %15
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %10
40: ; preds = %10
%41 = load i64, i64* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %41)
%43 = load i32, i32* %3
ret i32 %43
}

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