#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 */
char *my_strdup(char *);
scalar_t__ par_exist(char *, char *);
char *par_getsl(char *, char *);
int /*<<< orphan*/ par_sets(char *, char *, char *, char *);
char *par_gets_def(char *block, char *name, char *def) {
  if (par_exist(block, name)) {
    char *pp = par_getsl(block, name);
    return my_strdup(pp);
  }
  par_sets(block, name, def, "Default Value");
  return my_strdup(def);
}


x86 assembly (clang, -O0):
<par_gets_def>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <par_exist@plt>
cmp    $0x0,%rax
je     118e <par_gets_def+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <par_getsl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <my_strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11b3 <par_gets_def+0x73>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe5f(%rip),%rcx
call   1050 <par_sets@plt>
mov    -0x20(%rbp),%rdi
call   1060 <my_strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_gets_def>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <par_exist@plt>
test   %rax,%rax
je     1168 <par_gets_def+0x28>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <par_getsl@plt>
mov    %rax,%r14
jmp    117d <par_gets_def+0x3d>
lea    0xe91(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <par_sets@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <my_strdup@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Default Value\00"
define i8* @par_gets_def(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i64 @par_exist(i8* %9, i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = call i8* @par_getsl(i8* %14, i8* %15)
store i8* %16, i8** %8
%17 = load i8*, i8** %8
%18 = call i8* @my_strdup(i8* %17)
store i8* %18, i8** %4
br label %26
19: ; preds = %3
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i32 @par_sets(i8* %20, i8* %21, i8* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%24 = load i8*, i8** %7
%25 = call i8* @my_strdup(i8* %24)
store i8* %25, i8** %4
br label %26
26: ; preds = %19, %13
%27 = load i8*, i8** %4
ret i8* %27
}

LLVM IR (-O2):
@.str = [14 x i8] c"Default Value\00"
define i8* @par_gets_def(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @par_exist(i8* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i8* @par_getsl(i8* %0, i8* %1)
br label %10
8: ; preds = %3
%9 = tail call i32 @par_sets(i8* %0, i8* %1, i8* %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = phi i8* [ %2, %8 ], [ %7, %6 ]
%12 = tail call i8* @my_strdup(i8* %11)
ret i8* %12
}