#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 /*<<< orphan*/ find_biggest();
scalar_t__ is_palindrome(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i;
  int n1 = 999;
  int n2 = 101;
  if (is_palindrome(n1)) {
    printf("999 is palindrome\n");
  } else {
    printf("999 is not palindrome, soemthing wrong\n");
    return 0;
  }
  if (is_palindrome(n2)) {
    printf("101 is palindrome\n");
  } else {
    printf("999 is not parline, soem\n");
    return 0;
  }
  int loops = 0;
  int big = 0;
  int p1 = 0, p2 = 0;
  for (i = n1; i >= n2; i--) {
    int j = n1;
    for (j = i; j >= n2; j--) {
      loops++;
      int p = i * j;
      if (p < big) {
        break;
      }
      if (is_palindrome(p)) {
        if (big < p) {
          big = p;
          p1 = i;
          p2 = j;
          printf(" it is %d = %d * %d\n", p, i, j);
        }
        break;
      }
    }
  }
  printf("biggest is %d = %d * %d, with %d loops\n", big, p1, p2, loops);
  find_biggest();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e7,-0xc(%rbp)
movl   $0x65,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1172 <main+0x42>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118c <main+0x5c>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d0 <main+0x1a0>
mov    -0x10(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     11b1 <main+0x81>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cb <main+0x9b>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d0 <main+0x1a0>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     12a7 <main+0x177>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1294 <main+0x164>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1235 <main+0x105>
jmp    1294 <main+0x164>
mov    -0x28(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1281 <main+0x151>
mov    -0x18(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    127c <main+0x14c>
mov    -0x28(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1294 <main+0x164>
jmp    1286 <main+0x156>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1205 <main+0xd5>
jmp    1299 <main+0x169>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11ed <main+0xbd>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <find_biggest@plt>
movl   $0x0,-0x4(%rbp)
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    $0x28,%rsp
mov    $0x3e7,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
je     12aa <main+0x16a>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x65,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
je     12b3 <main+0x173>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3e7,%r15d
mov    $0x383,%ecx
mov    $0xfffff833,%edx
mov    $0xf3a71,%r13d
mov    $0xfffffc19,%r12d
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    11ea <main+0xaa>
nop
mov    0x18(%rsp),%rcx
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%rsi
lea    -0x1(%rsi),%eax
add    $0xffffffff,%ecx
add    %edx,%r13d
add    $0x2,%edx
add    $0x1,%r12d
cmp    $0x65,%esi
mov    %eax,%r15d
jbe    1285 <main+0x145>
mov    %edx,0x4(%rsp)
mov    %rcx,0x18(%rsp)
lea    (%rbx,%rcx,1),%eax
mov    %eax,0x24(%rsp)
add    $0x1,%ebx
mov    %r13d,%ebp
mov    %r15,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r14d,%ebp
jl     11c0 <main+0x80>
mov    %ebp,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
jne    1240 <main+0x100>
lea    -0x1(%r15),%eax
add    %r12d,%ebp
add    $0x1,%ebx
cmp    $0x65,%r15d
mov    %eax,%r15d
jg     1210 <main+0xd0>
mov    0x24(%rsp),%eax
mov    %eax,%ebx
jmp    11c0 <main+0x80>
nopl   0x0(%rax)
cmp    %ebp,%r14d
jge    11c0 <main+0x80>
lea    0xdb0(%rip),%rdi
mov    %ebp,%esi
mov    0x8(%rsp),%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%r14d
mov    0x8(%rsp),%rsi
mov    %esi,%eax
mov    %esi,0x10(%rsp)
mov    %r15d,%eax
mov    %r15d,0x14(%rsp)
mov    0x18(%rsp),%rcx
mov    0x4(%rsp),%edx
jmp    11ce <main+0x8e>
lea    0xd89(%rip),%rdi
mov    %r14d,%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <find_biggest@plt>
jmp    12bf <main+0x17f>
lea    0xd8c(%rip),%rdi
jmp    12ba <main+0x17a>
lea    0xdbc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"999 is palindrome\0A\00"
@.str.1 = [40 x i8] c"999 is not palindrome, soemthing wrong\0A\00"
@.str.2 = [19 x i8] c"101 is palindrome\0A\00"
@.str.3 = [26 x i8] c"999 is not parline, soem\0A\00"
@.str.4 = [21 x i8] c" it is %d = %d * %d\0A\00"
@.str.5 = [40 x i8] c"biggest is %d = %d * %d, with %d loops\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 999, i32* %3
store i32 101, i32* %4
%11 = load i32, i32* %3
%12 = call i64 @is_palindrome(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %81
18: ; preds = %14
%19 = load i32, i32* %4
%20 = call i64 @is_palindrome(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %81
26: ; preds = %22
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%27 = load i32, i32* %3
store i32 %27, i32* %2
br label %28
28: ; preds = %71, %26
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = icmp sge i32 %29, %30
br i1 %31, label %32, label %74
32: ; preds = %28
%33 = load i32, i32* %3
store i32 %33, i32* %9
%34 = load i32, i32* %2
store i32 %34, i32* %9
br label %35
35: ; preds = %67, %32
%36 = load i32, i32* %9
%37 = load i32, i32* %4
%38 = icmp sge i32 %36, %37
br i1 %38, label %39, label %70
39: ; preds = %35
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = load i32, i32* %2
%43 = load i32, i32* %9
%44 = mul nsw i32 %42, %43
store i32 %44, i32* %10
%45 = load i32, i32* %10
%46 = load i32, i32* %6
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %49
48: ; preds = %39
br label %70
49: ; preds = %39
%50 = load i32, i32* %10
%51 = call i64 @is_palindrome(i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %66
53: ; preds = %49
%54 = load i32, i32* %6
%55 = load i32, i32* %10
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %65
57: ; preds = %53
%58 = load i32, i32* %10
store i32 %58, i32* %6
%59 = load i32, i32* %2
store i32 %59, i32* %7
%60 = load i32, i32* %9
store i32 %60, i32* %8
%61 = load i32, i32* %10
%62 = load i32, i32* %2
%63 = load i32, i32* %9
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %61, i32 %62, i32 %63)
br label %65
65: ; preds = %57, %53
br label %70
66: ; preds = %49
br label %67
67: ; preds = %66
%68 = load i32, i32* %9
%69 = add nsw i32 %68, -1
store i32 %69, i32* %9
br label %35
70: ; preds = %65, %48, %35
br label %71
71: ; preds = %70
%72 = load i32, i32* %2
%73 = add nsw i32 %72, -1
store i32 %73, i32* %2
br label %28
74: ; preds = %28
%75 = load i32, i32* %6
%76 = load i32, i32* %7
%77 = load i32, i32* %8
%78 = load i32, i32* %5
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %75, i32 %76, i32 %77, i32 %78)
%80 = call i32 (...) @find_biggest()
store i32 0, i32* %1
br label %81
81: ; preds = %74, %24, %16
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
@.str.4 = [21 x i8] c" it is %d = %d * %d\0A\00"
@.str.5 = [40 x i8] c"biggest is %d = %d * %d, with %d loops\0A\00"
@str = [39 x i8] c"999 is not palindrome, soemthing wrong\00"
@str.6 = [18 x i8] c"999 is palindrome\00"
@str.7 = [25 x i8] c"999 is not parline, soem\00"
@str.8 = [18 x i8] c"101 is palindrome\00"
define i32 @main() {
%1 = tail call i64 @is_palindrome(i32 999)
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i64 @is_palindrome(i32 101)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %9
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %48
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %48
13: ; preds = %37, %9
%14 = phi i32 [ 899, %9 ], [ %44, %37 ]
%15 = phi i32 [ 0, %9 ], [ %41, %37 ]
%16 = phi i32 [ 0, %9 ], [ %40, %37 ]
%17 = phi i32 [ 0, %9 ], [ %39, %37 ]
%18 = phi i32 [ 0, %9 ], [ %38, %37 ]
%19 = phi i32 [ 999, %9 ], [ %42, %37 ]
%20 = add i32 %18, %14
br label %21
21: ; preds = %13, %34
%22 = phi i32 [ %35, %34 ], [ %19, %13 ]
%23 = phi i32 [ %24, %34 ], [ %18, %13 ]
%24 = add nsw i32 %23, 1
%25 = mul nsw i32 %22, %19
%26 = icmp slt i32 %25, %17
br i1 %26, label %37, label %27
27: ; preds = %21
%28 = tail call i64 @is_palindrome(i32 %25)
%29 = icmp eq i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = icmp slt i32 %17, %25
br i1 %31, label %32, label %37
32: ; preds = %30
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %19, i32 %22)
br label %37
34: ; preds = %27
%35 = add nsw i32 %22, -1
%36 = icmp sgt i32 %22, 101
br i1 %36, label %21, label %37
37: ; preds = %34, %21, %30, %32
%38 = phi i32 [ %24, %32 ], [ %24, %30 ], [ %20, %34 ], [ %24, %21 ]
%39 = phi i32 [ %25, %32 ], [ %17, %30 ], [ %17, %21 ], [ %17, %34 ]
%40 = phi i32 [ %19, %32 ], [ %16, %30 ], [ %16, %21 ], [ %16, %34 ]
%41 = phi i32 [ %22, %32 ], [ %15, %30 ], [ %15, %21 ], [ %15, %34 ]
%42 = add nsw i32 %19, -1
%43 = icmp ugt i32 %19, 101
%44 = add nsw i32 %14, -1
br i1 %43, label %13, label %45
45: ; preds = %37
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 %40, i32 %41, i32 %38)
%47 = tail call i32 (...) @find_biggest()
br label %48
48: ; preds = %45, %11, %7
ret i32 0
}