#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 */
struct fio_option {
  int dummy;
};

/* Variables and functions */
struct fio_option *find_option(struct fio_option *, char const *);
char *strchr(char const *, char);
int /*<<< orphan*/ strip_blank_end(char *);
struct fio_option *get_option(const char *opt, struct fio_option *options,
                              char **post) {
  struct fio_option *o;
  char *ret;
  ret = strchr(opt, '=');
  if (ret) {
    *post = ret;
    *ret = '\0';
    ret = (char *)opt;
    (*post)++;
    strip_blank_end(ret);
    o = find_option(options, ret);
  } else {
    o = find_option(options, opt);
    *post = NULL;
  }
  return o;
}


x86 assembly (clang, -O0):
<get_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11a8 <get_option+0x78>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
call   1050 <strip_blank_end@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <find_option@plt>
mov    %rax,-0x20(%rbp)
jmp    11c4 <get_option+0x94>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <find_option@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_option>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     116f <get_option+0x3f>
mov    %rax,(%r14)
movb   $0x0,(%rax)
addq   $0x1,(%r14)
mov    %rbx,%rdi
call   1050 <strip_blank_end@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <find_option@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <find_option@plt>
movq   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.fio_option = type { i32 }
define %struct.fio_option* @get_option(i8* %0, %struct.fio_option* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca %struct.fio_option*
%6 = alloca i8**
%7 = alloca %struct.fio_option*
%8 = alloca i8*
store i8* %0, i8** %4
store %struct.fio_option* %1, %struct.fio_option** %5
store i8** %2, i8*** %6
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 61)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %26
13: ; preds = %3
%14 = load i8*, i8** %8
%15 = load i8**, i8*** %6
store i8* %14, i8** %15
%16 = load i8*, i8** %8
store i8 0, i8* %16
%17 = load i8*, i8** %4
store i8* %17, i8** %8
%18 = load i8**, i8*** %6
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %18
%21 = load i8*, i8** %8
%22 = call i32 @strip_blank_end(i8* %21)
%23 = load %struct.fio_option*, %struct.fio_option** %5
%24 = load i8*, i8** %8
%25 = call %struct.fio_option* @find_option(%struct.fio_option* %23, i8* %24)
store %struct.fio_option* %25, %struct.fio_option** %7
br label %31
26: ; preds = %3
%27 = load %struct.fio_option*, %struct.fio_option** %5
%28 = load i8*, i8** %4
%29 = call %struct.fio_option* @find_option(%struct.fio_option* %27, i8* %28)
store %struct.fio_option* %29, %struct.fio_option** %7
%30 = load i8**, i8*** %6
store i8* null, i8** %30
br label %31
31: ; preds = %26, %13
%32 = load %struct.fio_option*, %struct.fio_option** %7
ret %struct.fio_option* %32
}

LLVM IR (-O2):
%struct.fio_option = type { i32 }
define %struct.fio_option* @get_option(i8* %0, %struct.fio_option* %1, i8** nocapture %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3
store i8* %4, i8** %2
store i8 0, i8* %4
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %2
%9 = tail call i32 @strip_blank_end(i8* %0)
%10 = tail call %struct.fio_option* @find_option(%struct.fio_option* %1, i8* %0)
br label %13
11: ; preds = %3
%12 = tail call %struct.fio_option* @find_option(%struct.fio_option* %1, i8* %0)
store i8* null, i8** %2
br label %13
13: ; preds = %11, %6
%14 = phi %struct.fio_option* [ %10, %6 ], [ %12, %11 ]
ret %struct.fio_option* %14
}