#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 createFilterSupport(char *, unsigned int);
int /*<<< orphan*/ free(char *);
char *malloc(int);
unsigned int strlen(char const *);
int createPidsFilter(const char *pids) {
  unsigned int i, j;
  char *temp;
  if (!pids)
    return 0;
  temp = malloc(strlen(pids) + 1);
  for (i = 0, j = 0; i < strlen(pids); i++) {
    if (pids[i] == ':') {
      if (createFilterSupport(temp, j) == 1) {
        free(temp);
        return 1;
      }
      j = 0;
    } else {
      temp[j++] = pids[i];
    }
  }
  if (createFilterSupport(temp, j) == 1) {
    free(temp);
    return 1;
  }
  free(temp);
  return 0;
}


x86 assembly (clang, -O0):
<createPidsFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1163 <createPidsFilter+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1259 <createPidsFilter+0x119>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jae    121f <createPidsFilter+0xdf>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    11ee <createPidsFilter+0xae>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <createFilterSupport@plt>
cmp    $0x1,%eax
jne    11e2 <createPidsFilter+0xa2>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1259 <createPidsFilter+0x119>
movl   $0x0,-0x18(%rbp)
jmp    120c <createPidsFilter+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
jmp    1211 <createPidsFilter+0xd1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <createPidsFilter+0x48>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <createFilterSupport@plt>
cmp    $0x1,%eax
jne    1249 <createPidsFilter+0x109>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1259 <createPidsFilter+0x119>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createPidsFilter>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11c5 <createPidsFilter+0x85>
mov    %rdi,%r15
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     11c9 <createPidsFilter+0x89>
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    119c <createPidsFilter+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%ecx
add    $0x1,%ebp
mov    %al,(%r14,%rcx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jae    11cb <createPidsFilter+0x8b>
movzbl (%r15,%rbx,1),%eax
cmp    $0x3a,%al
jne    1180 <createPidsFilter+0x40>
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <createFilterSupport@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
jne    1189 <createPidsFilter+0x49>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x1,%ebx
jmp    11e5 <createPidsFilter+0xa5>
xor    %ebx,%ebx
jmp    11e5 <createPidsFilter+0xa5>
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <createFilterSupport@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @createPidsFilter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %63
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = add i32 %12, 1
%14 = call i8* @malloc(i32 %13)
store i8* %14, i8** %6
store i32 0, i32* %4
store i32 0, i32* %5
br label %15
15: ; preds = %49, %10
%16 = load i32, i32* %4
%17 = load i8*, i8** %3
%18 = call i32 @strlen(i8* %17)
%19 = icmp ult i32 %16, %18
br i1 %19, label %20, label %52
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 58
br i1 %27, label %28, label %37
28: ; preds = %20
%29 = load i8*, i8** %6
%30 = load i32, i32* %5
%31 = call i32 @createFilterSupport(i8* %29, i32 %30)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i8*, i8** %6
%35 = call i32 @free(i8* %34)
store i32 1, i32* %2
br label %63
36: ; preds = %28
store i32 0, i32* %5
br label %48
37: ; preds = %20
%38 = load i8*, i8** %3
%39 = load i32, i32* %4
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = load i8*, i8** %6
%44 = load i32, i32* %5
%45 = add i32 %44, 1
store i32 %45, i32* %5
%46 = zext i32 %44 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
store i8 %42, i8* %47
br label %48
48: ; preds = %37, %36
br label %49
49: ; preds = %48
%50 = load i32, i32* %4
%51 = add i32 %50, 1
store i32 %51, i32* %4
br label %15
52: ; preds = %15
%53 = load i8*, i8** %6
%54 = load i32, i32* %5
%55 = call i32 @createFilterSupport(i8* %53, i32 %54)
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i8*, i8** %6
%59 = call i32 @free(i8* %58)
store i32 1, i32* %2
br label %63
60: ; preds = %52
%61 = load i8*, i8** %6
%62 = call i32 @free(i8* %61)
store i32 0, i32* %2
br label %63
63: ; preds = %60, %57, %33, %9
%64 = load i32, i32* %2
ret i32 %64
}

LLVM IR (-O2):
define i32 @createPidsFilter(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %36, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add i32 %4, 1
%6 = tail call i8* @malloc(i32 %5)
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %30, label %9
9: ; preds = %3, %24
%10 = phi i64 [ %26, %24 ], [ 0, %3 ]
%11 = phi i32 [ %25, %24 ], [ 0, %3 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 58
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = tail call i32 @createFilterSupport(i8* %6, i32 %11)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = tail call i32 @free(i8* %6)
br label %36
20: ; preds = %9
%21 = add i32 %11, 1
%22 = zext i32 %11 to i64
%23 = getelementptr inbounds i8, i8* %6, i64 %22
store i8 %13, i8* %23
br label %24
24: ; preds = %15, %20
%25 = phi i32 [ %21, %20 ], [ 0, %15 ]
%26 = add nuw nsw i64 %10, 1
%27 = tail call i32 @strlen(i8* %0)
%28 = zext i32 %27 to i64
%29 = icmp ult i64 %26, %28
br i1 %29, label %9, label %30
30: ; preds = %24, %3
%31 = phi i32 [ 0, %3 ], [ %25, %24 ]
%32 = tail call i32 @createFilterSupport(i8* %6, i32 %31)
%33 = icmp eq i32 %32, 1
%34 = tail call i32 @free(i8* %6)
%35 = zext i1 %33 to i32
br label %36
36: ; preds = %30, %1, %18
%37 = phi i32 [ 1, %18 ], [ 0, %1 ], [ %35, %30 ]
ret i32 %37
}