#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__ checkPalindrome(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  unsigned int max = 0, mul = 0;
  unsigned int i = 0, j = 0;
  for (i = 999; i > 100; i--) {
    for (j = i; j > 100; j--) {
      mul = i * j;
      if ((mul > max) && checkPalindrome(mul))
        max = mul;
    }
  }
  printf("The largest palindrome is : %d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x3e7,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jbe    11c0 <main+0xa0>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jbe    11ad <main+0x8d>
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    119a <main+0x7a>
mov    -0xc(%rbp),%edi
call   1030 <checkPalindrome@plt>
cmp    $0x0,%rax
je     119a <main+0x7a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    119f <main+0x7f>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x42>
jmp    11b2 <main+0x92>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <main+0x32>
mov    -0x8(%rbp),%esi
lea    0xe36(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
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
xor    %ebx,%ebx
mov    $0x3e7,%r15d
mov    $0xfffff833,%eax
mov    $0xf3a71,%r12d
mov    $0xfffffc19,%r13d
jmp    1168 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%r15d
mov    0x4(%rsp),%eax
add    %eax,%r12d
add    $0x2,%eax
add    $0x1,%r13d
cmp    $0x64,%r15d
jbe    11a0 <main+0x80>
mov    %eax,0x4(%rsp)
mov    %r12d,%ebp
mov    %r15d,%r14d
jmp    118d <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%r14d
add    %r13d,%ebp
cmp    $0x64,%r14d
jbe    1150 <main+0x30>
cmp    %ebx,%ebp
jbe    1180 <main+0x60>
mov    %ebp,%edi
call   1030 <checkPalindrome@plt>
test   %rax,%rax
cmovne %ebp,%ebx
jmp    1180 <main+0x60>
lea    0xe59(%rip),%rdi
mov    %ebx,%esi
call   1040 <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"The largest palindrome is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 999, i32* %4
br label %6
6: ; preds = %32, %0
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 100
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i32, i32* %4
store i32 %10, i32* %5
br label %11
11: ; preds = %28, %9
%12 = load i32, i32* %5
%13 = icmp ugt i32 %12, 100
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = mul i32 %15, %16
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp ugt i32 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* %3
%23 = call i64 @checkPalindrome(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %3
store i32 %26, i32* %2
br label %27
27: ; preds = %25, %21, %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add i32 %29, -1
store i32 %30, i32* %5
br label %11
31: ; preds = %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add i32 %33, -1
store i32 %34, i32* %4
br label %6
35: ; preds = %6
%36 = load i32, i32* %2
%37 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %36)
ret i32 0
}

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