#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);
char *trim(char *);
char *getPropertyName(char *line) {
  int esp = getEqualsSignPosition(line);
  if (esp == -1 || esp == 0)
    return NULL;
  int i;
  char *pn = malloc(esp + 1);
  memcpy(pn, line, esp);
  pn[esp] = '\0';
  char *trimmedPn = trim(pn);
  free(pn);
  return trimmedPn;
}


x86 assembly (clang, -O0):
<getPropertyName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getEqualsSignPosition@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     117c <getPropertyName+0x2c>
cmpl   $0x0,-0x14(%rbp)
jne    1189 <getPropertyName+0x39>
movq   $0x0,-0x8(%rbp)
jmp    11d2 <getPropertyName+0x82>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
call   1050 <trim@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPropertyName>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <getEqualsSignPosition@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%edi
cmp    $0x2,%edi
jae    116b <getPropertyName+0x1b>
xor    %eax,%eax
jmp    119e <getPropertyName+0x4e>
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,(%r15,%rax,1)
mov    %r15,%rdi
call   1050 <trim@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @getPropertyName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @getEqualsSignPosition(i8* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, -1
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %1
store i8* null, i8** %2
br label %33
16: ; preds = %12
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
%19 = call i8* @malloc(i32 %18)
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = call i32 @memcpy(i8* %20, i8* %21, i32 %22)
%24 = load i8*, i8** %6
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 0, i8* %27
%28 = load i8*, i8** %6
%29 = call i8* @trim(i8* %28)
store i8* %29, i8** %7
%30 = load i8*, i8** %6
%31 = call i32 @free(i8* %30)
%32 = load i8*, i8** %7
store i8* %32, i8** %2
br label %33
33: ; preds = %16, %15
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
define i8* @getPropertyName(i8* %0) {
%2 = tail call i32 @getEqualsSignPosition(i8* %0)
%3 = add i32 %2, 1
%4 = icmp ult i32 %3, 2
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = tail call i8* @malloc(i32 %3)
%7 = tail call i32 @memcpy(i8* %6, i8* %0, i32 %2)
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 0, i8* %9
%10 = tail call i8* @trim(i8* %6)
%11 = tail call i32 @free(i8* %6)
br label %12
12: ; preds = %1, %5
%13 = phi i8* [ %10, %5 ], [ null, %1 ]
ret i8* %13
}