#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__ isPrime(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int count = 0;
  int i, j;
  int d[3];
  int dptr;
  printf("Strange numbers in the open interval (100, 500) are:\n");
  for (i = 101; i < 500; i++) {
    dptr = 0;
    j = i;
    while (j > 0) {
      d[dptr++] = j % 10;
      j /= 10;
    }
    if (isPrime(d[0] - d[1]) && isPrime(d[1] - d[2])) {
      printf("%d ", i);
      count++;
      if (count % 10 == 0) {
        printf("\n");
      }
    }
  }
  if (count % 10 != 0) {
    printf("\n");
  }
  printf("\n%d strange numbers in all.\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x65,-0xc(%rbp)
cmpl   $0x1f4,-0xc(%rbp)
jge    121c <main+0xfc>
movl   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    119e <main+0x7e>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
cltq
mov    %edx,-0x1c(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1165 <main+0x45>
mov    -0x1c(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1209 <main+0xe9>
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1209 <main+0xe9>
mov    -0xc(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1204 <main+0xe4>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
jmp    120e <main+0xee>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114b <main+0x2b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     123e <main+0x11e>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
mov    $0x65,%r13d
lea    0xc(%rsp),%r12
mov    $0xcccccccd,%ebp
lea    0xe8f(%rip),%r14
xor    %r15d,%r15d
jmp    1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r13d
cmp    $0x1f4,%r13d
je     121e <main+0xde>
mov    %r12,%rax
mov    %r13d,%ecx
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
imul   %rbp,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %ecx,%edi
sub    %esi,%edi
mov    %edi,(%rax)
add    $0x4,%rax
cmp    $0x9,%ecx
mov    %edx,%ecx
ja     11a0 <main+0x60>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%ebx
sub    %ebx,%edi
call   1060 <isPrime@plt>
test   %rax,%rax
je     1180 <main+0x40>
sub    0x14(%rsp),%ebx
mov    %ebx,%edi
call   1060 <isPrime@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
imul   $0xcccccccd,%r15d,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
ja     1180 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x40>
imul   $0xcccccccd,%r15d,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999999,%eax
jb     123d <main+0xfd>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc0(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Strange numbers in the open interval (100, 500) are:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [29 x i8] c"\0A%d strange numbers in all.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x i32]
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store i32 101, i32* %3
br label %8
8: ; preds = %53, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 500
br i1 %10, label %11, label %56
11: ; preds = %8
store i32 0, i32* %6
%12 = load i32, i32* %3
store i32 %12, i32* %4
br label %13
13: ; preds = %16, %11
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* %4
%18 = srem i32 %17, 10
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %21
store i32 %18, i32* %22
%23 = load i32, i32* %4
%24 = sdiv i32 %23, 10
store i32 %24, i32* %4
br label %13
25: ; preds = %13
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%27 = load i32, i32* %26
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
%29 = load i32, i32* %28
%30 = sub nsw i32 %27, %29
%31 = call i64 @isPrime(i32 %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %52
33: ; preds = %25
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
%37 = load i32, i32* %36
%38 = sub nsw i32 %35, %37
%39 = call i64 @isPrime(i32 %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %52
41: ; preds = %33
%42 = load i32, i32* %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
%46 = load i32, i32* %2
%47 = srem i32 %46, 10
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %41
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %41
br label %52
52: ; preds = %51, %33, %25
br label %53
53: ; preds = %52
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %8
56: ; preds = %8
%57 = load i32, i32* %2
%58 = srem i32 %57, 10
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %56
%63 = load i32, i32* %2
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %63)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [29 x i8] c"\0A%d strange numbers in all.\0A\00"
@str = [53 x i8] c"Strange numbers in the open interval (100, 500) are:\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
br label %7
7: ; preds = %0, %36
%8 = phi i32 [ 101, %0 ], [ %38, %36 ]
%9 = phi i32 [ 0, %0 ], [ %37, %36 ]
br label %10
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %14, %10 ]
%12 = phi i32 [ %8, %7 ], [ %16, %10 ]
%13 = urem i32 %12, 10
%14 = add nuw i64 %11, 1
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %11
store i32 %13, i32* %15
%16 = udiv i32 %12, 10
%17 = icmp ult i32 %12, 10
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = sub nsw i32 %19, %20
%22 = tail call i64 @isPrime(i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %36, label %24
24: ; preds = %18
%25 = load i32, i32* %6
%26 = sub nsw i32 %20, %25
%27 = tail call i64 @isPrime(i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %36, label %29
29: ; preds = %24
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%31 = add nsw i32 %9, 1
%32 = srem i32 %31, 10
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = tail call i32 @putchar(i32 10)
br label %36
36: ; preds = %18, %24, %34, %29
%37 = phi i32 [ %31, %34 ], [ %31, %29 ], [ %9, %24 ], [ %9, %18 ]
%38 = add nuw nsw i32 %8, 1
%39 = icmp eq i32 %38, 500
br i1 %39, label %40, label %7
40: ; preds = %36
%41 = srem i32 %37, 10
%42 = icmp eq i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = tail call i32 @putchar(i32 10)
br label %45
45: ; preds = %43, %40
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %37)
ret i32 0
}