#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 */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int cases, ccounter = 0, beg, end;
  scanf("%d", &cases);
  while (ccounter != cases) {
    scanf("%d %d", &beg, &end);
    for (int i = beg; i <= end; i++) {
      if (isPrime(i) && i != 1)
        printf("%d\n", i);
    }
    printf("\n");
    ccounter++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11e8 <main+0xb8>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11cc <main+0x9c>
mov    -0x18(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     11b9 <main+0x89>
cmpl   $0x1,-0x18(%rbp)
je     11b9 <main+0x89>
mov    -0x18(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11be <main+0x8e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1180 <main+0x50>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeae(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
je     11fc <main+0xbc>
lea    0x14(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xe89(%rip),%r13
xor    %ebx,%ebx
jmp    11a3 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x10(%rsp),%ebx
je     11fc <main+0xbc>
lea    0xe56(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x14(%rsp),%ebp
cmp    0xc(%rsp),%ebp
jg     1190 <main+0x50>
add    $0xffffffff,%ebp
jmp    11d6 <main+0x96>
cs nopw 0x0(%rax,%rax,1)
cmp    0xc(%rsp),%ebp
jge    1190 <main+0x50>
mov    %ebp,%r14d
lea    0x1(%r14),%ebp
mov    %ebp,%edi
call   1050 <isPrime@plt>
test   %rax,%rax
je     11d0 <main+0x90>
test   %r14d,%r14d
je     11d0 <main+0x90>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d0 <main+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [2 x i8] c"\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
store i32 0, i32* %3
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %33, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %37
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%14 = load i32, i32* %4
store i32 %14, i32* %6
br label %15
15: ; preds = %30, %12
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i32, i32* %6
%21 = call i64 @isPrime(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %23, %19
br label %30
30: ; preds = %29
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %15
33: ; preds = %15
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %8
37: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %33, label %10
10: ; preds = %0, %16
%11 = phi i32 [ %18, %16 ], [ 0, %0 ]
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %29, %10
%17 = call i32 @putchar(i32 10)
%18 = add nuw nsw i32 %11, 1
%19 = load i32, i32* %1
%20 = icmp eq i32 %18, %19
br i1 %20, label %33, label %10
21: ; preds = %10, %29
%22 = phi i32 [ %30, %29 ], [ %13, %10 ]
%23 = call i64 @isPrime(i32 %22)
%24 = icmp ne i64 %23, 0
%25 = icmp ne i32 %22, 1
%26 = and i1 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %29
29: ; preds = %21, %27
%30 = add nsw i32 %22, 1
%31 = load i32, i32* %3
%32 = icmp slt i32 %22, %31
br i1 %32, label %21, label %16
33: ; preds = %16, %0
ret i32 0
}