#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 */
typedef int /*<<< orphan*/ array2;
typedef int /*<<< orphan*/ array1;
typedef int /*<<< orphan*/ array0;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memcmp(int *, int *, int);
int *plusOne(int *, int, int *);
int main() {
  int array0[] = {9, 9, 9, 9, 9};
  int len0 = sizeof(array0) / sizeof(int);
  int act_len0;
  int *act_array0 = plusOne(array0, len0, &act_len0);
  int exp_len0 = len0 + 1;
  int exp_array0[] = {1, 0, 0, 0, 0, 0};
  assert(!memcmp(exp_array0, act_array0,
                 exp_len0 * sizeof(int) && (act_len0 == exp_len0)));
  int array1[] = {9, 9, 8, 9, 9};
  int len1 = sizeof(array1) / sizeof(int);
  int act_len1;
  int *act_array1 = plusOne(array1, len1, &act_len1);
  int exp_len1 = len1;
  int exp_array1[] = {9, 9, 9, 0, 0};
  assert(!memcmp(exp_array1, act_array1,
                 exp_len1 * sizeof(int) && (act_len1 == exp_len1)));
  int array2[] = {2, 2, 8, 9, 8};
  int len2 = sizeof(array2) / sizeof(int);
  int act_len2;
  int *act_array2 = plusOne(array2, len2, &act_len2);
  int exp_len2 = len2;
  int exp_array2[] = {2, 2, 8, 9, 9};
  assert(!memcmp(exp_array2, act_array2,
                 exp_len2 * sizeof(int) && (act_len2 == exp_len2)));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1030 <plusOne@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe91(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x100(%rbp)
movslq -0x34(%rbp),%rcx
shl    $0x2,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xf1(%rbp)
je     11e5 <main+0xb5>
mov    -0x28(%rbp),%eax
cmp    -0x34(%rbp),%eax
sete   %al
mov    %al,-0xf1(%rbp)
mov    -0x100(%rbp),%rsi
mov    -0x108(%rbp),%rdi
mov    -0xf1(%rbp),%al
and    $0x1,%al
movzbl %al,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0xe24(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe21(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe1f(%rip),%eax
mov    %eax,-0x60(%rbp)
movl   $0x5,-0x74(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
lea    -0x78(%rbp),%rdx
call   1030 <plusOne@plt>
mov    %rax,-0x80(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    0xe01(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xdfb(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xdf6(%rip),%eax
mov    %eax,-0x90(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x118(%rbp)
movslq -0x84(%rbp),%rcx
shl    $0x2,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x109(%rbp)
je     12c8 <main+0x198>
mov    -0x78(%rbp),%eax
cmp    -0x84(%rbp),%eax
sete   %al
mov    %al,-0x109(%rbp)
mov    -0x118(%rbp),%rsi
mov    -0x120(%rbp),%rdi
mov    -0x109(%rbp),%al
and    $0x1,%al
movzbl %al,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0xd81(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xd7b(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0xd76(%rip),%eax
mov    %eax,-0xb0(%rbp)
movl   $0x5,-0xc4(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0xc4(%rbp),%esi
lea    -0xc8(%rbp),%rdx
call   1030 <plusOne@plt>
mov    %rax,-0xd0(%rbp)
mov    -0xc4(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    0xd43(%rip),%rax
mov    %rax,-0xf0(%rbp)
mov    0xd3d(%rip),%rax
mov    %rax,-0xe8(%rbp)
mov    0xd38(%rip),%eax
mov    %eax,-0xe0(%rbp)
lea    -0xf0(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0xd0(%rbp),%rax
mov    %rax,-0x130(%rbp)
movslq -0xd4(%rbp),%rcx
shl    $0x2,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x121(%rbp)
je     13cc <main+0x29c>
mov    -0xc8(%rbp),%eax
cmp    -0xd4(%rbp),%eax
sete   %al
mov    %al,-0x121(%rbp)
mov    -0x130(%rbp),%rsi
mov    -0x138(%rbp),%rdi
mov    -0x121(%rbp),%al
and    $0x1,%al
movzbl %al,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
mov    0xed3(%rip),%eax
mov    %eax,0xa0(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
lea    0x90(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x5,%esi
call   1030 <plusOne@plt>
mov    0xebf(%rip),%rcx
mov    %rcx,0xc0(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
xor    %edx,%edx
cmpl   $0x6,0xc(%rsp)
sete   %dl
lea    0xb0(%rsp),%rdi
mov    %rax,%rsi
call   1040 <memcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    0xe9b(%rip),%eax
mov    %eax,0x80(%rsp)
movaps 0xe7d(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
lea    0x70(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    $0x5,%esi
call   1030 <plusOne@plt>
mov    0xe8e(%rip),%ecx
mov    %ecx,0x60(%rsp)
movaps 0xe73(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
xor    %edx,%edx
cmpl   $0x5,0x8(%rsp)
sete   %dl
lea    0x50(%rsp),%rdi
mov    %rax,%rsi
call   1040 <memcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    0xe74(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xe59(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
lea    0x4(%rsp),%rdx
mov    $0x5,%esi
call   1030 <plusOne@plt>
mov    0xe6a(%rip),%ecx
mov    %ecx,0x20(%rsp)
movaps 0xe4f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %edx,%edx
cmpl   $0x5,0x4(%rsp)
sete   %dl
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
call   1040 <memcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@__const.main.array0 = [5 x i32] [i32 9, i32 9, i32 9, i32 9, i32 9]
@__const.main.exp_array0 = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@__const.main.array1 = [5 x i32] [i32 9, i32 9, i32 8, i32 9, i32 9]
@__const.main.exp_array1 = [5 x i32] [i32 9, i32 9, i32 9, i32 0, i32 0]
@__const.main.array2 = [5 x i32] [i32 2, i32 2, i32 8, i32 9, i32 8]
@__const.main.exp_array2 = [5 x i32] [i32 2, i32 2, i32 8, i32 9, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [6 x i32]
%8 = alloca [5 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca [5 x i32]
%14 = alloca [5 x i32]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32
%19 = alloca [5 x i32]
store i32 0, i32* %1
%20 = bitcast [5 x i32]* %2 to i8*
store i32 5, i32* %3
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call i32* @plusOne(i32* %21, i32 %22, i32* %4)
store i32* %23, i32** %5
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
%26 = bitcast [6 x i32]* %7 to i8*
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%28 = load i32*, i32** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = mul i64 %30, 4
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %0
%34 = load i32, i32* %4
%35 = load i32, i32* %6
%36 = icmp eq i32 %34, %35
br label %37
37: ; preds = %33, %0
%38 = phi i1 [ false, %0 ], [ %36, %33 ]
%39 = zext i1 %38 to i32
%40 = call i32 @memcmp(i32* %27, i32* %28, i32 %39)
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = bitcast [5 x i32]* %8 to i8*
store i32 5, i32* %9
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 0
%47 = load i32, i32* %9
%48 = call i32* @plusOne(i32* %46, i32 %47, i32* %10)
store i32* %48, i32** %11
%49 = load i32, i32* %9
store i32 %49, i32* %12
%50 = bitcast [5 x i32]* %13 to i8*
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%52 = load i32*, i32** %11
%53 = load i32, i32* %12
%54 = sext i32 %53 to i64
%55 = mul i64 %54, 4
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %37
%58 = load i32, i32* %10
%59 = load i32, i32* %12
%60 = icmp eq i32 %58, %59
br label %61
61: ; preds = %57, %37
%62 = phi i1 [ false, %37 ], [ %60, %57 ]
%63 = zext i1 %62 to i32
%64 = call i32 @memcmp(i32* %51, i32* %52, i32 %63)
%65 = icmp ne i32 %64, 0
%66 = xor i1 %65, true
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
%69 = bitcast [5 x i32]* %14 to i8*
store i32 5, i32* %15
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %14, i64 0, i64 0
%71 = load i32, i32* %15
%72 = call i32* @plusOne(i32* %70, i32 %71, i32* %16)
store i32* %72, i32** %17
%73 = load i32, i32* %15
store i32 %73, i32* %18
%74 = bitcast [5 x i32]* %19 to i8*
%75 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 0
%76 = load i32*, i32** %17
%77 = load i32, i32* %18
%78 = sext i32 %77 to i64
%79 = mul i64 %78, 4
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %61
%82 = load i32, i32* %16
%83 = load i32, i32* %18
%84 = icmp eq i32 %82, %83
br label %85
85: ; preds = %81, %61
%86 = phi i1 [ false, %61 ], [ %84, %81 ]
%87 = zext i1 %86 to i32
%88 = call i32 @memcmp(i32* %75, i32* %76, i32 %87)
%89 = icmp ne i32 %88, 0
%90 = xor i1 %89, true
%91 = zext i1 %90 to i32
%92 = call i32 @assert(i32 %91)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array0 = [5 x i32] [i32 9, i32 9, i32 9, i32 9, i32 9]
@__const.main.exp_array0 = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@__const.main.array1 = [5 x i32] [i32 9, i32 9, i32 8, i32 9, i32 9]
@__const.main.exp_array1 = [5 x i32] [i32 9, i32 9, i32 9, i32 0, i32 0]
@__const.main.array2 = [5 x i32] [i32 2, i32 2, i32 8, i32 9, i32 8]
@__const.main.exp_array2 = [5 x i32] [i32 2, i32 2, i32 8, i32 9, i32 9]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = alloca [6 x i32]
%4 = alloca [5 x i32]
%5 = alloca i32
%6 = alloca [5 x i32]
%7 = alloca [5 x i32]
%8 = alloca i32
%9 = alloca [5 x i32]
%10 = bitcast [5 x i32]* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%13 = call i32* @plusOne(i32* %12, i32 5, i32* %2)
%14 = bitcast [6 x i32]* %3 to i8*
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 6
%18 = zext i1 %17 to i32
%19 = call i32 @memcmp(i32* %15, i32* %13, i32 %18)
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = bitcast [5 x i32]* %4 to i8*
%24 = bitcast i32* %5 to i8*
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%26 = call i32* @plusOne(i32* %25, i32 5, i32* %5)
%27 = bitcast [5 x i32]* %6 to i8*
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 5
%31 = zext i1 %30 to i32
%32 = call i32 @memcmp(i32* %28, i32* %26, i32 %31)
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = bitcast [5 x i32]* %7 to i8*
%37 = bitcast i32* %8 to i8*
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%39 = call i32* @plusOne(i32* %38, i32 5, i32* %8)
%40 = bitcast [5 x i32]* %9 to i8*
%41 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%42 = load i32, i32* %8
%43 = icmp eq i32 %42, 5
%44 = zext i1 %43 to i32
%45 = call i32 @memcmp(i32* %41, i32* %39, i32 %44)
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
ret i32 0
}