#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 EXIT_SUCCESS;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int isprime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ stdin;
int main(void) {
  int i, value, reverse, start, end;
  printf("請輸入一個範圍A~B：");
  fflush(stdin);
  scanf("%d %d", &start, &end);
  printf("同時是質數和反質數者為：\n");
  for (i = start; i <= end; i++) {
    value = isprime(i);
    if (value) {
      reverse = ((value % 10) * 10) + (value / 10);
      if (value == reverse)
        continue;
      else {
        if (isprime(reverse))
          printf("%d\n", value);
      }
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xeaa(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     122a <main+0xea>
mov    -0x8(%rbp),%edi
call   1040 <isprime@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1217 <main+0xd7>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
imul   $0xa,%edx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11eb <main+0xab>
jmp    121c <main+0xdc>
mov    -0x10(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%eax
je     120d <main+0xcd>
mov    -0xc(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1212 <main+0xd2>
jmp    1217 <main+0xd7>
jmp    121c <main+0xdc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <main+0x53>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    0xea1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1070 <scanf@plt>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%ebx
cmp    0x8(%rsp),%ebx
jle    11b2 <main+0x62>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe69(%rip),%r14
jmp    11cb <main+0x7b>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    0x8(%rsp),%ebx
mov    %eax,%ebx
jge    11a0 <main+0x50>
mov    %ebx,%edi
call   1050 <isprime@plt>
test   %eax,%eax
je     11c0 <main+0x70>
mov    %eax,%ebp
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %ebp,%edx
sub    %ecx,%edx
lea    (%rdx,%rdx,4),%ecx
lea    (%rax,%rcx,2),%edi
cmp    %edi,%ebp
je     11c0 <main+0x70>
call   1050 <isprime@plt>
test   %eax,%eax
je     11c0 <main+0x70>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c0 <main+0x70>

LLVM IR (-O0):
@.str = [28 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E4\B8\80\E5\80\8B\E7\AF\84\E5\9C\8DA~B\EF\BC\9A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [38 x i8] c"\E5\90\8C\E6\99\82\E6\98\AF\E8\B3\AA\E6\95\B8\E5\92\8C\E5\8F\8D\E8\B3\AA\E6\95\B8\E8\80\85\E7\82\BA\EF\BC\9A\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %5
store i32 %12, i32* %2
br label %13
13: ; preds = %43, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %6
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %46
17: ; preds = %13
%18 = load i32, i32* %2
%19 = call i32 @isprime(i32 %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %42
22: ; preds = %17
%23 = load i32, i32* %3
%24 = srem i32 %23, 10
%25 = mul nsw i32 %24, 10
%26 = load i32, i32* %3
%27 = sdiv i32 %26, 10
%28 = add nsw i32 %25, %27
store i32 %28, i32* %4
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %33
32: ; preds = %22
br label %43
33: ; preds = %22
%34 = load i32, i32* %4
%35 = call i32 @isprime(i32 %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %37, %33
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41, %17
br label %43
43: ; preds = %42, %32
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %13
46: ; preds = %13
%47 = load i32, i32* @EXIT_SUCCESS
ret i32 %47
}

LLVM IR (-O2):
@.str = [28 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E4\B8\80\E5\80\8B\E7\AF\84\E5\9C\8DA~B\EF\BC\9A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [37 x i8] c"\E5\90\8C\E6\99\82\E6\98\AF\E8\B3\AA\E6\95\B8\E5\92\8C\E5\8F\8D\E8\B3\AA\E6\95\B8\E8\80\85\E7\82\BA\EF\BC\9A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = tail call i32 @fflush(i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp sgt i32 %10, %11
br i1 %12, label %32, label %13
13: ; preds = %0, %28
%14 = phi i32 [ %29, %28 ], [ %10, %0 ]
%15 = call i32 @isprime(i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %28, label %17
17: ; preds = %13
%18 = srem i32 %15, 10
%19 = mul nsw i32 %18, 10
%20 = sdiv i32 %15, 10
%21 = add nsw i32 %19, %20
%22 = icmp eq i32 %15, %21
br i1 %22, label %28, label %23
23: ; preds = %17
%24 = call i32 @isprime(i32 %21)
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %28
28: ; preds = %13, %23, %26, %17
%29 = add nsw i32 %14, 1
%30 = load i32, i32* %2
%31 = icmp slt i32 %14, %30
br i1 %31, label %13, label %32
32: ; preds = %28, %0
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}