#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*/ sprintf(char *, char *, int);
int strlen(char *);
bool is_palindrome_number(int number) {
  if (number < 10) {
    return true;
  }
  char to_string[16] = {0};
  sprintf(to_string, "%d", number);
  for (size_t i = 0; i < strlen(to_string) / 2; ++i) {
    if (to_string[i] != to_string[strlen(to_string) - 1 - i]) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<is_palindrome_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1151 <is_palindrome_number+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1201 <is_palindrome_number+0xd1>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe91(%rip),%rsi
call   1050 <sprintf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    11fa <is_palindrome_number+0xca>
mov    -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
mov    %eax,-0x34(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    $0x1,%ecx
movslq %ecx,%rcx
sub    -0x28(%rbp),%rcx
movsbl -0x20(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11e4 <is_palindrome_number+0xb4>
movl   $0x0,-0x4(%rbp)
jmp    1201 <is_palindrome_number+0xd1>
jmp    11e9 <is_palindrome_number+0xb9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    117c <is_palindrome_number+0x4c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_palindrome_number>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%r14d
cmp    $0xa,%edi
jl     11ac <is_palindrome_number+0x8c>
mov    %edi,%edx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
lea    0xeb9(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
add    $0xfffffffe,%eax
mov    $0x1,%r14d
cmp    $0xfffffffc,%eax
ja     11ac <is_palindrome_number+0x8c>
xor    %ebp,%ebp
mov    %r15,%rbx
nopl   (%rax)
movzbl (%rsp,%rbp,1),%r12d
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    -0x1(%rax,%rbx,1),%r12b
jne    11a9 <is_palindrome_number+0x89>
add    $0x1,%rbp
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
add    $0xffffffffffffffff,%rbx
cmp    %rax,%rbp
jb     1170 <is_palindrome_number+0x50>
jmp    11ac <is_palindrome_number+0x8c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @is_palindrome_number(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16 x i8]
%5 = alloca i64
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %42
9: ; preds = %1
%10 = bitcast [16 x i8]* %4 to i8*
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
store i64 0, i64* %5
br label %14
14: ; preds = %38, %9
%15 = load i64, i64* %5
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = sdiv i32 %17, 2
%19 = sext i32 %18 to i64
%20 = icmp ult i64 %15, %19
br i1 %20, label %21, label %41
21: ; preds = %14
%22 = load i64, i64* %5
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = load i64, i64* %5
%31 = sub i64 %29, %30
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %25, %34
br i1 %35, label %36, label %37
36: ; preds = %21
store i32 0, i32* %2
br label %42
37: ; preds = %21
br label %38
38: ; preds = %37
%39 = load i64, i64* %5
%40 = add i64 %39, 1
store i64 %40, i64* %5
br label %14
41: ; preds = %14
store i32 1, i32* %2
br label %42
42: ; preds = %41, %36, %8
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @is_palindrome_number(i32 %0) {
%2 = alloca [16 x i8]
%3 = icmp slt i32 %0, 10
br i1 %3, label %29, label %4
4: ; preds = %1
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 @strlen(i8* %5)
%8 = add i32 %7, -2
%9 = icmp ult i32 %8, -3
br i1 %9, label %15, label %27
10: ; preds = %15
%11 = call i32 @strlen(i8* %5)
%12 = sdiv i32 %11, 2
%13 = sext i32 %12 to i64
%14 = icmp ult i64 %26, %13
br i1 %14, label %15, label %27
15: ; preds = %4, %10
%16 = phi i64 [ %26, %10 ], [ 0, %4 ]
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = call i32 @strlen(i8* %5)
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = sub i64 %21, %16
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %18, %24
%26 = add nuw i64 %16, 1
br i1 %25, label %10, label %27
27: ; preds = %10, %15, %4
%28 = phi i32 [ 1, %4 ], [ 0, %15 ], [ 1, %10 ]
br label %29
29: ; preds = %1, %27
%30 = phi i32 [ %28, %27 ], [ 1, %1 ]
ret i32 %30
}