#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 *, ...);
int arrayCompare(char *actualEncoded, char *expectedEncoded, size_t arraysize) {
  size_t idx = 0;
  char actchar = 0;
  char exptdchar = 0;
  size_t cntr = 0;
  for (idx; idx < arraysize; ++idx) {
    actchar = actualEncoded[idx];
    exptdchar = expectedEncoded[idx];
    printf("[%3d]  A:%02x == E:%02x	", idx, actchar, exptdchar);
    if (actchar == exptdchar) {
      printf("true\n");
      cntr++;
    } else {
      printf("false\n");
    }
  }
  if (cntr == arraysize) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<arrayCompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movb   $0x0,-0x29(%rbp)
movb   $0x0,-0x2a(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11d3 <arrayCompare+0xc3>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x2a(%rbp)
mov    -0x28(%rbp),%rsi
movsbl -0x29(%rbp),%edx
movsbl -0x2a(%rbp),%ecx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x29(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
cmp    %ecx,%eax
jne    11af <arrayCompare+0x9f>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11bd <arrayCompare+0xad>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <arrayCompare+0xb2>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    113c <arrayCompare+0x2c>
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    11ed <arrayCompare+0xdd>
movl   $0x1,-0x4(%rbp)
jmp    11f4 <arrayCompare+0xe4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrayCompare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %rdx,%rdx
je     119d <arrayCompare+0x7d>
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1166 <arrayCompare+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r13
cmp    %r13,(%rsp)
je     11a0 <arrayCompare+0x80>
movsbl (%rbx,%r13,1),%ebp
movsbl (%r15,%r13,1),%r12d
lea    0xe89(%rip),%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r12b,%bpl
jne    1150 <arrayCompare+0x30>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r14
jmp    115c <arrayCompare+0x3c>
xor    %r14d,%r14d
xor    %eax,%eax
cmp    (%rsp),%r14
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"[%3d] A:%02x == E:%02x\09\00"
@.str.1 = [6 x i8] c"true\0A\00"
@.str.2 = [7 x i8] c"false\0A\00"
define i32 @arrayCompare(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
%10 = alloca i8
%11 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 0, i64* %8
store i8 0, i8* %9
store i8 0, i8* %10
store i64 0, i64* %11
%12 = load i64, i64* %8
br label %13
13: ; preds = %44, %3
%14 = load i64, i64* %8
%15 = load i64, i64* %7
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %47
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i64, i64* %8
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
store i8 %21, i8* %9
%22 = load i8*, i8** %6
%23 = load i64, i64* %8
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i8, i8* %24
store i8 %25, i8* %10
%26 = load i64, i64* %8
%27 = load i8, i8* %9
%28 = sext i8 %27 to i32
%29 = load i8, i8* %10
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %26, i32 %28, i32 %30)
%32 = load i8, i8* %9
%33 = sext i8 %32 to i32
%34 = load i8, i8* %10
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %33, %35
br i1 %36, label %37, label %41
37: ; preds = %17
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%39 = load i64, i64* %11
%40 = add i64 %39, 1
store i64 %40, i64* %11
br label %43
41: ; preds = %17
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
br label %44
44: ; preds = %43
%45 = load i64, i64* %8
%46 = add i64 %45, 1
store i64 %46, i64* %8
br label %13
47: ; preds = %13
%48 = load i64, i64* %11
%49 = load i64, i64* %7
%50 = icmp eq i64 %48, %49
br i1 %50, label %51, label %52
51: ; preds = %47
store i32 1, i32* %4
br label %53
52: ; preds = %47
store i32 0, i32* %4
br label %53
53: ; preds = %52, %51
%54 = load i32, i32* %4
ret i32 %54
}

LLVM IR (-O2):
@.str = [25 x i8] c"[%3d] A:%02x == E:%02x\09\00"
@str = [6 x i8] c"false\00"
@str.3 = [5 x i8] c"true\00"
define i32 @arrayCompare(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %25, label %5
5: ; preds = %3, %21
%6 = phi i64 [ %22, %21 ], [ 0, %3 ]
%7 = phi i64 [ %23, %21 ], [ 0, %3 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %1, i64 %7
%11 = load i8, i8* %10
%12 = sext i8 %9 to i32
%13 = sext i8 %11 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %7, i32 %12, i32 %13)
%15 = icmp eq i8 %9, %11
br i1 %15, label %16, label %19
16: ; preds = %5
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0))
%18 = add i64 %6, 1
br label %21
19: ; preds = %5
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %16, %19
%22 = phi i64 [ %18, %16 ], [ %6, %19 ]
%23 = add nuw i64 %7, 1
%24 = icmp eq i64 %23, %2
br i1 %24, label %25, label %5
25: ; preds = %21, %3
%26 = phi i64 [ 0, %3 ], [ %22, %21 ]
%27 = icmp eq i64 %26, %2
%28 = zext i1 %27 to i32
ret i32 %28
}