#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 */
scalar_t__ is_prime(int);
scalar_t__ is_trunc_prime(char *, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, int);
int sprintf(char *, char *, int);
int main(int argc, char *argv[]) {
  int sum = 0;
  int count = 0;
  int i = 11;
  while (count < 11) {
    if (is_prime(i)) {
      char prime_str[64];
      memset(prime_str, '\0', 64);
      int len = sprintf(prime_str, "%i", i);
      if (is_trunc_prime(prime_str, len)) {
        sum += i;
        count++;
      }
    }
    i += 2;
  }
  printf("%i", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xb,-0x1c(%rbp)
cmpl   $0xb,-0x18(%rbp)
jge    11f8 <main+0xa8>
mov    -0x1c(%rbp),%edi
call   1050 <is_prime@plt>
cmp    $0x0,%rax
je     11ea <main+0x9a>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    -0x60(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe4b(%rip),%rsi
call   1070 <sprintf@plt>
mov    %eax,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1060 <is_trunc_prime@plt>
cmp    $0x0,%rax
je     11e5 <main+0x95>
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ea <main+0x9a>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <main+0x2b>
mov    -0x14(%rbp),%esi
lea    0xdfe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    $0xb,%ebx
xor    %r12d,%r12d
mov    %rsp,%r14
lea    0xe90(%rip),%r15
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1188 <main+0x38>
nopw   0x0(%rax,%rax,1)
add    $0x2,%ebx
cmp    $0xb,%ebp
jge    11cf <main+0x7f>
mov    %ebx,%edi
call   1050 <is_prime@plt>
test   %rax,%rax
je     1180 <main+0x30>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <is_trunc_prime@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ebx,%eax
cmove  %r12d,%eax
add    %ecx,%ebp
add    %eax,%r13d
jmp    1180 <main+0x30>
lea    0xe2a(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\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 [64 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 11, i32* %8
br label %11
11: ; preds = %35, %2
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 11
br i1 %13, label %14, label %38
14: ; preds = %11
%15 = load i32, i32* %8
%16 = call i64 @is_prime(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %35
18: ; preds = %14
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%20 = call i32 @memset(i8* %19, i8 signext 0, i32 64)
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%22 = load i32, i32* %8
%23 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22)
store i32 %23, i32* %10
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%25 = load i32, i32* %10
%26 = call i64 @is_trunc_prime(i8* %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %18
%29 = load i32, i32* %8
%30 = load i32, i32* %6
%31 = add nsw i32 %30, %29
store i32 %31, i32* %6
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %34
34: ; preds = %28, %18
br label %35
35: ; preds = %34, %14
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 2
store i32 %37, i32* %8
br label %11
38: ; preds = %11
%39 = load i32, i32* %6
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %21
%6 = phi i32 [ 0, %2 ], [ %23, %21 ]
%7 = phi i32 [ 11, %2 ], [ %24, %21 ]
%8 = phi i32 [ 0, %2 ], [ %22, %21 ]
%9 = call i64 @is_prime(i32 %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %5
%12 = call i32 @memset(i8* %4, i8 signext 0, i32 64)
%13 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%14 = call i64 @is_trunc_prime(i8* %4, i32 %13)
%15 = icmp eq i64 %14, 0
%16 = xor i1 %15, true
%17 = zext i1 %16 to i32
%18 = add nsw i32 %8, %17
%19 = select i1 %15, i32 0, i32 %7
%20 = add nsw i32 %19, %6
br label %21
21: ; preds = %11, %5
%22 = phi i32 [ %18, %11 ], [ %8, %5 ]
%23 = phi i32 [ %20, %11 ], [ %6, %5 ]
%24 = add nuw nsw i32 %7, 2
%25 = icmp slt i32 %22, 11
br i1 %25, label %5, label %26
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}