#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 longestConsecutive(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int n[] = {100, 4, 200, 1, 3, 2};
  if (!(longestConsecutive(n, 0) == 0)) {
    printf("assert fail: %s\n", "boundary test0");
    return -1;
  };
  if (!(longestConsecutive(n, 1) == 1)) {
    printf("assert fail: %s\n", "boundary test1");
    return -1;
  };
  if (!(longestConsecutive(n, 6) == 4)) {
    printf("assert fail: %s\n", "test");
    return -1;
  };
  printf("everything is fine!\n");
  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    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1040 <longestConsecutive@plt>
cmp    $0x0,%eax
je     118c <main+0x6c>
lea    0xea6(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1211 <main+0xf1>
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
call   1040 <longestConsecutive@plt>
cmp    $0x1,%eax
je     11c4 <main+0xa4>
lea    0xe6e(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1211 <main+0xf1>
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1040 <longestConsecutive@plt>
cmp    $0x4,%eax
je     11fc <main+0xdc>
lea    0xe36(%rip),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1211 <main+0xf1>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xed5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <longestConsecutive@plt>
test   %eax,%eax
je     1169 <main+0x39>
lea    0xeb8(%rip),%rdi
lea    0xec2(%rip),%rsi
jmp    11be <main+0x8e>
mov    %rsp,%rdi
mov    $0x1,%esi
call   1050 <longestConsecutive@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x70>
mov    %rsp,%rdi
mov    $0x6,%esi
call   1050 <longestConsecutive@plt>
cmp    $0x4,%eax
jne    11b0 <main+0x80>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe71(%rip),%rdi
lea    0xe8a(%rip),%rsi
jmp    11be <main+0x8e>
lea    0xe61(%rip),%rdi
lea    0xe89(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.n = [6 x i32] [i32 100, i32 4, i32 200, i32 1, i32 3, i32 2]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [15 x i8] c"boundary test0\00"
@.str.2 = [15 x i8] c"boundary test1\00"
@.str.3 = [5 x i8] c"test\00"
@.str.4 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [6 x i32]* %6 to i8*
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%9 = call i32 @longestConsecutive(i32* %8, i32 0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %27
13: ; preds = %2
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%15 = call i32 @longestConsecutive(i32* %14, i32 1)
%16 = icmp eq i32 %15, 1
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %27
19: ; preds = %13
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%21 = call i32 @longestConsecutive(i32* %20, i32 6)
%22 = icmp eq i32 %21, 4
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %27
27: ; preds = %25, %23, %17, %11
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@__const.main.n = [6 x i32] [i32 100, i32 4, i32 200, i32 1, i32 3, i32 2]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [15 x i8] c"boundary test0\00"
@.str.2 = [15 x i8] c"boundary test1\00"
@.str.3 = [5 x i8] c"test\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%6 = call i32 @longestConsecutive(i32* %5, i32 0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %22
10: ; preds = %2
%11 = call i32 @longestConsecutive(i32* %5, i32 1)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %22
15: ; preds = %10
%16 = call i32 @longestConsecutive(i32* %5, i32 6)
%17 = icmp eq i32 %16, 4
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %22
20: ; preds = %15
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %13, %8
%23 = phi i32 [ 0, %20 ], [ -1, %18 ], [ -1, %13 ], [ -1, %8 ]
ret i32 %23
}