#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);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *sspm_property_name(char *line) {
  static char name[1024];
  char *c = strchr(line, ':');
  if (c != 0) {
    strncpy(name, line, (size_t)c - (size_t)line);
    name[(size_t)c - (size_t)line] = '\0';
    return name;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<sspm_property_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118a <sspm_property_name+0x6a>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
sub    %rax,%rdx
lea    0x2ee1(%rip),%rdi
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rax,%rcx
lea    0x2eca(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ebf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1192 <sspm_property_name+0x72>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sspm_property_name>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1159 <sspm_property_name+0x39>
mov    %rax,%rbx
sub    %r14,%rbx
lea    0x2efc(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r15,1)
jmp    115c <sspm_property_name+0x3c>
xor    %r15d,%r15d
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@sspm_property_name.name = internal global [1024 x i8] zeroinitializer
define i8* @sspm_property_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 58)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %23
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = ptrtoint i8* %11 to i64
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %13 to i64
%15 = sub i64 %12, %14
%16 = call i32 @strncpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 0), i8* %10, i64 %15)
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %17 to i64
%19 = load i8*, i8** %3
%20 = ptrtoint i8* %19 to i64
%21 = sub i64 %18, %20
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 %21
store i8 0, i8* %22
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 0), i8** %2
br label %24
23: ; preds = %1
store i8* null, i8** %2
br label %24
24: ; preds = %23, %9
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
@sspm_property_name.name = internal global [1024 x i8] zeroinitializer
define i8* @sspm_property_name(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = ptrtoint i8* %2 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = tail call i32 @strncpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 0), i8* %0, i64 %7)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 %7
store i8 0, i8* %9
br label %10
10: ; preds = %1, %4
%11 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_property_name.name, i64 0, i64 0), %4 ], [ null, %1 ]
ret i8* %11
}