#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 */
struct stringset {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int add_array(struct stringset *, char const *const *, int);
int /*<<< orphan*/ errno;
int stringset_add_array(struct stringset *stringset, char const *const *array,
                        int count) {
  if (!stringset || !array || count < 0) {
    errno = EINVAL;
    return -1;
  }
  return add_array(stringset, array, count);
}


x86 assembly (clang, -O0):
<stringset_add_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1143 <stringset_add_array+0x33>
cmpq   $0x0,-0x18(%rbp)
je     1143 <stringset_add_array+0x33>
cmpl   $0x0,-0x1c(%rbp)
jge    1161 <stringset_add_array+0x51>
mov    0x2e8e(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8d(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <stringset_add_array+0x64>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <add_array@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringset_add_array>:
test   %rdi,%rdi
je     1123 <stringset_add_array+0x13>
test   %rsi,%rsi
je     1123 <stringset_add_array+0x13>
test   %edx,%edx
js     1123 <stringset_add_array+0x13>
jmp    1030 <add_array@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    0x2ead(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stringset = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @stringset_add_array(%struct.stringset* %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.stringset*
%6 = alloca i8**
%7 = alloca i32
store %struct.stringset* %0, %struct.stringset** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%8 = load %struct.stringset*, %struct.stringset** %5
%9 = icmp ne %struct.stringset* %8, null
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i8**, i8*** %6
%12 = icmp ne i8** %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13, %10, %3
%17 = load i32, i32* @EINVAL
store i32 %17, i32* @errno
store i32 -1, i32* %4
br label %23
18: ; preds = %13
%19 = load %struct.stringset*, %struct.stringset** %5
%20 = load i8**, i8*** %6
%21 = load i32, i32* %7
%22 = call i32 @add_array(%struct.stringset* %19, i8** %20, i32 %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %18, %16
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.stringset = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @stringset_add_array(%struct.stringset* %0, i8** %1, i32 %2) {
%4 = icmp eq %struct.stringset* %0, null
%5 = icmp eq i8** %1, null
%6 = or i1 %4, %5
%7 = icmp slt i32 %2, 0
%8 = or i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i32, i32* @EINVAL
store i32 %10, i32* @errno
br label %13
11: ; preds = %3
%12 = tail call i32 @add_array(%struct.stringset* %0, i8** %1, i32 %2)
br label %13
13: ; preds = %11, %9
%14 = phi i32 [ -1, %9 ], [ %12, %11 ]
ret i32 %14
}