#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 */
scalar_t__ isspace(unsigned char);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf) {
  char *keyword, *value, *p, *q;
  strcpy(linebuf, olinebuf);
  keyword = linebuf;
  while (isspace((unsigned char)*keyword))
    keyword++;
  p = strchr(linebuf, '=');
  if (!p)
    return 0;
  q = p - 1;
  while (isspace((unsigned char)*q))
    *q-- = 0;
  *p = 0;
  value = p + 1;
  while (isspace((unsigned char)*value))
    value++;
  p = value + strlen(value) - 1;
  while (*p == '\n' || isspace((unsigned char)*p))
    *p-- = 0;
  *pkw = keyword;
  *pval = value;
  return 1;
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movzbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     1194 <parse_line+0x54>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    116d <parse_line+0x2d>
mov    -0x20(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11bd <parse_line+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    12c4 <parse_line+0x184>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movzbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     11f6 <parse_line+0xb6>
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x48(%rbp)
movb   $0x0,(%rax)
jmp    11c9 <parse_line+0x89>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movzbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     1230 <parse_line+0xf0>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1209 <parse_line+0xc9>
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x51(%rbp)
je     1280 <parse_line+0x140>
mov    -0x40(%rbp),%rax
movzbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    1290 <parse_line+0x150>
jmp    12a7 <parse_line+0x167>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x0,(%rax)
jmp    1255 <parse_line+0x115>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    %rcx,%rsi
call   1030 <strcpy@plt>
lea    -0x1(%r12),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%r13),%edi
add    $0x1,%r13
call   1060 <isspace@plt>
test   %rax,%rax
jne    1170 <parse_line+0x30>
mov    %r12,%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1238 <parse_line+0xf8>
mov    %rax,%r12
movzbl -0x1(%rax),%edi
call   1060 <isspace@plt>
test   %rax,%rax
je     11d5 <parse_line+0x95>
mov    %r12,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
movzbl -0x1(%rbx),%edi
add    $0xffffffffffffffff,%rbx
call   1060 <isspace@plt>
test   %rax,%rax
jne    11c0 <parse_line+0x80>
movb   $0x0,(%r12)
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%r12),%edi
add    $0x1,%r12
call   1060 <isspace@plt>
test   %rax,%rax
jne    11e0 <parse_line+0xa0>
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
lea    (%r12,%rax,1),%rbx
add    $0xffffffffffffffff,%rbx
jmp    1217 <parse_line+0xd7>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
add    $0xffffffffffffffff,%rbx
movzbl (%rbx),%eax
cmp    $0xa,%al
je     1210 <parse_line+0xd0>
movzbl %al,%edi
call   1060 <isspace@plt>
test   %rax,%rax
jne    1210 <parse_line+0xd0>
mov    %r13,(%r15)
mov    %r12,(%r14)
mov    $0x1,%eax
jmp    123a <parse_line+0xfa>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @parse_line(i8** %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i8** %0, i8*** %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %8
store i8* %17, i8** %10
br label %18
18: ; preds = %23, %4
%19 = load i8*, i8** %10
%20 = load i8, i8* %19
%21 = call i64 @isspace(i8 zeroext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %10
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %10
br label %18
26: ; preds = %18
%27 = load i8*, i8** %8
%28 = call i8* @strchr(i8* %27, i8 signext 61)
store i8* %28, i8** %12
%29 = load i8*, i8** %12
%30 = icmp ne i8* %29, null
br i1 %30, label %32, label %31
31: ; preds = %26
store i32 0, i32* %5
br label %82
32: ; preds = %26
%33 = load i8*, i8** %12
%34 = getelementptr inbounds i8, i8* %33, i64 -1
store i8* %34, i8** %13
br label %35
35: ; preds = %40, %32
%36 = load i8*, i8** %13
%37 = load i8, i8* %36
%38 = call i64 @isspace(i8 zeroext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i8*, i8** %13
%42 = getelementptr inbounds i8, i8* %41, i32 -1
store i8* %42, i8** %13
store i8 0, i8* %41
br label %35
43: ; preds = %35
%44 = load i8*, i8** %12
store i8 0, i8* %44
%45 = load i8*, i8** %12
%46 = getelementptr inbounds i8, i8* %45, i64 1
store i8* %46, i8** %11
br label %47
47: ; preds = %52, %43
%48 = load i8*, i8** %11
%49 = load i8, i8* %48
%50 = call i64 @isspace(i8 zeroext %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %47
%53 = load i8*, i8** %11
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %11
br label %47
55: ; preds = %47
%56 = load i8*, i8** %11
%57 = load i8*, i8** %11
%58 = call i32 @strlen(i8* %57)
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
%61 = getelementptr inbounds i8, i8* %60, i64 -1
store i8* %61, i8** %12
br label %62
62: ; preds = %74, %55
%63 = load i8*, i8** %12
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 10
br i1 %66, label %72, label %67
67: ; preds = %62
%68 = load i8*, i8** %12
%69 = load i8, i8* %68
%70 = call i64 @isspace(i8 zeroext %69)
%71 = icmp ne i64 %70, 0
br label %72
72: ; preds = %67, %62
%73 = phi i1 [ true, %62 ], [ %71, %67 ]
br i1 %73, label %74, label %77
74: ; preds = %72
%75 = load i8*, i8** %12
%76 = getelementptr inbounds i8, i8* %75, i32 -1
store i8* %76, i8** %12
store i8 0, i8* %75
br label %62
77: ; preds = %72
%78 = load i8*, i8** %10
%79 = load i8**, i8*** %6
store i8* %78, i8** %79
%80 = load i8*, i8** %11
%81 = load i8**, i8*** %7
store i8* %80, i8** %81
store i32 1, i32* %5
br label %82
82: ; preds = %77, %31
%83 = load i32, i32* %5
ret i32 %83
}

LLVM IR (-O2):
define i32 @parse_line(i8** nocapture writeonly %0, i8** nocapture writeonly %1, i8* %2, i8* %3) {
%5 = tail call i32 @strcpy(i8* %2, i8* %3)
br label %6
6: ; preds = %6, %4
%7 = phi i8* [ %2, %4 ], [ %11, %6 ]
%8 = load i8, i8* %7
%9 = tail call i64 @isspace(i8 zeroext %8)
%10 = icmp eq i64 %9, 0
%11 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 61)
%14 = icmp eq i8* %13, null
br i1 %14, label %47, label %15
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %13, i64 -1
%17 = load i8, i8* %16
%18 = tail call i64 @isspace(i8 zeroext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %15, %20
%21 = phi i8* [ %22, %20 ], [ %16, %15 ]
store i8 0, i8* %21
%22 = getelementptr inbounds i8, i8* %21, i64 -1
%23 = load i8, i8* %22
%24 = tail call i64 @isspace(i8 zeroext %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %20
26: ; preds = %20, %15
store i8 0, i8* %13
br label %27
27: ; preds = %27, %26
%28 = phi i8* [ %13, %26 ], [ %29, %27 ]
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = tail call i64 @isspace(i8 zeroext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %27
33: ; preds = %27
%34 = tail call i32 @strlen(i8* %29)
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %29, i64 %35
br label %37
37: ; preds = %45, %33
%38 = phi i8* [ %36, %33 ], [ %39, %45 ]
%39 = getelementptr inbounds i8, i8* %38, i64 -1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 10
br i1 %41, label %45, label %42
42: ; preds = %37
%43 = tail call i64 @isspace(i8 zeroext %40)
%44 = icmp eq i64 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %37, %42
store i8 0, i8* %39
br label %37
46: ; preds = %42
store i8* %7, i8** %0
store i8* %29, i8** %1
br label %47
47: ; preds = %12, %46
%48 = phi i32 [ 1, %46 ], [ 0, %12 ]
ret i32 %48
}