#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*/ biggest_palindrome(int);
scalar_t__ is_palindrome(int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  printf("is %d a palindrome? %s\n", 1234, is_palindrome(1234) ? "yes" : "no");
  printf("is %d a palindrome? %s\n", 1331, is_palindrome(1331) ? "yes" : "no");
  printf("is %d a palindrome? %s\n", 1, is_palindrome(1) ? "yes" : "no");
  printf("largest palindrome of two digit numbers: %lu\n",
         biggest_palindrome(999));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4d2,%edi
call   1040 <is_palindrome@plt>
mov    %rax,%rcx
lea    0xec9(%rip),%rdx
lea    0xebe(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe97(%rip),%rdi
mov    $0x4d2,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x533,%edi
call   1040 <is_palindrome@plt>
mov    %rax,%rcx
lea    0xe93(%rip),%rdx
lea    0xe88(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe61(%rip),%rdi
mov    $0x533,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <is_palindrome@plt>
mov    %rax,%rcx
lea    0xe5d(%rip),%rdx
lea    0xe52(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe2b(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3e7,%edi
call   1030 <biggest_palindrome@plt>
mov    %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4d2,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
lea    0xed3(%rip),%r15
lea    0xec8(%rip),%rbx
mov    %rbx,%rdx
cmove  %r15,%rdx
lea    0xea2(%rip),%r14
mov    %r14,%rdi
mov    $0x4d2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x533,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x533,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <is_palindrome@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3e7,%edi
call   1030 <biggest_palindrome@plt>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"is %d a palindrome? %s\0A\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [46 x i8] c"largest palindrome of two digit numbers: %lu\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @is_palindrome(i32 1234)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1234, i8* %5)
%7 = call i64 @is_palindrome(i32 1331)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1331, i8* %10)
%12 = call i64 @is_palindrome(i32 1)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1, i8* %15)
%17 = call i32 @biggest_palindrome(i32 999)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"is %d a palindrome? %s\0A\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [46 x i8] c"largest palindrome of two digit numbers: %lu\0A\00"
define i32 @main() {
%1 = tail call i64 @is_palindrome(i32 1234)
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1234, i8* %3)
%5 = tail call i64 @is_palindrome(i32 1331)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1331, i8* %7)
%9 = tail call i64 @is_palindrome(i32 1)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1, i8* %11)
%13 = tail call i32 @biggest_palindrome(i32 999)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i32 %13)
ret i32 0
}