#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 searchKeyIndex(char const *, char const *);
int extractValue(const char *configurationBuffer, const char *targetKey,
                 char *resultValue, int resultValueArraySize) {
  int tempIndex = 0;
  int index = searchKeyIndex(configurationBuffer, targetKey);
  if (index == -1)
    return 1;
  while (configurationBuffer[index++] != ':')
    ;
  while (configurationBuffer[index] != ';') {
    resultValue[tempIndex] = configurationBuffer[index];
    index++;
    tempIndex++;
  }
  resultValue[tempIndex] = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<extractValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <searchKeyIndex@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1154 <extractValue+0x44>
movl   $0x1,-0x4(%rbp)
jmp    11d7 <extractValue+0xc7>
jmp    1159 <extractValue+0x49>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
je     117d <extractValue+0x6d>
jmp    1159 <extractValue+0x49>
jmp    1182 <extractValue+0x72>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
je     11c4 <extractValue+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1182 <extractValue+0x72>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractValue>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
call   1030 <searchKeyIndex@plt>
cmp    $0xffffffff,%eax
je     1162 <extractValue+0x52>
mov    %eax,%ecx
cltq
lea    (%r14,%rax,1),%rdx
shl    $0x20,%rax
movabs $0x100000000,%rsi
nopw   0x0(%rax,%rax,1)
add    %rsi,%rax
add    $0x1,%ecx
cmpb   $0x3a,(%rdx)
lea    0x1(%rdx),%rdx
jne    1140 <extractValue+0x30>
sar    $0x20,%rax
mov    (%r14,%rax,1),%dl
xor    %eax,%eax
cmp    $0x3b,%dl
jne    1169 <extractValue+0x59>
xor    %ecx,%ecx
jmp    1192 <extractValue+0x82>
mov    $0x1,%eax
jmp    1196 <extractValue+0x86>
movslq %ecx,%rcx
lea    (%r14,%rcx,1),%rsi
add    $0x1,%rsi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %dl,(%rbx,%rcx,1)
movzbl (%rsi,%rcx,1),%edx
add    $0x1,%rcx
cmp    $0x3b,%dl
jne    1180 <extractValue+0x70>
mov    %ecx,%ecx
movb   $0x0,(%rbx,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @extractValue(i8* %0, i8* %1, i8* nocapture writeonly %2, i32 %3) {
%5 = tail call i32 @searchKeyIndex(i8* %0, i8* %1)
%6 = icmp eq i32 %5, -1
br i1 %6, label %36, label %7
7: ; preds = %4
%8 = sext i32 %5 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %11, %9 ]
%11 = add i64 %10, 1
%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 %9
15: ; preds = %9
%16 = shl i64 %11, 32
%17 = ashr exact i64 %16, 32
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 59
br i1 %20, label %33, label %21
21: ; preds = %15, %21
%22 = phi i64 [ %27, %21 ], [ 0, %15 ]
%23 = phi i64 [ %26, %21 ], [ %17, %15 ]
%24 = phi i8 [ %29, %21 ], [ %19, %15 ]
%25 = getelementptr inbounds i8, i8* %2, i64 %22
store i8 %24, i8* %25
%26 = add i64 %23, 1
%27 = add nuw i64 %22, 1
%28 = getelementptr inbounds i8, i8* %0, i64 %26
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 59
br i1 %30, label %31, label %21
31: ; preds = %21
%32 = and i64 %27, 4294967295
br label %33
33: ; preds = %31, %15
%34 = phi i64 [ 0, %15 ], [ %32, %31 ]
%35 = getelementptr inbounds i8, i8* %2, i64 %34
store i8 0, i8* %35
br label %36
36: ; preds = %4, %33
%37 = phi i32 [ 0, %33 ], [ 1, %4 ]
ret i32 %37
}