#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 plugin_option {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ die(char *);
struct plugin_option *find_registered_option(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ parse_option_name(char **, char **);
char *strdup(char const *);
struct plugin_option *find_registered_option_parse(const char *name) {
  struct plugin_option *option;
  char *option_str;
  char *plugin;
  option_str = strdup(name);
  if (!option_str)
    die("malloc");
  parse_option_name(&option_str, &plugin);
  option = find_registered_option(plugin, option_str);
  free(option_str);
  free(plugin);
  return option;
}


x86 assembly (clang, -O0):
<find_registered_option_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <find_registered_option_parse+0x30>
lea    0xe85(%rip),%rdi
call   1050 <die@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <parse_option_name@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <find_registered_option@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_registered_option_parse>:
push   %rbx
sub    $0x10,%rsp
call   1060 <strdup@plt>
mov    %rax,(%rsp)
test   %rax,%rax
jne    116f <find_registered_option_parse+0x1f>
lea    0xe96(%rip),%rdi
call   1050 <die@plt>
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1040 <parse_option_name@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1070 <find_registered_option@plt>
mov    %rax,%rbx
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.plugin_option = type { i32 }
@.str = [7 x i8] c"malloc\00"
define %struct.plugin_option* @find_registered_option_parse(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.plugin_option*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @die(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = call i32 @parse_option_name(i8** %4, i8** %5)
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = call %struct.plugin_option* @find_registered_option(i8* %14, i8* %15)
store %struct.plugin_option* %16, %struct.plugin_option** %3
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
%21 = load %struct.plugin_option*, %struct.plugin_option** %3
ret %struct.plugin_option* %21
}

LLVM IR (-O2):
%struct.plugin_option = type { i32 }
@.str = [7 x i8] c"malloc\00"
define %struct.plugin_option* @find_registered_option_parse(i8* nocapture %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
%5 = bitcast i8** %3 to i8*
%6 = tail call i8* @strdup(i8* %0)
store i8* %6, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @die(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = call i32 @parse_option_name(i8** %2, i8** %3)
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call %struct.plugin_option* @find_registered_option(i8* %12, i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 @free(i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
ret %struct.plugin_option* %14
}