#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*/ array_cmp(unsigned char const *, unsigned char const *, int);
char const *test_array_cmp(void) {
  unsigned char const arr1[32] = {
      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
      0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
      0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
  unsigned char const arr2[32] = {
      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
      0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
      0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
  unsigned char const arr3[32] = {
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
  do {
    if (!(array_cmp(arr1, arr1, 32))) {
      return "Test case for (arr1 == arr1) failed.";
    }
  } while (0);
  do {
    if (!(array_cmp(arr2, arr1, 32))) {
      return "Test case for (arr2 == arr1) failed.";
    }
  } while (0);
  do {
    if (!(array_cmp(arr1, arr2, 32))) {
      return "Test case for (arr1 == arr2) failed.";
    }
  } while (0);
  do {
    if (!(!array_cmp(arr1, arr3, 32))) {
      return "Test case for (arr1 != arr3) failed.";
    }
  } while (0);
  do {
    if (!(!array_cmp(arr3, arr1, 32))) {
      return "Test case for (arr3 != arr1) failed.";
    }
  } while (0);
  return "";
}


x86 assembly (clang, -O0):
<test_array_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeb2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
cmp    $0x0,%eax
jne    11c7 <test_array_cmp+0xb7>
lea    0xe82(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ab <test_array_cmp+0x19b>
jmp    11cc <test_array_cmp+0xbc>
jmp    11d1 <test_array_cmp+0xc1>
lea    -0x50(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
cmp    $0x0,%eax
jne    11fc <test_array_cmp+0xec>
lea    0xe72(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ab <test_array_cmp+0x19b>
jmp    1201 <test_array_cmp+0xf1>
jmp    1206 <test_array_cmp+0xf6>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
cmp    $0x0,%eax
jne    1231 <test_array_cmp+0x121>
lea    0xe62(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ab <test_array_cmp+0x19b>
jmp    1236 <test_array_cmp+0x126>
jmp    123b <test_array_cmp+0x12b>
lea    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
cmp    $0x0,%eax
je     1266 <test_array_cmp+0x156>
lea    0xe52(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ab <test_array_cmp+0x19b>
jmp    126b <test_array_cmp+0x15b>
jmp    1270 <test_array_cmp+0x160>
lea    -0x70(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
cmp    $0x0,%eax
je     129b <test_array_cmp+0x18b>
lea    0xe42(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ab <test_array_cmp+0x19b>
jmp    12a0 <test_array_cmp+0x190>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_array_cmp>:
sub    $0x68,%rsp
movdqa 0xef4(%rip),%xmm0
movdqa %xmm0,0x10(%rsp)
movaps 0xed7(%rip),%xmm1
movaps %xmm1,(%rsp)
movdqa %xmm0,0x50(%rsp)
movaps %xmm1,0x40(%rsp)
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
mov    %rsp,%rdi
mov    %rdi,%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
test   %eax,%eax
je     11aa <test_array_cmp+0x9a>
lea    0x40(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
test   %eax,%eax
je     11b6 <test_array_cmp+0xa6>
mov    %rsp,%rdi
lea    0x40(%rsp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
test   %eax,%eax
je     11c2 <test_array_cmp+0xb2>
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
test   %eax,%eax
je     11ce <test_array_cmp+0xbe>
lea    0xeea(%rip),%rax
add    $0x68,%rsp
ret
lea    0xe6f(%rip),%rax
add    $0x68,%rsp
ret
lea    0xe88(%rip),%rax
add    $0x68,%rsp
ret
lea    0xea1(%rip),%rax
add    $0x68,%rsp
ret
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x20,%edx
call   1030 <array_cmp@plt>
test   %eax,%eax
lea    0xeef(%rip),%rcx
lea    0xec4(%rip),%rax
cmove  %rcx,%rax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.test_array_cmp.arr1 = [32 x i8] c"\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F"
@__const.test_array_cmp.arr2 = [32 x i8] c"\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F"
@__const.test_array_cmp.arr3 = [32 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF"
@.str = [37 x i8] c"Test case for (arr1 == arr1) failed.\00"
@.str.1 = [37 x i8] c"Test case for (arr2 == arr1) failed.\00"
@.str.2 = [37 x i8] c"Test case for (arr1 == arr2) failed.\00"
@.str.3 = [37 x i8] c"Test case for (arr1 != arr3) failed.\00"
@.str.4 = [37 x i8] c"Test case for (arr3 != arr1) failed.\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @test_array_cmp() {
%1 = alloca i8*
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast [32 x i8]* %2 to i8*
%6 = bitcast [32 x i8]* %3 to i8*
%7 = bitcast [32 x i8]* %4 to i8*
br label %8
8: ; preds = %0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%11 = call i32 @array_cmp(i8* %9, i8* %10, i32 32)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %8
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %1
br label %48
14: ; preds = %8
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%19 = call i32 @array_cmp(i8* %17, i8* %18, i32 32)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %48
22: ; preds = %16
br label %23
23: ; preds = %22
br label %24
24: ; preds = %23
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%27 = call i32 @array_cmp(i8* %25, i8* %26, i32 32)
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %24
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %48
30: ; preds = %24
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%34 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%35 = call i32 @array_cmp(i8* %33, i8* %34, i32 32)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %32
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %48
38: ; preds = %32
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
%41 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%43 = call i32 @array_cmp(i8* %41, i8* %42, i32 32)
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %40
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %48
46: ; preds = %40
br label %47
47: ; preds = %46
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %48
48: ; preds = %47, %45, %37, %29, %21, %13
%49 = load i8*, i8** %1
ret i8* %49
}

LLVM IR (-O2):
@__const.test_array_cmp.arr2 = [32 x i8] c"\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F"
@.str = [37 x i8] c"Test case for (arr1 == arr1) failed.\00"
@.str.1 = [37 x i8] c"Test case for (arr2 == arr1) failed.\00"
@.str.2 = [37 x i8] c"Test case for (arr1 == arr2) failed.\00"
@.str.3 = [37 x i8] c"Test case for (arr1 != arr3) failed.\00"
@.str.4 = [37 x i8] c"Test case for (arr3 != arr1) failed.\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @test_array_cmp() {
%1 = alloca [32 x i8]
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%7 = call i32 @array_cmp(i8* %4, i8* %4, i32 32)
%8 = icmp eq i32 %7, 0
br i1 %8, label %22, label %9
9: ; preds = %0
%10 = call i32 @array_cmp(i8* %5, i8* %4, i32 32)
%11 = icmp eq i32 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = call i32 @array_cmp(i8* %4, i8* %5, i32 32)
%14 = icmp eq i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = call i32 @array_cmp(i8* %4, i8* %6, i32 32)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = call i32 @array_cmp(i8* %6, i8* %4, i32 32)
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0)
br label %22
22: ; preds = %18, %15, %12, %9, %0
%23 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), %15 ], [ %21, %18 ]
ret i8* %23
}