#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 find(int *, int);
int find_brute(int *, int);
int test_missing() {
  int array_odd[] = {6, 0, 9, 5, 4, 1, 7, 8, 2};
  int array_even[] = {6, 0, 5, 4, 1, 7, 8, 2};
  return 3 == find_brute(array_odd, 9) && 3 == find(array_odd, 9) &&
         3 == find_brute(array_even, 8) && 3 == find(array_even, 8);
}


x86 assembly (clang, -O0):
<test_missing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
mov    0xedc(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1030 <find_brute@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3,%ecx
cmp    %edx,%ecx
mov    %al,-0x51(%rbp)
jne    11fc <test_missing+0xcc>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <find@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3,%ecx
cmp    %edx,%ecx
mov    %al,-0x51(%rbp)
jne    11fc <test_missing+0xcc>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1030 <find_brute@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3,%ecx
cmp    %edx,%ecx
mov    %al,-0x51(%rbp)
jne    11fc <test_missing+0xcc>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1050 <find@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_missing>:
push   %rbx
sub    $0x50,%rsp
mov    0xef5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1030 <find_brute@plt>
xor    %ebx,%ebx
cmp    $0x3,%eax
jne    11af <test_missing+0x8f>
mov    %rsp,%rdi
mov    $0x9,%esi
call   1040 <find@plt>
cmp    $0x3,%eax
jne    11af <test_missing+0x8f>
lea    0x30(%rsp),%rdi
mov    $0x8,%esi
call   1030 <find_brute@plt>
cmp    $0x3,%eax
jne    11af <test_missing+0x8f>
lea    0x30(%rsp),%rdi
mov    $0x8,%esi
call   1040 <find@plt>
xor    %ebx,%ebx
cmp    $0x3,%eax
sete   %bl
mov    %ebx,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_missing.array_odd = [9 x i32] [i32 6, i32 0, i32 9, i32 5, i32 4, i32 1, i32 7, i32 8, i32 2]
@__const.test_missing.array_even = [8 x i32] [i32 6, i32 0, i32 5, i32 4, i32 1, i32 7, i32 8, i32 2]
define i32 @test_missing() {
%1 = alloca [9 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [9 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%6 = call i32 @find_brute(i32* %5, i32 9)
%7 = icmp eq i32 3, %6
br i1 %7, label %8, label %20
8: ; preds = %0
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%10 = call i32 @find(i32* %9, i32 9)
%11 = icmp eq i32 3, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%14 = call i32 @find_brute(i32* %13, i32 8)
%15 = icmp eq i32 3, %14
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%18 = call i32 @find(i32* %17, i32 8)
%19 = icmp eq i32 3, %18
br label %20
20: ; preds = %16, %12, %8, %0
%21 = phi i1 [ false, %12 ], [ false, %8 ], [ false, %0 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
@__const.test_missing.array_odd = [9 x i32] [i32 6, i32 0, i32 9, i32 5, i32 4, i32 1, i32 7, i32 8, i32 2]
@__const.test_missing.array_even = [8 x i32] [i32 6, i32 0, i32 5, i32 4, i32 1, i32 7, i32 8, i32 2]
define i32 @test_missing() {
%1 = alloca [9 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [9 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%6 = call i32 @find_brute(i32* %5, i32 9)
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %19
8: ; preds = %0
%9 = call i32 @find(i32* %5, i32 9)
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%13 = call i32 @find_brute(i32* %12, i32 8)
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i32 @find(i32* %12, i32 8)
%17 = icmp eq i32 %16, 3
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %11, %8, %0
%20 = phi i32 [ 0, %11 ], [ 0, %8 ], [ 0, %0 ], [ %18, %15 ]
ret i32 %20
}