#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("\nEnter two numbers: ");
  scanf("%d %d", &n1, &n2);
  printf("\nPrime numbers between them: ");
  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    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ef <main+0xcf>
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     11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11b3 <main+0x93>
movl   $0x1,-0x14(%rbp)
jmp    11c6 <main+0xa6>
jmp    11b8 <main+0x98>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x59>
cmpl   $0x0,-0x14(%rbp)
jne    11e1 <main+0xc1>
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <main+0x3f>
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    0xedc(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1040 <scanf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%ecx
cmp    %ecx,%esi
jge    11bd <main+0x9d>
lea    0xed3(%rip),%r14
jmp    118b <main+0x6b>
nopl   0x0(%rax,%rax,1)
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 = [21 x i8] c"\0AEnter two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [30 x i8] c"\0APrime numbers between them: \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 ([21 x i8], [21 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %35, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
store i32 0, i32* %5
store i32 2, i32* %4
br label %14
14: ; preds = %26, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 2
%18 = icmp sle i32 %15, %17
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i32, i32* %2
%21 = load i32, i32* %4
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 1, i32* %5
br label %29
25: ; preds = %19
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %14
29: ; preds = %24, %14
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %29
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %9
38: ; preds = %9
ret i32 0
}

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