#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *memchr(char *, char, int);
char *memmem(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
char *getactdata(char *start, char *end, char *prm) {
  static char *result;
  char *cp;
  result = memmem(start, end - start, prm, strlen(prm));
  if (!(result))
    return NULL;
  cp = memchr(result, '=', end - result);
  if (!(cp)) {
    fprintf(stderr, "Badly formed parameter line for %s\n", prm);
    exit(EXIT_FAILURE);
  }
  result = cp + 1;
  cp = memchr(result, '\n', end - result);
  if (!(cp)) {
    fprintf(stderr, "No line end for parameter: %s\n", prm);
    exit(EXIT_FAILURE);
  }
  *cp = '\0';
  return result;
}


x86 assembly (clang, -O0):
<getactdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
call   1060 <memmem@plt>
mov    %rax,0x2eac(%rip)
cmpq   $0x0,0x2ea4(%rip)
jne    11bf <getactdata+0x6f>
movq   $0x0,-0x8(%rbp)
jmp    128e <getactdata+0x13e>
mov    0x2e8a(%rip),%rdi
mov    -0x18(%rbp),%rax
mov    0x2e7f(%rip),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x3d,%esi
call   1040 <memchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1216 <getactdata+0xc6>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdfd(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x2e2b(%rip)
mov    0x2e24(%rip),%rdi
mov    -0x18(%rbp),%rax
mov    0x2e19(%rip),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0xa,%esi
call   1040 <memchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    127c <getactdata+0x12c>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdbb(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    0x2dc6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getactdata>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %r15d,%ebp
sub    %ebx,%ebp
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1060 <memmem@plt>
mov    %rax,0x2ecd(%rip)
test   %rax,%rax
je     11ce <getactdata+0x7e>
mov    %r15d,%edx
sub    %eax,%edx
mov    %rax,%rdi
mov    $0x3d,%esi
call   1040 <memchr@plt>
test   %rax,%rax
je     11db <getactdata+0x8b>
add    $0x1,%rax
mov    %rax,0x2ea6(%rip)
sub    %eax,%r15d
mov    %rax,%rdi
mov    $0xa,%esi
mov    %r15d,%edx
call   1040 <memchr@plt>
test   %rax,%rax
je     11ed <getactdata+0x9d>
movb   $0x0,(%rax)
mov    0x2e84(%rip),%rax
jmp    11d0 <getactdata+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
jmp    11fd <getactdata+0xad>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0xe27(%rip),%rsi
mov    %r14,%rdx
call   1050 <fprintf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@getactdata.result = internal global i8* null
@stderr = global i32 0
@.str = [36 x i8] c"Badly formed parameter line for %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"No line end for parameter: %s\0A\00"
define i8* @getactdata(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %5
%12 = ptrtoint i8* %10 to i64
%13 = ptrtoint i8* %11 to i64
%14 = sub i64 %12, %13
%15 = trunc i64 %14 to i32
%16 = load i8*, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 @strlen(i8* %17)
%19 = call i8* @memmem(i8* %9, i32 %15, i8* %16, i32 %18)
store i8* %19, i8** @getactdata.result
%20 = load i8*, i8** @getactdata.result
%21 = icmp ne i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %3
store i8* null, i8** %4
br label %62
23: ; preds = %3
%24 = load i8*, i8** @getactdata.result
%25 = load i8*, i8** %6
%26 = load i8*, i8** @getactdata.result
%27 = ptrtoint i8* %25 to i64
%28 = ptrtoint i8* %26 to i64
%29 = sub i64 %27, %28
%30 = trunc i64 %29 to i32
%31 = call i8* @memchr(i8* %24, i8 signext 61, i32 %30)
store i8* %31, i8** %8
%32 = load i8*, i8** %8
%33 = icmp ne i8* %32, null
br i1 %33, label %40, label %34
34: ; preds = %23
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %7
%37 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %23
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i64 1
store i8* %42, i8** @getactdata.result
%43 = load i8*, i8** @getactdata.result
%44 = load i8*, i8** %6
%45 = load i8*, i8** @getactdata.result
%46 = ptrtoint i8* %44 to i64
%47 = ptrtoint i8* %45 to i64
%48 = sub i64 %46, %47
%49 = trunc i64 %48 to i32
%50 = call i8* @memchr(i8* %43, i8 signext 10, i32 %49)
store i8* %50, i8** %8
%51 = load i8*, i8** %8
%52 = icmp ne i8* %51, null
br i1 %52, label %59, label %53
53: ; preds = %40
%54 = load i32, i32* @stderr
%55 = load i8*, i8** %7
%56 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %55)
%57 = load i32, i32* @EXIT_FAILURE
%58 = call i32 @exit(i32 %57)
unreachable
59: ; preds = %40
%60 = load i8*, i8** %8
store i8 0, i8* %60
%61 = load i8*, i8** @getactdata.result
store i8* %61, i8** %4
br label %62
62: ; preds = %59, %22
%63 = load i8*, i8** %4
ret i8* %63
}

LLVM IR (-O2):
@getactdata.result = internal unnamed_addr global i8* null
@stderr = global i32 0
@.str = [36 x i8] c"Badly formed parameter line for %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"No line end for parameter: %s\0A\00"
define i8* @getactdata(i8* %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = sub i64 %4, %5
%7 = trunc i64 %6 to i32
%8 = tail call i32 @strlen(i8* %2)
%9 = tail call i8* @memmem(i8* %0, i32 %7, i8* %2, i32 %8)
store i8* %9, i8** @getactdata.result
%10 = icmp eq i8* %9, null
br i1 %10, label %36, label %11
11: ; preds = %3
%12 = ptrtoint i8* %9 to i64
%13 = sub i64 %4, %12
%14 = trunc i64 %13 to i32
%15 = tail call i8* @memchr(i8* %9, i8 signext 61, i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2)
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %11
%23 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %23, i8** @getactdata.result
%24 = ptrtoint i8* %23 to i64
%25 = sub i64 %4, %24
%26 = trunc i64 %25 to i32
%27 = tail call i8* @memchr(i8* %23, i8 signext 10, i32 %26)
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %34
29: ; preds = %22
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
34: ; preds = %22
store i8 0, i8* %27
%35 = load i8*, i8** @getactdata.result
br label %36
36: ; preds = %3, %34
%37 = phi i8* [ %35, %34 ], [ null, %3 ]
ret i8* %37
}