#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
scalar_t__ ispalin(int);
scalar_t__ isprime(int);
int main() {
  int floor, top;
  FILE *fin, *fout;
  int i;
  fin = fopen("pprime.in", "r");
  fout = fopen("pprime.out", "w");
  assert(fin && fout);
  fscanf(fin, "%d %d", &floor, &top);
  for (i = floor; i <= top; ++i) {
    if (ispalin(i) && isprime(i)) {
      fprintf(fout, "%d\n", i);
    }
  }
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe6f(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x25(%rbp)
je     11c8 <main+0x58>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <fscanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1249 <main+0xd9>
mov    -0x24(%rbp),%edi
call   1090 <ispalin@plt>
cmp    $0x0,%rax
je     1236 <main+0xc6>
mov    -0x24(%rbp),%edi
call   1070 <isprime@plt>
cmp    $0x0,%rax
je     1236 <main+0xc6>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xdee(%rip),%rsi
call   1060 <fprintf@plt>
jmp    123b <main+0xcb>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f3 <main+0x83>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe81(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xe77(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
test   %r14,%r14
setne  %al
test   %r15,%r15
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
lea    0xe58(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %r14,%rdi
call   1040 <fscanf@plt>
mov    0x4(%rsp),%ebx
cmp    (%rsp),%ebx
jle    11f8 <main+0x88>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe20(%rip),%r12
jmp    121a <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
jge    11da <main+0x6a>
mov    %ebx,%edi
call   1090 <ispalin@plt>
test   %rax,%rax
je     1210 <main+0xa0>
mov    %ebx,%edi
call   1070 <isprime@plt>
test   %rax,%rax
je     1210 <main+0xa0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1060 <fprintf@plt>
jmp    1210 <main+0xa0>

LLVM IR (-O0):
@.str = [10 x i8] c"pprime.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"pprime.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
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* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %4
%8 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %8, i32** %5
%9 = load i32*, i32** %4
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32*, i32** %5
%13 = icmp ne i32* %12, null
br label %14
14: ; preds = %11, %0
%15 = phi i1 [ false, %0 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32*, i32** %4
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %2, i32* %3)
%20 = load i32, i32* %2
store i32 %20, i32* %6
br label %21
21: ; preds = %38, %14
%22 = load i32, i32* %6
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %41
25: ; preds = %21
%26 = load i32, i32* %6
%27 = call i64 @ispalin(i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %25
%30 = load i32, i32* %6
%31 = call i64 @isprime(i32 %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32*, i32** %5
%35 = load i32, i32* %6
%36 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %29, %25
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %21
41: ; preds = %21
%42 = load i32*, i32** %4
%43 = call i32 @fclose(i32* %42)
%44 = load i32*, i32** %5
%45 = call i32 @fclose(i32* %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"pprime.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"pprime.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [4 x i8] c"%d\0A\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* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp ne i32* %5, null
%8 = icmp ne i32* %6, null
%9 = and i1 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %1, i32* %2)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = icmp sgt i32 %13, %14
br i1 %15, label %29, label %16
16: ; preds = %0, %25
%17 = phi i32 [ %26, %25 ], [ %13, %0 ]
%18 = call i64 @ispalin(i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %16
%21 = call i64 @isprime(i32 %17)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %17)
br label %25
25: ; preds = %16, %20, %23
%26 = add nsw i32 %17, 1
%27 = load i32, i32* %2
%28 = icmp slt i32 %17, %27
br i1 %28, label %16, label %29
29: ; preds = %25, %0
%30 = call i32 @fclose(i32* %5)
%31 = call i32 @fclose(i32* %6)
ret i32 0
}