#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;

/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int array_compare(char **array1, char **array2) {
  unsigned int len1 = (sizeof(array1) / sizeof(array1[0])),
               len2 = (sizeof(array2) / sizeof(array2[0]));
  if (len2 != len1)
    return -1;
  for (int i = 0; i < len1; ++i) {
    if (strcmp(array1[i], array2[i]))
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<array_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1146 <array_compare+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <array_compare+0x96>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    119f <array_compare+0x8f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     118c <array_compare+0x7c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <array_compare+0x96>
jmp    1191 <array_compare+0x81>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <array_compare+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_compare>:
push   %rax
mov    (%rdi),%rdi
mov    (%rsi),%rsi
call   1030 <strcmp@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @array_compare(i8** %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 1, i32* %7
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %37
13: ; preds = %2
store i32 0, i32* %8
br label %14
14: ; preds = %33, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp ult i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
%19 = load i8**, i8*** %4
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %23, i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %18
store i32 -1, i32* %3
br label %37
32: ; preds = %18
br label %33
33: ; preds = %32
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %14
36: ; preds = %14
store i32 0, i32* %3
br label %37
37: ; preds = %36, %31, %12
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @array_compare(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp ne i64 %5, 0
%7 = sext i1 %6 to i32
ret i32 %7
}