#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*/ free(char *);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
int m_conf_string(char *ope, char *opestr, char *val, char **val_r) {
  if (strcmp(ope, opestr) == 0) {
    if (*val_r)
      free(*val_r);
    if (val[0])
      *val_r = strdup(val);
    else
      *val_r = NULL;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<m_conf_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b5 <m_conf_string+0x85>
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     1179 <m_conf_string+0x49>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     119e <m_conf_string+0x6e>
mov    -0x20(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
jmp    11a9 <m_conf_string+0x79>
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11bc <m_conf_string+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_conf_string>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    116f <m_conf_string+0x3f>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1156 <m_conf_string+0x26>
call   1030 <free@plt>
cmpb   $0x0,(%rbx)
je     1165 <m_conf_string+0x35>
mov    %rbx,%rdi
call   1050 <strdup@plt>
jmp    1167 <m_conf_string+0x37>
xor    %eax,%eax
mov    %rax,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @m_conf_string(i8* %0, i8* %1, i8* %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8**
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8** %3, i8*** %9
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %34
14: ; preds = %4
%15 = load i8**, i8*** %9
%16 = load i8*, i8** %15
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8**, i8*** %9
%20 = load i8*, i8** %19
%21 = call i32 @free(i8* %20)
br label %22
22: ; preds = %18, %14
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i8*, i8** %8
%29 = call i8* @strdup(i8* %28)
%30 = load i8**, i8*** %9
store i8* %29, i8** %30
br label %33
31: ; preds = %22
%32 = load i8**, i8*** %9
store i8* null, i8** %32
br label %33
33: ; preds = %31, %27
store i32 1, i32* %5
br label %35
34: ; preds = %4
store i32 0, i32* %5
br label %35
35: ; preds = %34, %33
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
define i32 @m_conf_string(i8* %0, i8* %1, i8* nocapture %2, i8** nocapture %3) {
%5 = tail call i64 @strcmp(i8* %0, i8* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @free(i8* %8)
br label %12
12: ; preds = %10, %7
%13 = load i8, i8* %2
%14 = icmp eq i8 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i8* @strdup(i8* %2)
br label %17
17: ; preds = %12, %15
%18 = phi i8* [ %16, %15 ], [ null, %12 ]
store i8* %18, i8** %3
br label %19
19: ; preds = %4, %17
%20 = phi i32 [ 1, %17 ], [ 0, %4 ]
ret i32 %20
}