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


x86 assembly (clang, -O0):
<SHADOWY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2f0d(%rip)
jne    1193 <SHADOWY+0x73>
lea    0xec4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <SHADOWY+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 <SHADOWY+0x69>
cmpl   $0x1,-0x4(%rbp)
jne    1189 <SHADOWY+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):
<SHADOWY>:
push   %rax
cmpb   $0x0,0x2f14(%rip)
jne    1166 <SHADOWY+0x46>
lea    0xecf(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     115f <SHADOWY+0x3f>
lea    0xec6(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    115f <SHADOWY+0x3f>
movsd  (%rsp),%xmm0
movsd  %xmm0,0x2ed1(%rip)
movb   $0x1,0x2ed6(%rip)
movsd  0x2ec2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@SHADOWY.smapa_known_SHADOWY = internal global i32 0
@SHADOWY.smapa_value_SHADOWY = internal global double 1.000000e+00
@.str = [8 x i8] c"SHADOWY\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @SHADOWY() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca double
%4 = load i32, i32* @SHADOWY.smapa_known_SHADOWY
%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* @SHADOWY.smapa_value_SHADOWY
br label %21
21: ; preds = %19, %16, %13
store i32 1, i32* @SHADOWY.smapa_known_SHADOWY
br label %22
22: ; preds = %21, %0
%23 = load double, double* @SHADOWY.smapa_value_SHADOWY
ret double %23
}

LLVM IR (-O2):
@SHADOWY.smapa_known_SHADOWY = internal unnamed_addr global i1 false
@SHADOWY.smapa_value_SHADOWY = internal unnamed_addr global double 1.000000e+00
@.str = [8 x i8] c"SHADOWY\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @SHADOWY() {
%1 = alloca double
%2 = load i1, i1* @SHADOWY.smapa_known_SHADOWY
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* @SHADOWY.smapa_value_SHADOWY
br label %12
12: ; preds = %3, %10, %7
store i1 true, i1* @SHADOWY.smapa_known_SHADOWY
br label %13
13: ; preds = %12, %0
%14 = load double, double* @SHADOWY.smapa_value_SHADOWY
ret double %14
}