#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 /*<<< orphan*/ strcmp(char const *, char *);
int is_verbose(void) {
  static int v = -1;
  if (v < 0) {
    const char *e = getenv("VERBOSE");
    if (e && !strcmp(e, "yes"))
      v = 1;
    else
      v = 0;
  }
  return v;
}


x86 assembly (clang, -O0):
<is_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f01(%rip)
jge    1187 <is_verbose+0x67>
lea    0xec4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1178 <is_verbose+0x58>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1178 <is_verbose+0x58>
movl   $0x1,0x2ebd(%rip)
jmp    1182 <is_verbose+0x62>
movl   $0x0,0x2eae(%rip)
jmp    1187 <is_verbose+0x67>
mov    0x2ea3(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_verbose>:
push   %rax
mov    0x2f09(%rip),%eax
test   %eax,%eax
js     112d <is_verbose+0xd>
pop    %rcx
ret
lea    0xecc(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1151 <is_verbose+0x31>
lea    0xec3(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1155 <is_verbose+0x35>
xor    %eax,%eax
jmp    115a <is_verbose+0x3a>
mov    $0x1,%eax
mov    %eax,0x2ed0(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@is_verbose.v = internal global i32 -1
@.str = [8 x i8] c"VERBOSE\00"
@.str.1 = [4 x i8] c"yes\00"
define i32 @is_verbose() {
%1 = alloca i8*
%2 = load i32, i32* @is_verbose.v
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %0
%5 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i8*, i8** %1
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
store i32 1, i32* @is_verbose.v
br label %14
13: ; preds = %8, %4
store i32 0, i32* @is_verbose.v
br label %14
14: ; preds = %13, %12
br label %15
15: ; preds = %14, %0
%16 = load i32, i32* @is_verbose.v
ret i32 %16
}

LLVM IR (-O2):
@is_verbose.v = internal unnamed_addr global i32 -1
@.str = [8 x i8] c"VERBOSE\00"
@.str.1 = [4 x i8] c"yes\00"
define i32 @is_verbose() {
%1 = load i32, i32* @is_verbose.v
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %6, %3
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 0, %9 ], [ 1, %6 ]
store i32 %11, i32* @is_verbose.v
br label %12
12: ; preds = %10, %0
%13 = phi i32 [ %11, %10 ], [ %1, %0 ]
ret i32 %13
}