int palindrome(int number) {
  if (number % 10 == number / 100000) {
    if ((number % 100) / 10 == (number / 10000) % 10) {
      if ((number % 1000) / 100 == (number / 1000) % 100)
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<palindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%edx
cmp    %eax,%edx
jne    11ad <palindrome+0xad>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
cmp    %edx,%eax
jne    11a8 <palindrome+0xa8>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
cmp    %edx,%eax
jne    11a3 <palindrome+0xa3>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <palindrome+0xb4>
jmp    11a8 <palindrome+0xa8>
jmp    11ad <palindrome+0xad>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<palindrome>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x2d,%rcx
add    %esi,%ecx
cmp    %ecx,%edx
jne    11f6 <palindrome+0xf6>
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
movsbl %dl,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
shr    $0xa,%edx
add    %cl,%dl
movsbl %dl,%ecx
imul   $0x68db8bad,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x2c,%rdx
add    %esi,%edx
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
cmp    %ecx,%edx
jne    11f6 <palindrome+0xf6>
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%edx
sub    %edx,%eax
cwtl
imul   $0x147b,%eax,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x13,%edx
add    %eax,%edx
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rax
add    %esi,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
mov    $0x1,%eax
cmp    %edx,%ecx
je     11f8 <palindrome+0xf8>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @palindrome(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 10
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 100000
%8 = icmp eq i32 %5, %7
br i1 %8, label %9, label %28
9: ; preds = %1
%10 = load i32, i32* %3
%11 = srem i32 %10, 100
%12 = sdiv i32 %11, 10
%13 = load i32, i32* %3
%14 = sdiv i32 %13, 10000
%15 = srem i32 %14, 10
%16 = icmp eq i32 %12, %15
br i1 %16, label %17, label %27
17: ; preds = %9
%18 = load i32, i32* %3
%19 = srem i32 %18, 1000
%20 = sdiv i32 %19, 100
%21 = load i32, i32* %3
%22 = sdiv i32 %21, 1000
%23 = srem i32 %22, 100
%24 = icmp eq i32 %20, %23
br i1 %24, label %25, label %26
25: ; preds = %17
store i32 1, i32* %2
br label %29
26: ; preds = %17
br label %27
27: ; preds = %26, %9
br label %28
28: ; preds = %27, %1
store i32 0, i32* %2
br label %29
29: ; preds = %28, %25
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @palindrome(i32 %0) {
%2 = srem i32 %0, 10
%3 = sdiv i32 %0, 100000
%4 = icmp eq i32 %2, %3
br i1 %4, label %5, label %21
5: ; preds = %1
%6 = srem i32 %0, 100
%7 = trunc i32 %6 to i8
%8 = sdiv i8 %7, 10
%9 = sext i8 %8 to i32
%10 = sdiv i32 %0, 10000
%11 = srem i32 %10, 10
%12 = icmp eq i32 %11, %9
br i1 %12, label %13, label %21
13: ; preds = %5
%14 = srem i32 %0, 1000
%15 = trunc i32 %14 to i16
%16 = sdiv i16 %15, 100
%17 = sext i16 %16 to i32
%18 = sdiv i32 %0, 1000
%19 = srem i32 %18, 100
%20 = icmp eq i32 %19, %17
br i1 %20, label %22, label %21
21: ; preds = %5, %13, %1
br label %22
22: ; preds = %13, %21
%23 = phi i32 [ 0, %21 ], [ 1, %13 ]
ret i32 %23
}