#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*/ is_prime(unsigned int);
int /*<<< orphan*/ printf(char *, int);
void find_n(unsigned int z) {
  while (z < 1000000 - 2) {
    if ((!is_prime(z)) && (!is_prime(z + 2))) {
      printf("%d\n", z);
      return;
    }
    z++;
  }
  printf("z not found below %d\n", 1000000);
}


x86 assembly (clang, -O0):
<find_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xf423e,-0x4(%rbp)
jae    117f <find_n+0x5f>
mov    -0x4(%rbp),%edi
call   1040 <is_prime@plt>
cmp    $0x0,%eax
jne    1171 <find_n+0x51>
mov    -0x4(%rbp),%edi
add    $0x2,%edi
call   1040 <is_prime@plt>
cmp    $0x0,%eax
jne    1171 <find_n+0x51>
mov    -0x4(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <find_n+0x70>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <find_n+0xb>
lea    0xe7a(%rip),%rdi
mov    $0xf4240,%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_n>:
push   %rbx
cmp    $0xf423d,%edi
ja     1161 <find_n+0x41>
mov    %edi,%ebx
jmp    113b <find_n+0x1b>
nopl   (%rax)
add    $0x1,%ebx
cmp    $0xf423e,%ebx
je     1161 <find_n+0x41>
mov    %ebx,%edi
call   1040 <is_prime@plt>
test   %eax,%eax
jne    1130 <find_n+0x10>
lea    0x2(%rbx),%edi
call   1040 <is_prime@plt>
test   %eax,%eax
jne    1130 <find_n+0x10>
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0xf4240,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [22 x i8] c"z not found below %d\0A\00"
define void @find_n(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %18, %1
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, 999998
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @is_prime(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add i32 %11, 2
%13 = call i32 @is_prime(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %23
18: ; preds = %10, %6
%19 = load i32, i32* %2
%20 = add i32 %19, 1
store i32 %20, i32* %2
br label %3
21: ; preds = %3
%22 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 1000000)
br label %23
23: ; preds = %21, %15
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [22 x i8] c"z not found below %d\0A\00"
define void @find_n(i32 %0) {
%2 = icmp ult i32 %0, 999998
br i1 %2, label %3, label %16
3: ; preds = %1, %13
%4 = phi i32 [ %14, %13 ], [ %0, %1 ]
%5 = tail call i32 @is_prime(i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = add nuw nsw i32 %4, 2
%9 = tail call i32 @is_prime(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %18
13: ; preds = %7, %3
%14 = add i32 %4, 1
%15 = icmp eq i32 %14, 999998
br i1 %15, label %16, label %3
16: ; preds = %13, %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 1000000)
br label %18
18: ; preds = %16, %11
ret void
}