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


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

LLVM IR (-O0):
@LINN.smapa_known_LINN = internal global i32 0
@LINN.smapa_value_LINN = internal global double 7.000000e+01
@.str = [5 x i8] c"LINN\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @LINN() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca double
%4 = load i32, i32* @LINN.smapa_known_LINN
%5 = icmp ne i32 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %0
%7 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 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* @LINN.smapa_value_LINN
br label %21
21: ; preds = %19, %16, %13
store i32 1, i32* @LINN.smapa_known_LINN
br label %22
22: ; preds = %21, %0
%23 = load double, double* @LINN.smapa_value_LINN
ret double %23
}

LLVM IR (-O2):
@LINN.smapa_known_LINN = internal unnamed_addr global i1 false
@LINN.smapa_value_LINN = internal unnamed_addr global double 7.000000e+01
@.str = [5 x i8] c"LINN\00"
@.str.1 = [4 x i8] c"%lf\00"
define double @LINN() {
%1 = alloca double
%2 = load i1, i1* @LINN.smapa_known_LINN
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 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* @LINN.smapa_value_LINN
br label %12
12: ; preds = %3, %10, %7
store i1 true, i1* @LINN.smapa_known_LINN
br label %13
13: ; preds = %12, %0
%14 = load double, double* @LINN.smapa_value_LINN
ret double %14
}