#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n1, n2, i, flag;
  printf("Enter two numbers(intevals): ");
  scanf("%d %d", &n1, &n2);
  printf("Prime numbers between %d and %d are: ", n1, n2);
  while (n1 < n2) {
    flag = 0;
    for (i = 2; i <= n1 / 2; ++i) {
      if (n1 % i == 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 0)
      printf("%d ", n1);
    ++n1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f5 <main+0xd5>
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11cc <main+0xac>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11b9 <main+0x99>
movl   $0x1,-0x14(%rbp)
jmp    11cc <main+0xac>
jmp    11be <main+0x9e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117f <main+0x5f>
cmpl   $0x0,-0x14(%rbp)
jne    11e7 <main+0xc7>
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x45>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%ecx
cmp    %ecx,%esi
jge    11bd <main+0x9d>
lea    0xedd(%rip),%r14
jmp    118b <main+0x6b>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%ecx
add    $0x1,%esi
mov    %esi,(%rsp)
cmp    %ecx,%esi
jge    11bd <main+0x9d>
cmp    $0x4,%esi
jl     1170 <main+0x50>
mov    %esi,%edi
shr    %edi
neg    %edi
mov    $0x2,%ebx
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
cltd
idiv   %ebx
test   %edx,%edx
je     1181 <main+0x61>
lea    (%rdi,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%edx
add    $0x1,%edx
mov    %edx,%ebx
cmp    $0x1,%eax
jne    11a0 <main+0x80>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter two numbers(intevals): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [38 x i8] c"Prime numbers between %d and %d are: \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
br label %11
11: ; preds = %37, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %11
store i32 0, i32* %5
store i32 2, i32* %4
br label %16
16: ; preds = %28, %15
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = sdiv i32 %18, 2
%20 = icmp sle i32 %17, %19
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = srem i32 %22, %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 1, i32* %5
br label %31
27: ; preds = %21
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %16
31: ; preds = %26, %16
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %31
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %11
40: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Enter two numbers(intevals): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [38 x i8] c"Prime numbers between %d and %d are: \00"
@.str.3 = [4 x i8] c"%d \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 ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %0, %30
%14 = phi i32 [ %31, %30 ], [ %11, %0 ]
%15 = phi i32 [ %33, %30 ], [ %10, %0 ]
%16 = icmp slt i32 %15, 4
br i1 %16, label %26, label %17
17: ; preds = %13
%18 = lshr i32 %15, 1
br label %22
19: ; preds = %22
%20 = add nuw nsw i32 %23, 1
%21 = icmp eq i32 %23, %18
br i1 %21, label %26, label %22
22: ; preds = %17, %19
%23 = phi i32 [ %20, %19 ], [ 2, %17 ]
%24 = srem i32 %15, %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %19
26: ; preds = %19, %13
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%28 = load i32, i32* %1
%29 = load i32, i32* %2
br label %30
30: ; preds = %22, %26
%31 = phi i32 [ %29, %26 ], [ %14, %22 ]
%32 = phi i32 [ %28, %26 ], [ %15, %22 ]
%33 = add nsw i32 %32, 1
store i32 %33, i32* %1
%34 = icmp slt i32 %33, %31
br i1 %34, label %13, label %35
35: ; preds = %30, %0
ret i32 0
}