#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 get_first_not_of(char const *, int, char *);
char *strchr(char const *, char);
int strlen(char const *);
char *toy_strndup(char const *, int);
int get_value(char **value, const char *line) {
  if (NULL == value || NULL == line) {
    return -1;
  }
  const char *peq = strchr(line, '=');
  if (NULL == peq) {
    return -1;
  }
  peq += 1;
  int len = strlen(peq);
  ;
  int pos = get_first_not_of(peq, len, "\t ");
  ;
  if (pos < 0) {
    return -1;
  }
  *value = toy_strndup(peq + pos, len - pos);
  return 0;
}


x86 assembly (clang, -O0):
<get_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1168 <get_value+0x28>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1174 <get_value+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <get_value+0xc9>
mov    -0x18(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    119e <get_value+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <get_value+0xc9>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    0xe3c(%rip),%rdx
call   1030 <get_first_not_of@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    11e2 <get_value+0xa2>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <get_value+0xc9>
mov    -0x20(%rbp),%rdi
movslq -0x28(%rbp),%rax
add    %rax,%rdi
mov    -0x24(%rbp),%esi
sub    -0x28(%rbp),%esi
call   1060 <toy_strndup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_value>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     11aa <get_value+0x6a>
test   %rsi,%rsi
je     11aa <get_value+0x6a>
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11aa <get_value+0x6a>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0xe7c(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <get_first_not_of@plt>
test   %eax,%eax
js     11aa <get_value+0x6a>
mov    %eax,%ecx
add    %rcx,%rbx
sub    %eax,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
call   1060 <toy_strndup@plt>
mov    %rax,(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\09 \00"
define i32 @get_value(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
%9 = load i8**, i8*** %4
%10 = icmp eq i8** null, %9
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = icmp eq i8* null, %12
br i1 %13, label %14, label %15
14: ; preds = %11, %2
store i32 -1, i32* %3
br label %42
15: ; preds = %11
%16 = load i8*, i8** %5
%17 = call i8* @strchr(i8* %16, i8 signext 61)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = icmp eq i8* null, %18
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 -1, i32* %3
br label %42
21: ; preds = %15
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %7
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = call i32 @get_first_not_of(i8* %26, i32 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %21
store i32 -1, i32* %3
br label %42
32: ; preds = %21
%33 = load i8*, i8** %6
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = sub nsw i32 %37, %38
%40 = call i8* @toy_strndup(i8* %36, i32 %39)
%41 = load i8**, i8*** %4
store i8* %40, i8** %41
store i32 0, i32* %3
br label %42
42: ; preds = %32, %31, %20, %14
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"\09 \00"
define i32 @get_value(i8** writeonly %0, i8* %1) {
%3 = icmp eq i8** %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %19, label %6
6: ; preds = %2
%7 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 61)
%8 = icmp eq i8* %7, null
br i1 %8, label %19, label %9
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = tail call i32 @strlen(i8* %10)
%12 = tail call i32 @get_first_not_of(i8* %10, i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp slt i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = zext i32 %12 to i64
%16 = getelementptr inbounds i8, i8* %10, i64 %15
%17 = sub nsw i32 %11, %12
%18 = tail call i8* @toy_strndup(i8* %16, i32 %17)
store i8* %18, i8** %0
br label %19
19: ; preds = %6, %9, %14, %2
%20 = phi i32 [ -1, %2 ], [ -1, %6 ], [ 0, %14 ], [ -1, %9 ]
ret i32 %20
}