#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 /*<<< orphan*/ free(char *);
int getEqualsSignPosition(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *trim(char *);
char *getPropertyValue(char *line) {
  int esp = getEqualsSignPosition(line);
  int lineLength = strlen(line);
  if (esp == -1 || esp == 0 || esp == lineLength + 1)
    return NULL;
  int i;
  char *pv = malloc(lineLength - esp);
  memcpy(pv, line + esp + 1, lineLength - esp - 1);
  pv[lineLength - esp - 1] = '\0';
  char *trimmedPv = trim(pv);
  free(pv);
  return trimmedPv;
}


x86 assembly (clang, -O0):
<getPropertyValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getEqualsSignPosition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     11a9 <getPropertyValue+0x49>
cmpl   $0x0,-0x14(%rbp)
je     11a9 <getPropertyValue+0x49>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11b6 <getPropertyValue+0x56>
movq   $0x0,-0x8(%rbp)
jmp    1218 <getPropertyValue+0xb8>
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%edx
sub    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1070 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
call   1060 <trim@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPropertyValue>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <getEqualsSignPosition@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0x1(%r15),%eax
cmp    $0x2,%eax
jb     11d3 <getPropertyValue+0x73>
lea    0x1(%rbx),%eax
cmp    %eax,%r15d
je     11d3 <getPropertyValue+0x73>
sub    %r15d,%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
movslq %r15d,%rax
lea    (%r14,%rax,1),%rsi
add    $0x1,%rsi
movslq %ebx,%rbx
lea    -0x1(%rbx),%rdx
mov    %r12,%rdi
call   1070 <memcpy@plt>
movb   $0x0,-0x1(%r12,%rbx,1)
mov    %r12,%rdi
call   1060 <trim@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
jmp    11d5 <getPropertyValue+0x75>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @getPropertyValue(i8* %0) {
%2 = tail call i32 @getEqualsSignPosition(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = add i32 %2, 1
%5 = icmp ult i32 %4, 2
%6 = add nsw i32 %3, 1
%7 = icmp eq i32 %2, %6
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %21, label %9
9: ; preds = %1
%10 = sub nsw i32 %3, %2
%11 = tail call i8* @malloc(i32 %10)
%12 = sext i32 %2 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = add nsw i32 %10, -1
%16 = tail call i32 @memcpy(i8* %11, i8* %14, i32 %15)
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %11, i64 %17
store i8 0, i8* %18
%19 = tail call i8* @trim(i8* %11)
%20 = tail call i32 @free(i8* %11)
br label %21
21: ; preds = %1, %9
%22 = phi i8* [ %19, %9 ], [ null, %1 ]
ret i8* %22
}