#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 stringset_compact(struct stringset *);
int stringset_remove(struct stringset *, char const *const);
int remove_array(struct stringset *stringset, char const *const *array,
                 int count) {
  for (int i = 0; i < count; ++i) {
    int result = stringset_remove(stringset, array[i]);
    if (-1 == result)
      return -1;
  }
  int result = stringset_compact(stringset);
  if (-1 == result)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<remove_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118b <remove_array+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <stringset_remove@plt>
mov    %eax,-0x24(%rbp)
mov    $0xffffffff,%eax
cmp    -0x24(%rbp),%eax
jne    1178 <remove_array+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b8 <remove_array+0x98>
jmp    117d <remove_array+0x5d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113a <remove_array+0x1a>
mov    -0x10(%rbp),%rdi
call   1030 <stringset_compact@plt>
mov    %eax,-0x28(%rbp)
mov    $0xffffffff,%eax
cmp    -0x28(%rbp),%eax
jne    11b1 <remove_array+0x91>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b8 <remove_array+0x98>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
test   %edx,%edx
jle    115a <remove_array+0x3a>
mov    %rsi,%r14
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1040 <stringset_remove@plt>
cmp    $0xffffffff,%eax
je     1170 <remove_array+0x50>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <remove_array+0x20>
mov    %r15,%rdi
call   1030 <stringset_compact@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
jmp    1175 <remove_array+0x55>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.stringset = type { i32 }
define i32 @remove_array(%struct.stringset* %0, i8** nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %15, %6
br i1 %8, label %16, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %15, %7 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @stringset_remove(%struct.stringset* %0, i8* %12)
%14 = icmp eq i32 %13, -1
%15 = add nuw nsw i64 %10, 1
br i1 %14, label %20, label %7
16: ; preds = %7, %3
%17 = tail call i32 @stringset_compact(%struct.stringset* %0)
%18 = icmp eq i32 %17, -1
%19 = sext i1 %18 to i32
br label %20
20: ; preds = %9, %16
%21 = phi i32 [ %19, %16 ], [ -1, %9 ]
ret i32 %21
}