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


x86 assembly (clang, -O0):
<par_geti_def>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <par_exist@plt>
cmp    $0x0,%rax
je     118c <par_geti_def+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <par_getsl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <par_geti_def+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
lea    0xe62(%rip),%rdx
lea    0xe5e(%rip),%r8
call   1050 <par_seti@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_geti_def>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <par_exist@plt>
test   %rax,%rax
je     116e <par_geti_def+0x2e>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <par_getsl@plt>
mov    %rax,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <atoi@plt>
lea    0xe8b(%rip),%rdx
lea    0xe87(%rip),%r8
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%ecx
call   1050 <par_seti@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"Default Value\00"
define i32 @par_geti_def(i8* %0, i8* %1, i32 %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 i32 @atoi(i8* %7)
br label %11
9: ; preds = %3
%10 = tail call i32 @par_seti(i8* %0, i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %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 i32 [ %8, %6 ], [ %2, %9 ]
ret i32 %12
}