#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*/ addenv(char *, void *);
char *getdef_str(char *);
char *getenv(char *);
void init_env(void) {
  char *cp, *tmp;
  if ((tmp = getenv("LANG"))) {
    addenv("LANG", tmp);
  }
  if ((tmp = getenv("TZ"))) {
    addenv("TZ", tmp);
  }
  if ((tmp = getenv("HZ"))) {
    addenv("HZ", tmp);
  } else if ((cp = getdef_str("ENV_HZ"))) {
    addenv(cp, ((void *)0));
  }
}


x86 assembly (clang, -O0):
<init_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1162 <init_env+0x32>
mov    -0x10(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1040 <addenv@plt>
lea    0xe9c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     118c <init_env+0x5c>
mov    -0x10(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1040 <addenv@plt>
lea    0xe79(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11bb <init_env+0x8b>
mov    -0x10(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1040 <addenv@plt>
jmp    11e7 <init_env+0xb7>
lea    0xe46(%rip),%rdi
call   1050 <getdef_str@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     11e2 <init_env+0xb2>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <addenv@plt>
jmp    11e7 <init_env+0xb7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_env>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1151 <init_env+0x21>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1040 <addenv@plt>
lea    0xead(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1171 <init_env+0x41>
lea    0xe9c(%rip),%rdi
mov    %rax,%rsi
call   1040 <addenv@plt>
lea    0xe94(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1192 <init_env+0x62>
lea    0xe83(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1040 <addenv@plt>
lea    0xe6f(%rip),%rdi
call   1050 <getdef_str@plt>
test   %rax,%rax
je     11ae <init_env+0x7e>
mov    %rax,%rdi
xor    %esi,%esi
pop    %rax
jmp    1040 <addenv@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"LANG\00"
@.str.1 = [3 x i8] c"TZ\00"
@.str.2 = [3 x i8] c"HZ\00"
@.str.3 = [7 x i8] c"ENV_HZ\00"
define void @init_env() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i8*, i8** %2
%7 = call i32 @addenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %0
%9 = call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %9, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = call i32 @addenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %8
%15 = call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %15, i8** %2
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %2
%19 = call i32 @addenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %27
20: ; preds = %14
%21 = call i8* @getdef_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i8* %21, i8** %1
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i8*, i8** %1
%25 = call i32 @addenv(i8* %24, i8* null)
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %17
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"LANG\00"
@.str.1 = [3 x i8] c"TZ\00"
@.str.2 = [3 x i8] c"HZ\00"
@.str.3 = [7 x i8] c"ENV_HZ\00"
define void @init_env() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @addenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %5
5: ; preds = %3, %0
%6 = tail call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @addenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %10
10: ; preds = %8, %5
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @addenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %20
15: ; preds = %10
%16 = tail call i8* @getdef_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @addenv(i8* %16, i8* null)
br label %20
20: ; preds = %15, %18, %13
ret void
}