#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 StoreNumVar(char const *, double *, double *);
int Variable(char const *, int);
int SetIgorFloatingVar(const char *numVarName, const double *valuePtr,
                       int forceGlobal) {
  int varType;
  double d1, d2;
  int result = 0;
  d1 = *valuePtr;
  d2 = 0.0;
  if (StoreNumVar(numVarName, &d1, &d2) == -1) {
    varType = 4;
    if (forceGlobal)
      varType |= 0x4000;
    if (result = Variable(numVarName, varType))
      return result;
    StoreNumVar(numVarName, &d1, &d2);
  }
  return result;
}


x86 assembly (clang, -O0):
<SetIgorFloatingVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <StoreNumVar@plt>
cmp    $0xffffffff,%eax
jne    11b9 <SetIgorFloatingVar+0x99>
movl   $0x4,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1185 <SetIgorFloatingVar+0x65>
mov    -0x20(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <Variable@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
je     11a8 <SetIgorFloatingVar+0x88>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <SetIgorFloatingVar+0x9f>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <StoreNumVar@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetIgorFloatingVar>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rdi,%rbx
movsd  (%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <StoreNumVar@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    1184 <SetIgorFloatingVar+0x64>
xor    %esi,%esi
test   %ebp,%ebp
setne  %sil
shl    $0xe,%esi
or     $0x4,%esi
mov    %rbx,%rdi
call   1030 <Variable@plt>
test   %eax,%eax
jne    1184 <SetIgorFloatingVar+0x64>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <StoreNumVar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SetIgorFloatingVar(i8* %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca i32
store i8* %0, i8** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 0, i32* %11
%12 = load double*, double** %6
%13 = load double, double* %12
store double %13, double* %9
store double 0.000000e+00, double* %10
%14 = load i8*, i8** %5
%15 = call i32 @StoreNumVar(i8* %14, double* %9, double* %10)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %33
17: ; preds = %3
store i32 4, i32* %8
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %8
%22 = or i32 %21, 16384
store i32 %22, i32* %8
br label %23
23: ; preds = %20, %17
%24 = load i8*, i8** %5
%25 = load i32, i32* %8
%26 = call i32 @Variable(i8* %24, i32 %25)
store i32 %26, i32* %11
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = load i32, i32* %11
store i32 %29, i32* %4
br label %35
30: ; preds = %23
%31 = load i8*, i8** %5
%32 = call i32 @StoreNumVar(i8* %31, double* %9, double* %10)
br label %33
33: ; preds = %30, %3
%34 = load i32, i32* %11
store i32 %34, i32* %4
br label %35
35: ; preds = %33, %28
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @SetIgorFloatingVar(i8* %0, double* nocapture %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %4 to i8*
%7 = bitcast double* %5 to i8*
%8 = load double, double* %1
store double %8, double* %4
store double 0.000000e+00, double* %5
%9 = call i32 @StoreNumVar(i8* %0, double* %4, double* %5)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %18
11: ; preds = %3
%12 = icmp eq i32 %2, 0
%13 = select i1 %12, i32 4, i32 16388
%14 = call i32 @Variable(i8* %0, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @StoreNumVar(i8* %0, double* %4, double* %5)
br label %18
18: ; preds = %3, %16, %11
%19 = phi i32 [ %14, %11 ], [ 0, %16 ], [ 0, %3 ]
ret i32 %19
}