#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 *);
scalar_t__ strcmp(char *, char *);
int should_report_leaks(void) {
  char *mem_debug_env = getenv("OPENSSL_DEBUG_MEMORY");
  return mem_debug_env == NULL ||
         (strcmp(mem_debug_env, "0") && strcmp(mem_debug_env, ""));
}


x86 assembly (clang, -O0):
<should_report_leaks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     118a <should_report_leaks+0x6a>
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
je     1184 <should_report_leaks+0x64>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<should_report_leaks>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1165 <should_report_leaks+0x45>
mov    %rax,%rbx
lea    0xed9(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     116c <should_report_leaks+0x4c>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"OPENSSL_DEBUG_MEMORY\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @should_report_leaks() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i8*, i8** %1
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %9, %5
%14 = phi i1 [ false, %5 ], [ %12, %9 ]
br label %15
15: ; preds = %13, %0
%16 = phi i1 [ true, %0 ], [ %14, %13 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
@.str = [21 x i8] c"OPENSSL_DEBUG_MEMORY\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @should_report_leaks() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %10, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %3, %6, %0
%11 = phi i32 [ 1, %0 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %11
}