#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
char *getenv(char *);
int /*<<< orphan*/ stderr;
unsigned GetBreakGenerationEnv(void) {
  static char *breakGenerationEnv = (char *)-1;
  static unsigned result = 0;
  if (breakGenerationEnv == (char *)-1) {
    breakGenerationEnv = getenv("BREAK_GENERATION");
    if (breakGenerationEnv != NULL) {
      result = atoi(breakGenerationEnv);
      fprintf(stderr,
              "<MALLOC_DEBUG>\t"
              "Using environment variable BREAK_GENERATION=%d\n",
              result);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<GetBreakGenerationEnv>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rax
cmp    %rax,0x2ef6(%rip)
jne    119b <GetBreakGenerationEnv+0x6b>
lea    0xeb1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,0x2edd(%rip)
cmpq   $0x0,0x2ed5(%rip)
je     1196 <GetBreakGenerationEnv+0x66>
mov    0x2ec8(%rip),%rdi
call   1050 <atoi@plt>
mov    %eax,0x2ec9(%rip)
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    0x2eba(%rip),%edx
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
jmp    119b <GetBreakGenerationEnv+0x6b>
mov    0x2ea3(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBreakGenerationEnv>:
push   %rax
cmpq   $0xffffffffffffffff,0x2eff(%rip)
ff
jne    1178 <GetBreakGenerationEnv+0x48>
lea    0xebe(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,0x2eea(%rip)
test   %rax,%rax
je     1178 <GetBreakGenerationEnv+0x48>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,0x2ee3(%rip)
mov    0x2e78(%rip),%rcx
mov    (%rcx),%edi
lea    0xea0(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    0x2ec6(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@GetBreakGenerationEnv.breakGenerationEnv = internal global i8* inttoptr (i64 -1 to i8*)
@GetBreakGenerationEnv.result = internal global i32 0
@.str = [17 x i8] c"BREAK_GENERATION\00"
@stderr = global i32 0
@.str.1 = [63 x i8] c"<MALLOC_DEBUG>\09Using environment variable BREAK_GENERATION=%d\0A\00"
define i32 @GetBreakGenerationEnv() {
%1 = load i8*, i8** @GetBreakGenerationEnv.breakGenerationEnv
%2 = icmp eq i8* %1, inttoptr (i64 -1 to i8*)
br i1 %2, label %3, label %14
3: ; preds = %0
%4 = call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** @GetBreakGenerationEnv.breakGenerationEnv
%5 = load i8*, i8** @GetBreakGenerationEnv.breakGenerationEnv
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** @GetBreakGenerationEnv.breakGenerationEnv
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* @GetBreakGenerationEnv.result
%10 = load i32, i32* @stderr
%11 = load i32, i32* @GetBreakGenerationEnv.result
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %7, %3
br label %14
14: ; preds = %13, %0
%15 = load i32, i32* @GetBreakGenerationEnv.result
ret i32 %15
}

LLVM IR (-O2):
@GetBreakGenerationEnv.breakGenerationEnv = internal unnamed_addr global i8* inttoptr (i64 -1 to i8*)
@GetBreakGenerationEnv.result = internal unnamed_addr global i32 0
@.str = [17 x i8] c"BREAK_GENERATION\00"
@stderr = global i32 0
@.str.1 = [63 x i8] c"<MALLOC_DEBUG>\09Using environment variable BREAK_GENERATION=%d\0A\00"
define i32 @GetBreakGenerationEnv() {
%1 = load i8*, i8** @GetBreakGenerationEnv.breakGenerationEnv
%2 = icmp eq i8* %1, inttoptr (i64 -1 to i8*)
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** @GetBreakGenerationEnv.breakGenerationEnv
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @atoi(i8* %4)
store i32 %7, i32* @GetBreakGenerationEnv.result
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %10
10: ; preds = %3, %6, %0
%11 = load i32, i32* @GetBreakGenerationEnv.result
ret i32 %11
}