#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 reverseNum(int);
int isReversible(int num) {
  long sum, digit;
  if (num % 10 == 0) {
    return 0;
  }
  sum = num + reverseNum(num);
  while (sum) {
    digit = sum % 10;
    if (!(digit & 1)) {
      return 0;
    }
    sum /= 10;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isReversible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113b <isReversible+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    11af <isReversible+0x9f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <reverseNum@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a8 <isReversible+0x98>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    1191 <isReversible+0x81>
movl   $0x0,-0x4(%rbp)
jmp    11af <isReversible+0x9f>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    1156 <isReversible+0x46>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isReversible>:
push   %rbp
push   %rbx
push   %rax
imul   $0xcccccccd,%edi,%eax
add    $0x19999998,%eax
ror    %eax
xor    %ebx,%ebx
cmp    $0x19999999,%eax
jb     117b <isReversible+0x6b>
mov    %edi,%ebp
call   1030 <reverseNum@plt>
add    %ebp,%eax
je     1176 <isReversible+0x66>
movslq %eax,%rcx
movabs $0x6666666666666667,%rsi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
imul   %rsi
test   $0x1,%cl
je     117b <isReversible+0x6b>
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    $0x9,%rcx
cmp    $0x12,%rcx
mov    %rdx,%rcx
ja     1150 <isReversible+0x40>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isReversible(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = srem i32 %6, 10
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %30
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = call i32 @reverseNum(i32 %12)
%14 = add nsw i32 %11, %13
%15 = sext i32 %14 to i64
store i64 %15, i64* %4
br label %16
16: ; preds = %26, %10
%17 = load i64, i64* %4
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i64, i64* %4
%21 = srem i64 %20, 10
store i64 %21, i64* %5
%22 = load i64, i64* %5
%23 = and i64 %22, 1
%24 = icmp ne i64 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %19
store i32 0, i32* %2
br label %30
26: ; preds = %19
%27 = load i64, i64* %4
%28 = sdiv i64 %27, 10
store i64 %28, i64* %4
br label %16
29: ; preds = %16
store i32 1, i32* %2
br label %30
30: ; preds = %29, %25, %9
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @isReversible(i32 %0) {
%2 = srem i32 %0, 10
%3 = icmp eq i32 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = tail call i32 @reverseNum(i32 %0)
%6 = add nsw i32 %5, %0
%7 = icmp eq i32 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %4
%9 = sext i32 %6 to i64
br label %10
10: ; preds = %8, %16
%11 = phi i64 [ %13, %16 ], [ %9, %8 ]
%12 = srem i64 %11, 10
%13 = sdiv i64 %11, 10
%14 = and i64 %12, 1
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = add nsw i64 %11, 9
%18 = icmp ult i64 %17, 19
br i1 %18, label %19, label %10
19: ; preds = %10, %16, %4, %1
%20 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 0, %10 ], [ 1, %16 ]
ret i32 %20
}