#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 */
bool pcheck(int n) {
  int ldig, fdig;
  if (n < 10) {
    return true;
  } else if (n > 99) {
    ldig = n % 10;
    fdig = (n - (n % 100)) / 100;
    if (fdig == ldig) {
      return true;
    } else {
      return false;
    }
  } else {
    ldig = n % 10;
    fdig = (n - (n % 10)) / 10;
    if (fdig == ldig) {
      return true;
    } else {
      return false;
    }
  }
}


x86 assembly (clang, -O0):
<pcheck>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    111d <pcheck+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <pcheck+0xc8>
cmpl   $0x63,-0x8(%rbp)
jle    117a <pcheck+0x7a>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
sub    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    116e <pcheck+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <pcheck+0xc8>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <pcheck+0xc8>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
sub    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11c1 <pcheck+0xc1>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <pcheck+0xc8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcheck>:
mov    $0x1,%al
cmp    $0xa,%edi
jl     114b <pcheck+0x4b>
cmp    $0x64,%edi
jb     1131 <pcheck+0x31>
mov    %edi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
cmp    %edi,%eax
jmp    1148 <pcheck+0x48>
movzbl %dil,%eax
imul   $0xcd,%eax,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%al
cmp    %al,%cl
sete   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @pcheck(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
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 %38
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 99
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %3
%14 = srem i32 %13, 10
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = srem i32 %16, 100
%18 = sub nsw i32 %15, %17
%19 = sdiv i32 %18, 100
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %12
store i32 1, i32* %2
br label %38
24: ; preds = %12
store i32 0, i32* %2
br label %38
25: ; preds = %9
%26 = load i32, i32* %3
%27 = srem i32 %26, 10
store i32 %27, i32* %4
%28 = load i32, i32* %3
%29 = load i32, i32* %3
%30 = srem i32 %29, 10
%31 = sub nsw i32 %28, %30
%32 = sdiv i32 %31, 10
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = load i32, i32* %4
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %37
36: ; preds = %25
store i32 1, i32* %2
br label %38
37: ; preds = %25
store i32 0, i32* %2
br label %38
38: ; preds = %37, %36, %24, %23, %8
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @pcheck(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 99
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = urem i32 %0, 10
%7 = udiv i32 %0, 100
%8 = icmp eq i32 %7, %6
br label %14
9: ; preds = %3
%10 = trunc i32 %0 to i8
%11 = urem i8 %10, 10
%12 = udiv i8 %10, 10
%13 = icmp eq i8 %12, %11
br label %14
14: ; preds = %9, %5, %1
%15 = phi i1 [ true, %1 ], [ %8, %5 ], [ %13, %9 ]
%16 = zext i1 %15 to i32
ret i32 %16
}