#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*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *strrchr(char *, char);
char *strstr(char *, char *);
char *sspm_get_parameter(char *line, char *parameter) {
  char *p, *s, *q;
  static char name[1024];
  p = strstr(line, parameter);
  if (p == 0) {
    return 0;
  }
  p += strlen(parameter);
  while (*p == ' ' || *p == '=') {
    p++;
  }
  s = strchr(p, ';');
  q = strchr(p, '\"');
  if (q != 0) {
    p = q + 1;
  }
  if (s != 0) {
    strncpy(name, p, (size_t)s - (size_t)p);
  } else {
    strcpy(name, p);
  }
  q = strrchr(name, '\"');
  if (q != 0) {
    *q = '\0';
  }
  return name;
}


x86 assembly (clang, -O0):
<sspm_get_parameter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1199 <sspm_get_parameter+0x39>
movq   $0x0,-0x8(%rbp)
jmp    12a0 <sspm_get_parameter+0x140>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x31(%rbp)
je     11d7 <sspm_get_parameter+0x77>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11e7 <sspm_get_parameter+0x87>
jmp    11f8 <sspm_get_parameter+0x98>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11b2 <sspm_get_parameter+0x52>
mov    -0x20(%rbp),%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x22,%esi
call   1060 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1233 <sspm_get_parameter+0xd3>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     125e <sspm_get_parameter+0xfe>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rax
sub    %rax,%rdx
lea    0x2e0c(%rip),%rdi
call   1030 <strncpy@plt>
jmp    126e <sspm_get_parameter+0x10e>
mov    -0x20(%rbp),%rsi
lea    0x2df7(%rip),%rdi
call   1040 <strcpy@plt>
lea    0x2deb(%rip),%rdi
mov    $0x22,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1295 <sspm_get_parameter+0x135>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2dc4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sspm_get_parameter>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1080 <strstr@plt>
test   %rax,%rax
je     11e0 <sspm_get_parameter+0x80>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
add    %rax,%rbx
jmp    1194 <sspm_get_parameter+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x3d,%al
je     1190 <sspm_get_parameter+0x30>
cmp    $0x20,%al
je     1190 <sspm_get_parameter+0x30>
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x22,%esi
call   1060 <strchr@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
test   %r14,%r14
je     11e4 <sspm_get_parameter+0x84>
sub    %rsi,%r14
lea    0x2e8a(%rip),%rdi
mov    %r14,%rdx
call   1030 <strncpy@plt>
jmp    11f0 <sspm_get_parameter+0x90>
xor    %ebx,%ebx
jmp    120c <sspm_get_parameter+0xac>
lea    0x2e75(%rip),%rdi
call   1040 <strcpy@plt>
lea    0x2e69(%rip),%rbx
mov    %rbx,%rdi
mov    $0x22,%esi
call   1070 <strrchr@plt>
test   %rax,%rax
je     120c <sspm_get_parameter+0xac>
movb   $0x0,(%rax)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@sspm_get_parameter.name = internal global [1024 x i8] zeroinitializer
define i8* @sspm_get_parameter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @strstr(i8* %9, i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %2
store i8* null, i8** %3
br label %67
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
%18 = load i8*, i8** %6
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %6
br label %21
21: ; preds = %33, %15
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br i1 %25, label %31, label %26
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 61
br label %31
31: ; preds = %26, %21
%32 = phi i1 [ true, %21 ], [ %30, %26 ]
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %6
br label %21
36: ; preds = %31
%37 = load i8*, i8** %6
%38 = call i8* @strchr(i8* %37, i8 signext 59)
store i8* %38, i8** %7
%39 = load i8*, i8** %6
%40 = call i8* @strchr(i8* %39, i8 signext 34)
store i8* %40, i8** %8
%41 = load i8*, i8** %8
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = load i8*, i8** %8
%45 = getelementptr inbounds i8, i8* %44, i64 1
store i8* %45, i8** %6
br label %46
46: ; preds = %43, %36
%47 = load i8*, i8** %7
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = load i8*, i8** %6
%51 = load i8*, i8** %7
%52 = ptrtoint i8* %51 to i64
%53 = load i8*, i8** %6
%54 = ptrtoint i8* %53 to i64
%55 = sub i64 %52, %54
%56 = call i32 @strncpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8* %50, i64 %55)
br label %60
57: ; preds = %46
%58 = load i8*, i8** %6
%59 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %57, %49
%61 = call i8* @strrchr(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8 signext 34)
store i8* %61, i8** %8
%62 = load i8*, i8** %8
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = load i8*, i8** %8
store i8 0, i8* %65
br label %66
66: ; preds = %64, %60
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8** %3
br label %67
67: ; preds = %66, %14
%68 = load i8*, i8** %3
ret i8* %68
}

LLVM IR (-O2):
@sspm_get_parameter.name = internal global [1024 x i8] zeroinitializer
define i8* @sspm_get_parameter(i8* %0, i8* %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %32, label %5
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %1)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %3, i64 %7
br label %9
9: ; preds = %12, %5
%10 = phi i8* [ %8, %5 ], [ %13, %12 ]
%11 = load i8, i8* %10
switch i8 %11, label %14 [
i8 32, label %12
i8 61, label %12
]
12: ; preds = %9, %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
br label %9
14: ; preds = %9
%15 = tail call i8* @strchr(i8* %10, i8 signext 59)
%16 = tail call i8* @strchr(i8* %10, i8 signext 34)
%17 = icmp eq i8* %16, null
%18 = getelementptr inbounds i8, i8* %16, i64 1
%19 = select i1 %17, i8* %10, i8* %18
%20 = icmp eq i8* %15, null
br i1 %20, label %26, label %21
21: ; preds = %14
%22 = ptrtoint i8* %15 to i64
%23 = ptrtoint i8* %19 to i64
%24 = sub i64 %22, %23
%25 = tail call i32 @strncpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8* %19, i64 %24)
br label %28
26: ; preds = %14
%27 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8* %19)
br label %28
28: ; preds = %26, %21
%29 = tail call i8* @strrchr(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), i8 signext 34)
%30 = icmp eq i8* %29, null
br i1 %30, label %32, label %31
31: ; preds = %28
store i8 0, i8* %29
br label %32
32: ; preds = %28, %31, %2
%33 = phi i8* [ null, %2 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), %31 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @sspm_get_parameter.name, i64 0, i64 0), %28 ]
ret i8* %33
}