#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 */
char *strchr(char *, char);
scalar_t__ strcmp(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int _parse_string(char *buf, const char *name, char *value) {
  char tmp[100];
  strcpy(tmp, buf);
  char *p = strchr(tmp, ':');
  *p = 0;
  if (strcmp(tmp, name)) {
    return -1;
  }
  p++;
  *strchr(p, ';') = 0;
  strcpy(value, p);
  return 0;
}


x86 assembly (clang, -O0):
<_parse_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     119f <_parse_string+0x6f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11dc <_parse_string+0xac>
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
mov    $0x3b,%esi
call   1040 <strchr@plt>
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_string>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rsi
mov    %rsp,%r12
mov    %r12,%rdi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    119b <_parse_string+0x6b>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1040 <strchr@plt>
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @_parse_string(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [100 x i8]
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%14 = call i8* @strchr(i8* %13, i8 signext 58)
store i8* %14, i8** %9
%15 = load i8*, i8** %9
store i8 0, i8* %15
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%17 = load i8*, i8** %6
%18 = call i64 @strcmp(i8* %16, i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %3
store i32 -1, i32* %4
br label %29
21: ; preds = %3
%22 = load i8*, i8** %9
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %9
%24 = load i8*, i8** %9
%25 = call i8* @strchr(i8* %24, i8 signext 59)
store i8 0, i8* %25
%26 = load i8*, i8** %7
%27 = load i8*, i8** %9
%28 = call i32 @strcpy(i8* %26, i8* %27)
store i32 0, i32* %4
br label %29
29: ; preds = %21, %20
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @_parse_string(i8* %0, i8* %1, i8* %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* %0)
%7 = call i8* @strchr(i8* %5, i8 signext 58)
store i8 0, i8* %7
%8 = call i64 @strcmp(i8* %5, i8* %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = call i8* @strchr(i8* %11, i8 signext 59)
store i8 0, i8* %12
%13 = call i32 @strcpy(i8* %2, i8* %11)
br label %14
14: ; preds = %3, %10
%15 = phi i32 [ 0, %10 ], [ -1, %3 ]
ret i32 %15
}