#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*/ printf(char *, long, long, ...);
bool _assertLongArrayEquals(long *expected, long *actual, int length,
                            int line) {
  int i;
  if (length <= 0) {
    printf("assertLongArrayEquals FAILED, line: %i, negative or zero array "
           "length: %i",
           line, length);
    return false;
  }
  for (i = 0; i < length; i++) {
    if (expected[i] != actual[i]) {
      printf("assertLongArrayEquals FAILED, line: %i, on index %i with array "
             "length %i\n",
             line, i, length);
      printf("expected: %li, actual: %li\n", expected[i], actual[i]);
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<_assertLongArrayEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     1152 <_assertLongArrayEquals+0x42>
movslq -0x20(%rbp),%rsi
movslq -0x1c(%rbp),%rdx
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e8 <_assertLongArrayEquals+0xd8>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e1 <_assertLongArrayEquals+0xd1>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     11ce <_assertLongArrayEquals+0xbe>
movslq -0x20(%rbp),%rsi
movslq -0x24(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e8 <_assertLongArrayEquals+0xd8>
jmp    11d3 <_assertLongArrayEquals+0xc3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1159 <_assertLongArrayEquals+0x49>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assertLongArrayEquals>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%eax
test   %edx,%edx
jle    114b <_assertLongArrayEquals+0x3b>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %eax,%edx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rsi
cmp    (%r14,%rbp,8),%rsi
jne    115d <_assertLongArrayEquals+0x4d>
add    $0x1,%rbp
cmp    %rbp,%rdx
jne    1130 <_assertLongArrayEquals+0x20>
mov    $0x1,%r15d
jmp    118c <_assertLongArrayEquals+0x7c>
movslq %ecx,%rsi
movslq %eax,%rdx
lea    0xea8(%rip),%rdi
xor    %r15d,%r15d
jmp    1185 <_assertLongArrayEquals+0x75>
movslq %ecx,%rsi
lea    0xee3(%rip),%rdi
xor    %r15d,%r15d
mov    %rbp,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx,%rbp,8),%rsi
mov    (%r14,%rbp,8),%rdx
lea    0xf0f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [74 x i8] c"assertLongArrayEquals FAILED, line: %i, negative or zero array length: %i\00"
@.str.1 = [74 x i8] c"assertLongArrayEquals FAILED, line: %i, on index %i with array length %i\0A\00"
@.str.2 = [28 x i8] c"expected: %li, actual: %li\0A\00"
define i32 @_assertLongArrayEquals(i64* %0, i64* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i64* %0, i64** %6
store i64* %1, i64** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i32, i32* %8
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = load i32, i32* %9
%15 = sext i32 %14 to i64
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %17)
store i32 0, i32* %5
br label %59
19: ; preds = %4
store i32 0, i32* %10
br label %20
20: ; preds = %55, %19
%21 = load i32, i32* %10
%22 = load i32, i32* %8
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %58
24: ; preds = %20
%25 = load i64*, i64** %6
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i64, i64* %25, i64 %27
%29 = load i64, i64* %28
%30 = load i64*, i64** %7
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i64, i64* %30, i64 %32
%34 = load i64, i64* %33
%35 = icmp ne i64 %29, %34
br i1 %35, label %36, label %54
36: ; preds = %24
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = load i32, i32* %8
%42 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0), i64 %38, i64 %40, i32 %41)
%43 = load i64*, i64** %6
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i64, i64* %43, i64 %45
%47 = load i64, i64* %46
%48 = load i64*, i64** %7
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i64, i64* %48, i64 %50
%52 = load i64, i64* %51
%53 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %47, i64 %52)
store i32 0, i32* %5
br label %59
54: ; preds = %24
br label %55
55: ; preds = %54
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %20
58: ; preds = %20
store i32 1, i32* %5
br label %59
59: ; preds = %58, %36, %13
%60 = load i32, i32* %5
ret i32 %60
}

LLVM IR (-O2):
@.str = [74 x i8] c"assertLongArrayEquals FAILED, line: %i, negative or zero array length: %i\00"
@.str.1 = [74 x i8] c"assertLongArrayEquals FAILED, line: %i, on index %i with array length %i\0A\00"
@.str.2 = [28 x i8] c"expected: %li, actual: %li\0A\00"
define i32 @_assertLongArrayEquals(i64* nocapture %0, i64* nocapture %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 1
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %12
8: ; preds = %4
%9 = sext i32 %3 to i64
%10 = sext i32 %2 to i64
%11 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i64 %9, i64 %10)
br label %31
12: ; preds = %6, %28
%13 = phi i64 [ 0, %6 ], [ %29, %28 ]
%14 = getelementptr inbounds i64, i64* %0, i64 %13
%15 = load i64, i64* %14
%16 = getelementptr inbounds i64, i64* %1, i64 %13
%17 = load i64, i64* %16
%18 = icmp eq i64 %15, %17
br i1 %18, label %28, label %19
19: ; preds = %12
%20 = and i64 %13, 4294967295
%21 = getelementptr inbounds i64, i64* %0, i64 %20
%22 = getelementptr inbounds i64, i64* %1, i64 %20
%23 = sext i32 %3 to i64
%24 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0), i64 %23, i64 %20, i32 %2)
%25 = load i64, i64* %21
%26 = load i64, i64* %22
%27 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %25, i64 %26)
br label %31
28: ; preds = %12
%29 = add nuw nsw i64 %13, 1
%30 = icmp eq i64 %29, %7
br i1 %30, label %31, label %12
31: ; preds = %28, %19, %8
%32 = phi i32 [ 0, %8 ], [ 0, %19 ], [ 1, %28 ]
ret i32 %32
}