#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__ ispalindrome(size_t);
int /*<<< orphan*/ printf(char *, size_t);
int main(int argc, char **argv) {
  size_t num1, num2;
  size_t best = 0;
  for (num1 = 999; num1 >= 100; --num1)
    for (num2 = 999; num2 >= 100; --num2) {
      size_t product = num1 * num2;
      if (ispalindrome(product) && product > best) {
        best = product;
      }
    }
  printf("Found palindromic product: %zu\n", best);
  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)
movq   $0x0,-0x28(%rbp)
movq   $0x3e7,-0x18(%rbp)
cmpq   $0x64,-0x18(%rbp)
jb     11c6 <main+0xa6>
movq   $0x3e7,-0x20(%rbp)
cmpq   $0x64,-0x20(%rbp)
jb     11b0 <main+0x90>
mov    -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <ispalindrome@plt>
cmp    $0x0,%rax
je     119a <main+0x7a>
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    119a <main+0x7a>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    119f <main+0x7f>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1159 <main+0x39>
jmp    11b5 <main+0x95>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1146 <main+0x26>
mov    -0x28(%rbp),%rsi
lea    0xe2f(%rip),%rdi
call   1030 <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
push   %rax
mov    $0x3e7,%eax
mov    $0xf3a71,%r12d
mov    $0xfffffffffffffc19,%r13
xor    %r14d,%r14d
mov    %rax,(%rsp)
mov    %r12,%rbx
mov    $0x3e7,%ebp
nopl   0x0(%rax)
mov    %r14,%r15
mov    %rbx,%rdi
call   1040 <ispalindrome@plt>
cmp    %r14,%rbx
cmova  %rbx,%r14
test   %rax,%rax
cmove  %r15,%r14
add    $0xffffffffffffffff,%rbp
add    %r13,%rbx
cmp    $0x63,%rbp
ja     1150 <main+0x30>
mov    (%rsp),%rax
add    $0xffffffffffffffff,%rax
add    $0xfffffffffffffc19,%r12
add    $0x1,%r13
cmp    $0x63,%rax
ja     1140 <main+0x20>
lea    0xe6a(%rip),%rdi
mov    %r14,%rsi
call   1030 <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 = [32 x i8] c"Found palindromic product: %zu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %8
store i64 999, i64* %6
br label %10
10: ; preds = %35, %2
%11 = load i64, i64* %6
%12 = icmp uge i64 %11, 100
br i1 %12, label %13, label %38
13: ; preds = %10
store i64 999, i64* %7
br label %14
14: ; preds = %31, %13
%15 = load i64, i64* %7
%16 = icmp uge i64 %15, 100
br i1 %16, label %17, label %34
17: ; preds = %14
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = mul i64 %18, %19
store i64 %20, i64* %9
%21 = load i64, i64* %9
%22 = call i64 @ispalindrome(i64 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %17
%25 = load i64, i64* %9
%26 = load i64, i64* %8
%27 = icmp ugt i64 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i64, i64* %9
store i64 %29, i64* %8
br label %30
30: ; preds = %28, %24, %17
br label %31
31: ; preds = %30
%32 = load i64, i64* %7
%33 = add i64 %32, -1
store i64 %33, i64* %7
br label %14
34: ; preds = %14
br label %35
35: ; preds = %34
%36 = load i64, i64* %6
%37 = add i64 %36, -1
store i64 %37, i64* %6
br label %10
38: ; preds = %10
%39 = load i64, i64* %8
%40 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Found palindromic product: %zu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %17
%4 = phi i64 [ 999, %2 ], [ %18, %17 ]
%5 = phi i64 [ 0, %2 ], [ %14, %17 ]
br label %6
6: ; preds = %3, %6
%7 = phi i64 [ %5, %3 ], [ %14, %6 ]
%8 = phi i64 [ 999, %3 ], [ %15, %6 ]
%9 = mul nuw nsw i64 %8, %4
%10 = tail call i64 @ispalindrome(i64 %9)
%11 = icmp ne i64 %10, 0
%12 = icmp ugt i64 %9, %7
%13 = select i1 %11, i1 %12, i1 false
%14 = select i1 %13, i64 %9, i64 %7
%15 = add nsw i64 %8, -1
%16 = icmp ugt i64 %15, 99
br i1 %16, label %6, label %17
17: ; preds = %6
%18 = add nsw i64 %4, -1
%19 = icmp ugt i64 %18, 99
br i1 %19, label %3, label %20
20: ; preds = %17
%21 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %14)
ret i32 0
}