#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 */
int check(int, int, int);
int is_palindrome(int);
int main(int argc, char **argv) {
  int largest = 0;
  int x, y, z;
  for (x = 100; x <= 999; x++) {
    for (y = 100; y <= 999; y++) {
      z = x * y;
      if (is_palindrome(z) == 1) {
        if (largest < z)
          largest = z;
      }
    }
  }
  return check(4, 906609, largest);
}


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,-0x14(%rbp)
movl   $0x64,-0x18(%rbp)
cmpl   $0x3e7,-0x18(%rbp)
jg     11bd <main+0x9d>
movl   $0x64,-0x1c(%rbp)
cmpl   $0x3e7,-0x1c(%rbp)
jg     11aa <main+0x8a>
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x1,%eax
jne    1197 <main+0x77>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1192 <main+0x72>
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <main+0x77>
jmp    119c <main+0x7c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1158 <main+0x38>
jmp    11af <main+0x8f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <main+0x24>
mov    -0x14(%rbp),%edx
mov    $0x4,%edi
mov    $0xdd571,%esi
call   1040 <check@plt>
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    $0x64,%r14d
xor    %ebx,%ebx
mov    $0x2710,%r15d
nopl   0x0(%rax)
mov    $0x384,%r12d
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    %ebx,%r13d
mov    %ebp,%edi
call   1030 <is_palindrome@plt>
cmp    %ebp,%ebx
cmovl  %ebp,%ebx
cmp    $0x1,%eax
cmovne %r13d,%ebx
add    %r14d,%ebp
add    $0xffffffff,%r12d
jne    1150 <main+0x30>
add    $0x1,%r14d
add    $0x64,%r15d
cmp    $0x3e8,%r14d
jne    1140 <main+0x20>
mov    $0x4,%edi
mov    $0xdd571,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <check@plt>

LLVM IR (-O0):
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 i32
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 = %36, %2
%11 = load i32, i32* %7
%12 = icmp sle i32 %11, 999
br i1 %12, label %13, label %39
13: ; preds = %10
store i32 100, i32* %8
br label %14
14: ; preds = %32, %13
%15 = load i32, i32* %8
%16 = icmp sle i32 %15, 999
br i1 %16, label %17, label %35
17: ; preds = %14
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = call i32 @is_palindrome(i32 %21)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %31
24: ; preds = %17
%25 = load i32, i32* %6
%26 = load i32, i32* %9
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* %9
store i32 %29, i32* %6
br label %30
30: ; preds = %28, %24
br label %31
31: ; preds = %30, %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %14
35: ; preds = %14
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %10
39: ; preds = %10
%40 = load i32, i32* %6
%41 = call i32 @check(i32 4, i32 906609, i32 %40)
ret i32 %41
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %17
%4 = phi i32 [ 0, %2 ], [ %14, %17 ]
%5 = phi i32 [ 100, %2 ], [ %18, %17 ]
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %4, %3 ], [ %14, %6 ]
%8 = phi i32 [ 100, %3 ], [ %15, %6 ]
%9 = mul nuw nsw i32 %8, %5
%10 = tail call i32 @is_palindrome(i32 %9)
%11 = icmp eq i32 %10, 1
%12 = icmp slt i32 %7, %9
%13 = select i1 %11, i1 %12, i1 false
%14 = select i1 %13, i32 %9, i32 %7
%15 = add nuw nsw i32 %8, 1
%16 = icmp eq i32 %15, 1000
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = add nuw nsw i32 %5, 1
%19 = icmp eq i32 %18, 1000
br i1 %19, label %20, label %3
20: ; preds = %17
%21 = tail call i32 @check(i32 4, i32 906609, i32 %14)
ret i32 %21
}