#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*/ free(char *);
char *nfactor_sieve(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int n, i, found;
  char *sieve = nfactor_sieve(200000);
  for (n = 646; n < 200000 - 4; n++) {
    found = 1;
    for (i = 0; i < 4; i++) {
      if (sieve[n + i] != 4) {
        found = 0;
        break;
      }
    }
    if (found) {
      printf("%d\n", n);
      break;
    }
  }
  free(sieve);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x30d40,%edi
call   1050 <nfactor_sieve@plt>
mov    %rax,-0x28(%rbp)
movl   $0x286,-0x14(%rbp)
cmpl   $0x30d3c,-0x14(%rbp)
jge    11ea <main+0xba>
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11b9 <main+0x89>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4,%eax
je     11a6 <main+0x76>
movl   $0x0,-0x1c(%rbp)
jmp    11b9 <main+0x89>
jmp    11ab <main+0x7b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1176 <main+0x46>
cmpl   $0x0,-0x1c(%rbp)
je     11d7 <main+0xa7>
mov    -0x14(%rbp),%esi
lea    0xe33(%rip),%rdi
call   1040 <printf@plt>
jmp    11ea <main+0xba>
jmp    11dc <main+0xac>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x2b>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x30d40,%edi
call   1050 <nfactor_sieve@plt>
mov    %rax,%rbx
mov    $0x289,%esi
jmp    115d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rsi
cmp    $0x30d3f,%rsi
je     1187 <main+0x57>
cmpb   $0x4,-0x3(%rbx,%rsi,1)
jne    1150 <main+0x20>
cmpb   $0x4,-0x2(%rbx,%rsi,1)
jne    1150 <main+0x20>
cmpb   $0x4,-0x1(%rbx,%rsi,1)
jne    1150 <main+0x20>
cmpb   $0x4,(%rbx,%rsi,1)
jne    1150 <main+0x20>
add    $0xfffffffd,%esi
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [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 i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i8* @nfactor_sieve(i32 200000)
store i8* %10, i8** %9
store i32 646, i32* %6
br label %11
11: ; preds = %40, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 199996
br i1 %13, label %14, label %43
14: ; preds = %11
store i32 1, i32* %8
store i32 0, i32* %7
br label %15
15: ; preds = %30, %14
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %33
18: ; preds = %15
%19 = load i8*, i8** %9
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %19, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 4
br i1 %27, label %28, label %29
28: ; preds = %18
store i32 0, i32* %8
br label %33
29: ; preds = %18
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %15
33: ; preds = %28, %15
%34 = load i32, i32* %8
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* %6
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
br label %43
39: ; preds = %33
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %11
43: ; preds = %36, %11
%44 = load i8*, i8** %9
%45 = call i32 @free(i8* %44)
ret i32 0
}

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