#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 const *, double const *);
int Variable(char const *, int);
int SetIgorComplexVar(const char *numVarName, const double *realValuePtr,
                      const double *imagValuePtr, int forceGlobal) {
  int varType;
  int result = 0;
  if (StoreNumVar(numVarName, realValuePtr, imagValuePtr) == -1) {
    varType = 4 | 1;
    if (forceGlobal)
      varType |= 0x4000;
    if (result = Variable(numVarName, varType))
      return result;
    StoreNumVar(numVarName, realValuePtr, imagValuePtr);
  }
  return result;
}


x86 assembly (clang, -O0):
<SetIgorComplexVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <StoreNumVar@plt>
cmp    $0xffffffff,%eax
jne    11a8 <SetIgorComplexVar+0x88>
movl   $0x5,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1174 <SetIgorComplexVar+0x54>
mov    -0x28(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1030 <Variable@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
je     1197 <SetIgorComplexVar+0x77>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <SetIgorComplexVar+0x8e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <StoreNumVar@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetIgorComplexVar>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <StoreNumVar@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    116a <SetIgorComplexVar+0x4a>
xor    %esi,%esi
test   %ebp,%ebp
setne  %sil
shl    $0xe,%esi
or     $0x5,%esi
mov    %rbx,%rdi
call   1030 <Variable@plt>
test   %eax,%eax
jne    116a <SetIgorComplexVar+0x4a>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <StoreNumVar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SetIgorComplexVar(i8* %0, double* %1, double* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store double* %1, double** %7
store double* %2, double** %8
store i32 %3, i32* %9
store i32 0, i32* %11
%12 = load i8*, i8** %6
%13 = load double*, double** %7
%14 = load double*, double** %8
%15 = call i32 @StoreNumVar(i8* %12, double* %13, double* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %35
17: ; preds = %4
store i32 5, i32* %10
%18 = load i32, i32* %9
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %10
%22 = or i32 %21, 16384
store i32 %22, i32* %10
br label %23
23: ; preds = %20, %17
%24 = load i8*, i8** %6
%25 = load i32, i32* %10
%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* %5
br label %37
30: ; preds = %23
%31 = load i8*, i8** %6
%32 = load double*, double** %7
%33 = load double*, double** %8
%34 = call i32 @StoreNumVar(i8* %31, double* %32, double* %33)
br label %35
35: ; preds = %30, %4
%36 = load i32, i32* %11
store i32 %36, i32* %5
br label %37
37: ; preds = %35, %28
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
define i32 @SetIgorComplexVar(i8* %0, double* %1, double* %2, i32 %3) {
%5 = tail call i32 @StoreNumVar(i8* %0, double* %1, double* %2)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = icmp eq i32 %3, 0
%9 = select i1 %8, i32 5, i32 16389
%10 = tail call i32 @Variable(i8* %0, i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @StoreNumVar(i8* %0, double* %1, double* %2)
br label %14
14: ; preds = %4, %12, %7
%15 = phi i32 [ %10, %7 ], [ 0, %12 ], [ 0, %4 ]
ret i32 %15
}