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


x86 assembly (clang, -O0):
<validate_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <validate_tests+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <validate_tests+0x80>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1189 <validate_tests+0x79>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <validate_test@plt>
cmp    $0xffffffff,%eax
jne    1173 <validate_tests+0x63>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <validate_tests+0x80>
jmp    1178 <validate_tests+0x68>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <validate_tests+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_tests>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%r14d
test   %rdi,%rdi
je     114b <validate_tests+0x3b>
mov    %rsi,%r15
test   %rsi,%rsi
je     1148 <validate_tests+0x38>
mov    %rdi,%rbp
xor    %ebx,%ebx
nop
mov    0x0(%rbp,%rbx,8),%rdi
call   1030 <validate_test@plt>
cmp    $0xffffffff,%eax
je     114b <validate_tests+0x3b>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <validate_tests+0x20>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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