#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*/ ToBase(int, int, char *);
scalar_t__ isPalindrome(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int dualpal(int num) {
  int i;
  int bases = 0;
  char number[100002];
  for (i = 2; i <= 10; ++i) {
    memset(number, 0, 100002);
    ToBase(num, i, number);
    if (isPalindrome(number)) {
      ++bases;
    }
    if (bases == 2)
      break;
  }
  if (bases == 2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<dualpal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     11bc <dualpal+0x8c>
lea    -0x186c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x186c0(%rbp),%rdx
call   1030 <ToBase@plt>
lea    -0x186c0(%rbp),%rdi
call   1050 <isPalindrome@plt>
cmp    $0x0,%rax
je     119a <dualpal+0x6a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jne    11a9 <dualpal+0x79>
jmp    11bc <dualpal+0x8c>
jmp    11ae <dualpal+0x7e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <dualpal+0x1c>
cmpl   $0x2,-0x10(%rbp)
jne    11d2 <dualpal+0xa2>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <dualpal+0xa9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dualpal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x186a8,%rsp
mov    %edi,%r15d
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x2,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x3,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
mov    $0x1,%r14d
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x4,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x5,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x6,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x7,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x8,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0x9,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    $0x2,%ebx
je     133e <dualpal+0x20e>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x186a2,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    $0xa,%esi
mov    %rbp,%rdx
call   1030 <ToBase@plt>
mov    %rbp,%rdi
call   1050 <isPalindrome@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
xor    %r14d,%r14d
cmp    $0x2,%ebx
sete   %r14b
mov    %r14d,%eax
add    $0x186a8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @dualpal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100002 x i8]
store i32 %0, i32* %3
store i32 0, i32* %5
store i32 2, i32* %4
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = getelementptr inbounds [100002 x i8], [100002 x i8]* %6, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 100002)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = getelementptr inbounds [100002 x i8], [100002 x i8]* %6, i64 0, i64 0
%16 = call i32 @ToBase(i32 %13, i32 %14, i8* %15)
%17 = getelementptr inbounds [100002 x i8], [100002 x i8]* %6, i64 0, i64 0
%18 = call i64 @isPalindrome(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %10
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %23
23: ; preds = %20, %10
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %27
26: ; preds = %23
br label %31
27: ; preds = %23
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %7
31: ; preds = %26, %7
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 2
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 1, i32* %2
br label %36
35: ; preds = %31
store i32 0, i32* %2
br label %36
36: ; preds = %35, %34
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @dualpal(i32 %0) {
%2 = alloca [100002 x i8]
%3 = getelementptr inbounds [100002 x i8], [100002 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 100002)
%5 = call i32 @ToBase(i32 %0, i32 2, i8* %3)
%6 = call i64 @isPalindrome(i8* %3)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @memset(i8* %3, i32 0, i32 100002)
%10 = call i32 @ToBase(i32 %0, i32 3, i8* %3)
%11 = call i64 @isPalindrome(i8* %3)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %8, %13
%15 = icmp eq i32 %14, 2
br i1 %15, label %73, label %16
16: ; preds = %1
%17 = call i32 @memset(i8* %3, i32 0, i32 100002)
%18 = call i32 @ToBase(i32 %0, i32 4, i8* %3)
%19 = call i64 @isPalindrome(i8* %3)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %14, %21
%23 = icmp eq i32 %22, 2
br i1 %23, label %73, label %24
24: ; preds = %16
%25 = call i32 @memset(i8* %3, i32 0, i32 100002)
%26 = call i32 @ToBase(i32 %0, i32 5, i8* %3)
%27 = call i64 @isPalindrome(i8* %3)
%28 = icmp ne i64 %27, 0
%29 = zext i1 %28 to i32
%30 = add nuw nsw i32 %22, %29
%31 = icmp eq i32 %30, 2
br i1 %31, label %73, label %32
32: ; preds = %24
%33 = call i32 @memset(i8* %3, i32 0, i32 100002)
%34 = call i32 @ToBase(i32 %0, i32 6, i8* %3)
%35 = call i64 @isPalindrome(i8* %3)
%36 = icmp ne i64 %35, 0
%37 = zext i1 %36 to i32
%38 = add nuw nsw i32 %30, %37
%39 = icmp eq i32 %38, 2
br i1 %39, label %73, label %40
40: ; preds = %32
%41 = call i32 @memset(i8* %3, i32 0, i32 100002)
%42 = call i32 @ToBase(i32 %0, i32 7, i8* %3)
%43 = call i64 @isPalindrome(i8* %3)
%44 = icmp ne i64 %43, 0
%45 = zext i1 %44 to i32
%46 = add nuw nsw i32 %38, %45
%47 = icmp eq i32 %46, 2
br i1 %47, label %73, label %48
48: ; preds = %40
%49 = call i32 @memset(i8* %3, i32 0, i32 100002)
%50 = call i32 @ToBase(i32 %0, i32 8, i8* %3)
%51 = call i64 @isPalindrome(i8* %3)
%52 = icmp ne i64 %51, 0
%53 = zext i1 %52 to i32
%54 = add nuw nsw i32 %46, %53
%55 = icmp eq i32 %54, 2
br i1 %55, label %73, label %56
56: ; preds = %48
%57 = call i32 @memset(i8* %3, i32 0, i32 100002)
%58 = call i32 @ToBase(i32 %0, i32 9, i8* %3)
%59 = call i64 @isPalindrome(i8* %3)
%60 = icmp ne i64 %59, 0
%61 = zext i1 %60 to i32
%62 = add nuw nsw i32 %54, %61
%63 = icmp eq i32 %62, 2
br i1 %63, label %73, label %64
64: ; preds = %56
%65 = call i32 @memset(i8* %3, i32 0, i32 100002)
%66 = call i32 @ToBase(i32 %0, i32 10, i8* %3)
%67 = call i64 @isPalindrome(i8* %3)
%68 = icmp ne i64 %67, 0
%69 = zext i1 %68 to i32
%70 = add nuw nsw i32 %62, %69
%71 = icmp eq i32 %70, 2
%72 = zext i1 %71 to i32
br label %73
73: ; preds = %64, %56, %48, %40, %32, %24, %16, %1
%74 = phi i32 [ 1, %1 ], [ 1, %16 ], [ 1, %24 ], [ 1, %32 ], [ 1, %40 ], [ 1, %48 ], [ 1, %56 ], [ %72, %64 ]
ret i32 %74
}