#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);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int count = 0;
  int i = 2;
  int m, n;
  int sum = 0;
  scanf("%d %d", &n, &m);
  while (count < m) {
    int flag = 1;
    for (int j = 2; j < i; j++) {
      if (i % j == 0) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) {
      count++;
      if (count >= n && count <= m) {
        sum += i;
      }
    }
    i++;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f4 <main+0xd4>
movl   $0x1,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ad <main+0x8d>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x20(%rbp)
cmp    $0x0,%edx
jne    119a <main+0x7a>
movl   $0x0,-0x1c(%rbp)
jmp    11ad <main+0x8d>
jmp    119f <main+0x7f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1172 <main+0x52>
cmpl   $0x1,-0x1c(%rbp)
jne    11e6 <main+0xc6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11e1 <main+0xc1>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11e1 <main+0xc1>
mov    -0xc(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11e6 <main+0xc6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x38>
mov    -0x18(%rbp),%esi
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%r10d
test   %r10d,%r10d
jle    11a7 <main+0x87>
mov    $0x2,%ecx
xor    %r8d,%r8d
mov    0x8(%rsp),%r9d
xor    %edi,%edi
xor    %esi,%esi
xor    %r11d,%r11d
jmp    117a <main+0x5a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r11d
cmp    %r9d,%r11d
mov    %ecx,%eax
cmovl  %r8d,%eax
add    %eax,%esi
add    $0x1,%ecx
add    $0xffffffff,%edi
cmp    %r10d,%r11d
jge    11a9 <main+0x89>
cmp    $0x3,%ecx
jb     1160 <main+0x40>
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
xor    %edx,%edx
div    %ebx
test   %edx,%edx
je     116f <main+0x4f>
add    $0x1,%ebx
lea    (%rdi,%rbx,1),%eax
cmp    $0x2,%eax
jne    1190 <main+0x70>
jmp    1160 <main+0x40>
xor    %esi,%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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