#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*/ prime(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, const char *argv[]) {
  int i, m, n, sum = 0;
  scanf("%d%d", &m, &n);
  int p[n];
  prime(p, n);
  for (i = 1; p[i] != 0; i++) {
    if (p[i] >= m) {
      sum += p[i];
    }
  }
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%esi
call   1050 <prime@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11e1 <main+0xb1>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jl     11ce <main+0x9e>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11d3 <main+0xa3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <main+0x67>
mov    -0x20(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeba(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rsp,%r14
mov    -0x24(%rbp),%eax
mov    %rsp,%r15
lea    0xf(,%rax,4),%r12
and    $0xfffffffffffffff0,%r12
mov    %r15,%rbx
sub    %r12,%rbx
mov    %rbx,%rsp
mov    -0x24(%rbp),%esi
mov    %rbx,%rdi
call   1050 <prime@plt>
neg    %r12
mov    0x4(%r15,%r12,1),%eax
test   %eax,%eax
je     11b3 <main+0x83>
mov    -0x28(%rbp),%ecx
add    $0x8,%rbx
xor    %edx,%edx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %ecx,%eax
cmovl  %edx,%eax
add    %eax,%esi
mov    (%rbx),%eax
add    $0x4,%rbx
test   %eax,%eax
jne    11a0 <main+0x70>
jmp    11b5 <main+0x85>
xor    %esi,%esi
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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