#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 setBit(int, int);
int getBipsOfDropSet(int bvec_bips, int dropsetNumber, int *numberOfBipsPerSet,
                     int **bipsOfDropSet) {
  int l;
  for (l = 0; l < numberOfBipsPerSet[dropsetNumber]; l++) {
    int *bips = bipsOfDropSet[dropsetNumber];
    int b_index = bips[l];
    bvec_bips = setBit(bvec_bips, b_index);
  }
  return bvec_bips;
}


x86 assembly (clang, -O0):
<getBipsOfDropSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x8(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    117b <getBipsOfDropSet+0x6b>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1030 <setBit@plt>
mov    %eax,-0x4(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <getBipsOfDropSet+0x1d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBipsOfDropSet>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%eax
movslq %esi,%r12
cmpl   $0x0,(%rdx,%r12,4)
jle    114b <getBipsOfDropSet+0x3b>
mov    %rcx,%r14
mov    %rdx,%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%r12,8),%rcx
mov    (%rcx,%rbx,4),%esi
mov    %eax,%edi
call   1030 <setBit@plt>
add    $0x1,%rbx
movslq (%r15,%r12,4),%rcx
cmp    %rcx,%rbx
jl     1130 <getBipsOfDropSet+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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