#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 m = 0, n = 0;
  int cnt = 1;
  int isPrime = 0;
  int sum = 0;
  scanf("%d%d", &m, &n);
  sum = m == 1 ? 2 : 0;
  for (int i = 3; cnt < n; ++i) {
    isPrime = 1;
    for (int x = 2; x < i; ++x) {
      if (i % x == 0) {
        isPrime = 0;
        break;
      }
    }
    if (isPrime) {
      cnt++;
      if ((cnt >= m) && (cnt <= n)) {
        sum += 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   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edx
xor    %eax,%eax
mov    $0x2,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1221 <main+0x101>
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d5 <main+0xb5>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x20(%rbp)
cmp    $0x0,%edx
jne    11c2 <main+0xa2>
movl   $0x0,-0x14(%rbp)
jmp    11d5 <main+0xb5>
jmp    11c7 <main+0xa7>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119a <main+0x7a>
cmpl   $0x0,-0x14(%rbp)
je     120e <main+0xee>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1209 <main+0xe9>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1209 <main+0xe9>
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    120e <main+0xee>
jmp    1213 <main+0xf3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1180 <main+0x60>
mov    -0x18(%rbp),%esi
lea    0xdd7(%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
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%r8d
xor    %esi,%esi
cmp    $0x1,%r8d
sete   %sil
add    %esi,%esi
mov    0x8(%rsp),%r9d
cmp    $0x2,%r9d
jl     11b6 <main+0x96>
mov    $0x1,%r10d
mov    $0x3,%ecx
mov    $0xffffffff,%edi
xor    %r11d,%r11d
jmp    118b <main+0x6b>
nopl   0x0(%rax)
add    $0x1,%ecx
add    $0xffffffff,%edi
cmp    %r9d,%r10d
jge    11b6 <main+0x96>
mov    $0x2,%ebx
mov    %ecx,%eax
xor    %edx,%edx
div    %ebx
test   %edx,%edx
je     1180 <main+0x60>
add    $0x1,%ebx
lea    (%rdi,%rbx,1),%eax
cmp    $0x2,%eax
jne    1190 <main+0x70>
add    $0x1,%r10d
cmp    %r8d,%r10d
mov    %ecx,%eax
cmovl  %r11d,%eax
add    %eax,%esi
jmp    1180 <main+0x60>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 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 0, i32* %3
store i32 1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 2, i32 0
store i32 %13, i32* %6
store i32 3, i32* %7
br label %14
14: ; preds = %52, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %55
18: ; preds = %14
store i32 1, i32* %5
store i32 2, i32* %8
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %8
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %33
23: ; preds = %19
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = srem i32 %24, %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 0, i32* %5
br label %33
29: ; preds = %23
br label %30
30: ; preds = %29
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %19
33: ; preds = %28, %19
%34 = load i32, i32* %5
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
%39 = load i32, i32* %4
%40 = load i32, i32* %2
%41 = icmp sge i32 %39, %40
br i1 %41, label %42, label %50
42: ; preds = %36
%43 = load i32, i32* %4
%44 = load i32, i32* %3
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* %7
%48 = load i32, i32* %6
%49 = add nsw i32 %48, %47
store i32 %49, i32* %6
br label %50
50: ; preds = %46, %42, %36
br label %51
51: ; preds = %50, %33
br label %52
52: ; preds = %51
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %14
55: ; preds = %14
%56 = load i32, i32* %6
%57 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %56)
ret i32 0
}

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