#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 validate_dependency(char const *, char const *);
int validate_dependencies(const char *names[], const char *versions[],
                          const size_t length) {
  size_t i;
  if (names == NULL || versions == NULL) {
    return -1;
  }
  for (i = 0; i < length; i++) {
    if (validate_dependency(names[i], versions[i]) == -1) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate_dependencies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113a <validate_dependencies+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1146 <validate_dependencies+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <validate_dependencies+0x9b>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11a4 <validate_dependencies+0x94>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <validate_dependency@plt>
cmp    $0xffffffff,%eax
jne    118e <validate_dependencies+0x7e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <validate_dependencies+0x9b>
jmp    1193 <validate_dependencies+0x83>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114e <validate_dependencies+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_dependencies>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %rdi,%rdi
je     115e <validate_dependencies+0x4e>
mov    %rsi,%r12
test   %rsi,%rsi
je     115e <validate_dependencies+0x4e>
mov    %rdx,%r15
test   %rdx,%rdx
je     115b <validate_dependencies+0x4b>
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
mov    (%r12,%rbp,8),%rsi
call   1030 <validate_dependency@plt>
cmp    $0xffffffff,%eax
je     115e <validate_dependencies+0x4e>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1140 <validate_dependencies+0x30>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @validate_dependencies(i8** %0, i8** %1, i64 %2) {
%4 = icmp eq i8** %0, null
%5 = icmp eq i8** %1, null
%6 = or i1 %4, %5
br i1 %6, label %20, label %7
7: ; preds = %3
%8 = icmp eq i64 %2, 0
br i1 %8, label %20, label %11
9: ; preds = %11
%10 = icmp eq i64 %19, %2
br i1 %10, label %20, label %11
11: ; preds = %7, %9
%12 = phi i64 [ %19, %9 ], [ 0, %7 ]
%13 = getelementptr inbounds i8*, i8** %0, i64 %12
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 %12
%16 = load i8*, i8** %15
%17 = tail call i32 @validate_dependency(i8* %14, i8* %16)
%18 = icmp eq i32 %17, -1
%19 = add nuw i64 %12, 1
br i1 %18, label %20, label %9
20: ; preds = %11, %9, %7, %3
%21 = phi i32 [ -1, %3 ], [ 0, %7 ], [ -1, %11 ], [ 0, %9 ]
ret i32 %21
}