#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*/ lit(char const **const, char *, int);
int /*<<< orphan*/ read_ext_value(char const **const, char **);
int /*<<< orphan*/ read_token(char const **const, char **);
int /*<<< orphan*/ read_value(char const **const, char **);
bool read_parm(char const **const src, char *const field, char *const value) {
  char *f = field;
  char *v = value;
  if (!read_token(src, &f))
    return false;
  *f = '\0';
  if (!lit(src, ("="), (sizeof("=") - 1)))
    return false;
  if ('*' == *(f - 1)) {
    if (!read_ext_value(src, &v))
      return false;
    *v = '\0';
  } else {
    if (!read_value(src, &v))
      return false;
    *v = '\0';
  }
  return true;
}


x86 assembly (clang, -O0):
<read_parm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <read_token@plt>
cmp    $0x0,%eax
jne    1186 <read_parm+0x46>
movl   $0x0,-0x4(%rbp)
jmp    122a <read_parm+0xea>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
mov    $0x1,%edx
call   1050 <lit@plt>
cmp    $0x0,%eax
jne    11b7 <read_parm+0x77>
movl   $0x0,-0x4(%rbp)
jmp    122a <read_parm+0xea>
mov    -0x28(%rbp),%rax
movsbl -0x1(%rax),%ecx
mov    $0x2a,%eax
cmp    %ecx,%eax
jne    11fa <read_parm+0xba>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <read_ext_value@plt>
cmp    $0x0,%eax
jne    11ee <read_parm+0xae>
movl   $0x0,-0x4(%rbp)
jmp    122a <read_parm+0xea>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
jmp    1223 <read_parm+0xe3>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <read_value@plt>
cmp    $0x0,%eax
jne    121c <read_parm+0xdc>
movl   $0x0,-0x4(%rbp)
jmp    122a <read_parm+0xea>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_parm>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    %rsi,0x10(%rsp)
mov    %rdx,0x8(%rsp)
lea    0x10(%rsp),%rsi
call   1040 <read_token@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11bf <read_parm+0x7f>
mov    0x10(%rsp),%rax
movb   $0x0,(%rax)
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1050 <lit@plt>
test   %eax,%eax
je     11bf <read_parm+0x7f>
mov    0x10(%rsp),%rax
cmpb   $0x2a,-0x1(%rax)
jne    11a1 <read_parm+0x61>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <read_ext_value@plt>
test   %eax,%eax
jne    11b2 <read_parm+0x72>
jmp    11bf <read_parm+0x7f>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <read_value@plt>
test   %eax,%eax
je     11bf <read_parm+0x7f>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
define i32 @read_parm(i8** %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %4 to i8*
store i8* %1, i8** %4
%7 = bitcast i8** %5 to i8*
store i8* %2, i8** %5
%8 = call i32 @read_token(i8** %0, i8** %4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %27, label %10
10: ; preds = %3
%11 = load i8*, i8** %4
store i8 0, i8* %11
%12 = call i32 @lit(i8** %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 -1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 42
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = call i32 @read_ext_value(i8** %0, i8** %5)
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %25
22: ; preds = %14
%23 = call i32 @read_value(i8** %0, i8** %5)
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22, %19
%26 = load i8*, i8** %5
store i8 0, i8* %26
br label %27
27: ; preds = %25, %22, %19, %10, %3
%28 = phi i32 [ 0, %3 ], [ 0, %10 ], [ 0, %19 ], [ 0, %22 ], [ 1, %25 ]
ret i32 %28
}