#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 */
scalar_t__ isEnabledFeature(char *);
char *strchr(char *, char);
char *strip(char *);
char *convertFeaturedString(char *fs) {
  while (fs != NULL) {
    char *next, *value;
    if ((next = strchr(fs, ';')) != NULL)
      *next++ = '\0';
    if ((value = strchr(fs, ':')) == NULL) {
      return strip(fs);
    }
    *value++ = '\0';
    if (isEnabledFeature(strip(fs)))
      return strip(value);
    fs = next;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<convertFeaturedString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ef <convertFeaturedString+0xbf>
mov    -0x10(%rbp),%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1175 <convertFeaturedString+0x45>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a3 <convertFeaturedString+0x73>
mov    -0x10(%rbp),%rdi
call   1050 <strip@plt>
mov    %rax,-0x8(%rbp)
jmp    11f7 <convertFeaturedString+0xc7>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1050 <strip@plt>
mov    %rax,%rdi
call   1040 <isEnabledFeature@plt>
cmp    $0x0,%rax
je     11e2 <convertFeaturedString+0xb2>
mov    -0x20(%rbp),%rdi
call   1050 <strip@plt>
mov    %rax,-0x8(%rbp)
jmp    11f7 <convertFeaturedString+0xc7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    113c <convertFeaturedString+0xc>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertFeaturedString>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
nopl   0x0(%rax,%rax,1)
test   %r14,%r14
je     11b7 <convertFeaturedString+0x87>
mov    %r14,%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1170 <convertFeaturedString+0x40>
mov    %rax,%r15
add    $0x1,%r15
movb   $0x0,(%rax)
jmp    1173 <convertFeaturedString+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r15d,%r15d
mov    %r14,%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11aa <convertFeaturedString+0x7a>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r14,%rdi
call   1050 <strip@plt>
mov    %rax,%rdi
call   1040 <isEnabledFeature@plt>
mov    %r15,%r14
test   %rax,%rax
je     1140 <convertFeaturedString+0x10>
add    $0x1,%rbx
mov    %rbx,%r14
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <strip@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @convertFeaturedString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
br label %6
6: ; preds = %33, %1
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = call i8* @strchr(i8* %10, i8 signext 59)
store i8* %11, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
store i8 0, i8* %14
br label %16
16: ; preds = %13, %9
%17 = load i8*, i8** %3
%18 = call i8* @strchr(i8* %17, i8 signext 58)
store i8* %18, i8** %5
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call i8* @strip(i8* %21)
store i8* %22, i8** %2
br label %36
23: ; preds = %16
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
store i8 0, i8* %24
%26 = load i8*, i8** %3
%27 = call i8* @strip(i8* %26)
%28 = call i64 @isEnabledFeature(i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %23
%31 = load i8*, i8** %5
%32 = call i8* @strip(i8* %31)
store i8* %32, i8** %2
br label %36
33: ; preds = %23
%34 = load i8*, i8** %4
store i8* %34, i8** %3
br label %6
35: ; preds = %6
store i8* null, i8** %2
br label %36
36: ; preds = %35, %30, %20
%37 = load i8*, i8** %2
ret i8* %37
}

LLVM IR (-O2):
define i8* @convertFeaturedString(i8* %0) {
br label %2
2: ; preds = %14, %1
%3 = phi i8* [ %0, %1 ], [ %11, %14 ]
%4 = icmp eq i8* %3, null
br i1 %4, label %23, label %5
5: ; preds = %2
%6 = tail call i8* @strchr(i8* %3, i8 signext 59)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
store i8 0, i8* %6
br label %10
10: ; preds = %8, %5
%11 = phi i8* [ %9, %8 ], [ null, %5 ]
%12 = tail call i8* @strchr(i8* %3, i8 signext 58)
%13 = icmp eq i8* %12, null
br i1 %13, label %20, label %14
14: ; preds = %10
store i8 0, i8* %12
%15 = tail call i8* @strip(i8* %3)
%16 = tail call i64 @isEnabledFeature(i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %2, label %18
18: ; preds = %14
%19 = getelementptr inbounds i8, i8* %12, i64 1
br label %20
20: ; preds = %10, %18
%21 = phi i8* [ %19, %18 ], [ %3, %10 ]
%22 = tail call i8* @strip(i8* %21)
br label %23
23: ; preds = %2, %20
%24 = phi i8* [ %22, %20 ], [ null, %2 ]
ret i8* %24
}