int is_prime(int w) {
  int prime55[] = {2,   3,   5,   7,   11,  13,  17,  19,  23,  29,  31,
                   37,  41,  43,  47,  53,  59,  61,  67,  71,  73,  79,
                   83,  89,  97,  101, 103, 107, 109, 113, 127, 131, 137,
                   139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193,
                   197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257};
  int i;
  for (i = 0; i < 55; i++) {
    if (w % prime55[i] == 0) {
      if (w == prime55[i])
        return 1;
      else {
        return 0;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x8(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0xdc,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0xf4(%rbp)
cmpl   $0x37,-0xf4(%rbp)
jge    11b0 <is_prime+0xa0>
mov    -0x8(%rbp),%eax
movslq -0xf4(%rbp),%rcx
cltd
idivl  -0xf0(%rbp,%rcx,4)
cmp    $0x0,%edx
jne    1197 <is_prime+0x87>
mov    -0x8(%rbp),%eax
movslq -0xf4(%rbp),%rcx
cmp    -0xf0(%rbp,%rcx,4),%eax
jne    118b <is_prime+0x7b>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <is_prime+0xa7>
movl   $0x0,-0x4(%rbp)
jmp    11b7 <is_prime+0xa7>
jmp    119c <is_prime+0x8c>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    1140 <is_prime+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0x1,%ecx
lea    0xef4(%rip),%r8
nopl   0x0(%rax)
mov    -0x4(%r8,%rcx,4),%esi
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1137 <is_prime+0x37>
cmp    $0x37,%rcx
je     113f <is_prime+0x3f>
mov    (%r8,%rcx,4),%esi
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1137 <is_prime+0x37>
add    $0x2,%rcx
jmp    1110 <is_prime+0x10>
xor    %eax,%eax
cmp    %edi,%esi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@__const.is_prime.prime55 = [55 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179, i32 181, i32 191, i32 193, i32 197, i32 199, i32 211, i32 223, i32 227, i32 229, i32 233, i32 239, i32 241, i32 251, i32 257]
define i32 @is_prime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [55 x i32]
%5 = alloca i32
store i32 %0, i32* %3
%6 = bitcast [55 x i32]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 55
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [55 x i32], [55 x i32]* %4, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = srem i32 %11, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %10
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [55 x i32], [55 x i32]* %4, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %19, %23
br i1 %24, label %25, label %26
25: ; preds = %18
store i32 1, i32* %2
br label %32
26: ; preds = %18
store i32 0, i32* %2
br label %32
27: ; preds = %10
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %7
31: ; preds = %7
store i32 0, i32* %2
br label %32
32: ; preds = %31, %26, %25
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@__const.is_prime.prime55 = [55 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179, i32 181, i32 191, i32 193, i32 197, i32 199, i32 211, i32 223, i32 227, i32 229, i32 233, i32 239, i32 241, i32 251, i32 257]
define i32 @is_prime(i32 %0) {
br label %12
2: ; preds = %12
%3 = or i64 %13, 1
%4 = icmp eq i64 %3, 55
br i1 %4, label %22, label %5
5: ; preds = %2
%6 = getelementptr inbounds [55 x i32], [55 x i32]* @__const.is_prime.prime55, i64 0, i64 %3
%7 = load i32, i32* %6
%8 = srem i32 %0, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %5
%11 = add nuw nsw i64 %13, 2
br label %12
12: ; preds = %10, %1
%13 = phi i64 [ 0, %1 ], [ %11, %10 ]
%14 = getelementptr inbounds [55 x i32], [55 x i32]* @__const.is_prime.prime55, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = srem i32 %0, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %2
18: ; preds = %5, %12
%19 = phi i32 [ %15, %12 ], [ %7, %5 ]
%20 = icmp eq i32 %19, %0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %2, %18
%23 = phi i32 [ %21, %18 ], [ 0, %2 ]
ret i32 %23
}