#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 */
int /*<<< orphan*/ get_env_util(char **, char *);
int /*<<< orphan*/ *getenv(char *);
const char *get_log_prefix_envvar(void) {
  char *log_prefix_envvar = NULL;
  if (getenv("CLARMOR_LOG_PREFIX") != NULL) {
    if (!get_env_util(&log_prefix_envvar, "CLARMOR_LOG_PREFIX")) {
      if (log_prefix_envvar != NULL)
        return log_prefix_envvar;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_log_prefix_envvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1181 <get_log_prefix_envvar+0x61>
lea    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <get_env_util@plt>
cmp    $0x0,%eax
jne    117c <get_log_prefix_envvar+0x5c>
cmpq   $0x0,-0x10(%rbp)
je     1177 <get_log_prefix_envvar+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <get_log_prefix_envvar+0x69>
jmp    117c <get_log_prefix_envvar+0x5c>
jmp    1181 <get_log_prefix_envvar+0x61>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_log_prefix_envvar>:
push   %rax
movq   $0x0,(%rsp)
lea    0xed0(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1158 <get_log_prefix_envvar+0x38>
lea    0xebf(%rip),%rsi
mov    %rsp,%rdi
call   1040 <get_env_util@plt>
test   %eax,%eax
jne    1158 <get_log_prefix_envvar+0x38>
mov    (%rsp),%rax
test   %rax,%rax
je     1158 <get_log_prefix_envvar+0x38>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"CLARMOR_LOG_PREFIX\00"
define i8* @get_log_prefix_envvar() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = tail call i32* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %11, label %5
5: ; preds = %0
%6 = call i32 @get_env_util(i8** %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
%8 = load i8*, i8** %1
%9 = icmp ne i8* %8, null
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %12, label %11
11: ; preds = %5, %0
br label %12
12: ; preds = %5, %11
%13 = phi i8* [ null, %11 ], [ %8, %5 ]
ret i8* %13
}