#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 const *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int /*<<< orphan*/ trim(char *);
void getKeyVal(const char *line, char tmp[2][256]) {
  char *ptr;
  ptr = strchr(line, '=');
  if (ptr) {
    strncpy(tmp[0], line, ptr - line);
    tmp[0][ptr - line] = '\0';
    strcpy(tmp[1], ptr + 1);
    trim(tmp[0]);
    trim(tmp[1]);
  } else {
    tmp[0][0] = '\0';
    tmp[1][0] = '\0';
  }
}


x86 assembly (clang, -O0):
<getKeyVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d0 <getKeyVal+0x90>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
add    $0x100,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1060 <trim@plt>
mov    -0x10(%rbp),%rdi
add    $0x100,%rdi
call   1060 <trim@plt>
jmp    11e2 <getKeyVal+0xa2>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x100(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getKeyVal>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x3d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11aa <getKeyVal+0x6a>
mov    %rax,%rbx
mov    %rax,%r12
sub    %r15,%r12
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%r14,%r12,1)
lea    0x100(%r14),%r15
add    $0x1,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1060 <trim@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <trim@plt>
movb   $0x0,(%r14)
movb   $0x0,0x100(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @getKeyVal(i8* %0, [256 x i8]* %1) {
%3 = alloca i8*
%4 = alloca [256 x i8]*
%5 = alloca i8*
store i8* %0, i8** %3
store [256 x i8]* %1, [256 x i8]** %4
%6 = load i8*, i8** %3
%7 = call i8* @strchr(i8* %6, i8 signext 61)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %44
10: ; preds = %2
%11 = load [256 x i8]*, [256 x i8]** %4
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = load i8*, i8** %5
%16 = load i8*, i8** %3
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
%21 = call i32 @strncpy(i8* %13, i8* %14, i32 %20)
%22 = load [256 x i8]*, [256 x i8]** %4
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0
%24 = load i8*, i8** %5
%25 = load i8*, i8** %3
%26 = ptrtoint i8* %24 to i64
%27 = ptrtoint i8* %25 to i64
%28 = sub i64 %26, %27
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %23, i64 0, i64 %28
store i8 0, i8* %29
%30 = load [256 x i8]*, [256 x i8]** %4
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %30, i64 1
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %31, i64 0, i64 0
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = call i32 @strcpy(i8* %32, i8* %34)
%36 = load [256 x i8]*, [256 x i8]** %4
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %36, i64 0
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %37, i64 0, i64 0
%39 = call i32 @trim(i8* %38)
%40 = load [256 x i8]*, [256 x i8]** %4
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %40, i64 1
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %41, i64 0, i64 0
%43 = call i32 @trim(i8* %42)
br label %51
44: ; preds = %2
%45 = load [256 x i8]*, [256 x i8]** %4
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %45, i64 0
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %46, i64 0, i64 0
store i8 0, i8* %47
%48 = load [256 x i8]*, [256 x i8]** %4
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %48, i64 1
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %49, i64 0, i64 0
store i8 0, i8* %50
br label %51
51: ; preds = %44, %10
ret void
}

LLVM IR (-O2):
define void @getKeyVal(i8* %0, [256 x i8]* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%4 = icmp eq i8* %3, null
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
br i1 %4, label %18, label %6
6: ; preds = %2
%7 = ptrtoint i8* %3 to i64
%8 = ptrtoint i8* %0 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
%11 = tail call i32 @strncpy(i8* %5, i8* %0, i32 %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %9
store i8 0, i8* %12
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 1, i64 0
%14 = getelementptr inbounds i8, i8* %3, i64 1
%15 = tail call i32 @strcpy(i8* %13, i8* %14)
%16 = tail call i32 @trim(i8* %5)
%17 = tail call i32 @trim(i8* %13)
br label %20
18: ; preds = %2
store i8 0, i8* %5
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 1, i64 0
store i8 0, i8* %19
br label %20
20: ; preds = %18, %6
ret void
}