#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 scripting_GetFloatResult(float *);
int /*<<< orphan*/ scripting_GetValue(char const *);
int /*<<< orphan*/ scripting_IsNil();
int /*<<< orphan*/ scripting_Pop();
int scripting_GetOptional_Float(const char *name, float *f, float fValue) {
  int retValue = 0;
  scripting_GetValue(name);
  if (!scripting_IsNil()) {
    retValue = scripting_GetFloatResult(f);
  } else {
    *f = fValue;
    scripting_Pop();
  }
  return retValue;
}


x86 assembly (clang, -O0):
<scripting_GetOptional_Float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <scripting_GetValue@plt>
mov    $0x0,%al
call   1040 <scripting_IsNil@plt>
cmp    $0x0,%eax
jne    1186 <scripting_GetOptional_Float+0x46>
mov    -0x10(%rbp),%rdi
call   1030 <scripting_GetFloatResult@plt>
mov    %eax,-0x18(%rbp)
jmp    119a <scripting_GetOptional_Float+0x5a>
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    $0x0,%al
call   1050 <scripting_Pop@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scripting_GetOptional_Float>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rsi,%rbx
call   1060 <scripting_GetValue@plt>
xor    %eax,%eax
call   1040 <scripting_IsNil@plt>
test   %eax,%eax
je     1177 <scripting_GetOptional_Float+0x37>
movss  0xc(%rsp),%xmm0
movss  %xmm0,(%rbx)
xor    %eax,%eax
call   1050 <scripting_Pop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <scripting_GetFloatResult@plt>

LLVM IR (-O0):
define i32 @scripting_GetOptional_Float(i8* %0, float* %1, float %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca float
%7 = alloca i32
store i8* %0, i8** %4
store float* %1, float** %5
store float %2, float* %6
store i32 0, i32* %7
%8 = load i8*, i8** %4
%9 = call i32 @scripting_GetValue(i8* %8)
%10 = call i32 (...) @scripting_IsNil()
%11 = icmp ne i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load float*, float** %5
%14 = call i32 @scripting_GetFloatResult(float* %13)
store i32 %14, i32* %7
br label %19
15: ; preds = %3
%16 = load float, float* %6
%17 = load float*, float** %5
store float %16, float* %17
%18 = call i32 (...) @scripting_Pop()
br label %19
19: ; preds = %15, %12
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @scripting_GetOptional_Float(i8* %0, float* %1, float %2) {
%4 = tail call i32 @scripting_GetValue(i8* %0)
%5 = tail call i32 (...) @scripting_IsNil()
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @scripting_GetFloatResult(float* %1)
br label %11
9: ; preds = %3
store float %2, float* %1
%10 = tail call i32 (...) @scripting_Pop()
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ 0, %9 ], [ %8, %7 ]
ret i32 %12
}