#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 */
char *getenv(char *);
int sscanf(char *, char *, double *);
double SHADOWZ(void) {
  static bool smapa_known_SHADOWZ = false;
  static double smapa_value_SHADOWZ = 1;
  if (!smapa_known_SHADOWZ) {
    int r;
    char *sv = getenv("SHADOWZ");
    double y;
    if (sv)
      r = sscanf(sv, "%lf", &y);
    if (sv && r == 1)
      smapa_value_SHADOWZ = y;
    smapa_known_SHADOWZ = true;
  }
  return smapa_value_SHADOWZ;
}


x86 assembly (clang, -O0):
<SHADOWZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2f0d(%rip)
jne    1193 <SHADOWZ+0x73>
lea    0xec4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <SHADOWZ+0x47>
mov    -0x10(%rbp),%rdi
lea    0xead(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
mov    %eax,-0x4(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1189 <SHADOWZ+0x69>
cmpl   $0x1,-0x4(%rbp)
jne    1189 <SHADOWZ+0x69>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,0x2ea7(%rip)
movl   $0x1,0x2ea9(%rip)
movsd  0x2e95(%rip),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHADOWZ>:
push   %rax
cmpb   $0x0,0x2f14(%rip)
jne    1166 <SHADOWZ+0x46>
lea    0xecf(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     115f <SHADOWZ+0x3f>
lea    0xec6(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    115f <SHADOWZ+0x3f>
movsd  (%rsp),%xmm0
movsd  %xmm0,0x2ed1(%rip)
movb   $0x1,0x2ed6(%rip)
movsd  0x2ec2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@SHADOWZ.smapa_known_SHADOWZ = internal global i32 0
@SHADOWZ.smapa_value_SHADOWZ = internal global double 1.000000e+00
@.str = [8 x i8] c"SHADOWZ\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @SHADOWZ() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca double
%4 = load i32, i32* @SHADOWZ.smapa_known_SHADOWZ
%5 = icmp ne i32 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %0
%7 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
store i32 %12, i32* %1
br label %13
13: ; preds = %10, %6
%14 = load i8*, i8** %2
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = load double, double* %3
store double %20, double* @SHADOWZ.smapa_value_SHADOWZ
br label %21
21: ; preds = %19, %16, %13
store i32 1, i32* @SHADOWZ.smapa_known_SHADOWZ
br label %22
22: ; preds = %21, %0
%23 = load double, double* @SHADOWZ.smapa_value_SHADOWZ
ret double %23
}

LLVM IR (-O2):
@SHADOWZ.smapa_known_SHADOWZ = internal unnamed_addr global i1 false
@SHADOWZ.smapa_value_SHADOWZ = internal unnamed_addr global double 1.000000e+00
@.str = [8 x i8] c"SHADOWZ\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @SHADOWZ() {
%1 = alloca double
%2 = load i1, i1* @SHADOWZ.smapa_known_SHADOWZ
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = bitcast double* %1 to i8*
%6 = icmp eq i8* %4, null
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = load double, double* %1
store double %11, double* @SHADOWZ.smapa_value_SHADOWZ
br label %12
12: ; preds = %3, %10, %7
store i1 true, i1* @SHADOWZ.smapa_known_SHADOWZ
br label %13
13: ; preds = %12, %0
%14 = load double, double* @SHADOWZ.smapa_value_SHADOWZ
ret double %14
}