#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 */
double atof(char *);
scalar_t__ par_exist(char *, char *);
char *par_getsl(char *, char *);
int /*<<< orphan*/ par_setd(char *, char *, char *, double, char *);
double par_getd_def(char *block, char *name, double def) {
  if (par_exist(block, name)) {
    char *pp = par_getsl(block, name);
    return atof(pp);
  }
  par_setd(block, name, "%.15e", def, "Default Value");
  return def;
}


x86 assembly (clang, -O0):
<par_getd_def>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <par_exist@plt>
cmp    $0x0,%rax
je     1190 <par_getd_def+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <par_getsl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11ba <par_getd_def+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xe5c(%rip),%rdx
lea    0xe5b(%rip),%rcx
call   1040 <par_setd@plt>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_getd_def>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <par_exist@plt>
test   %rax,%rax
je     1173 <par_getd_def+0x33>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <par_getsl@plt>
mov    %rax,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <atof@plt>
lea    0xe86(%rip),%rdx
lea    0xe85(%rip),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
call   1040 <par_setd@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.15e\00"
@.str.1 = [14 x i8] c"Default Value\00"
define double @par_getd_def(i8* %0, i8* %1, double %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca double
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store double %2, double* %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 double @atof(i8* %17)
store double %18, double* %4
br label %25
19: ; preds = %3
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load double, double* %7
%23 = call i32 @par_setd(i8* %20, i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%24 = load double, double* %7
store double %24, double* %4
br label %25
25: ; preds = %19, %13
%26 = load double, double* %4
ret double %26
}

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