#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 */
scalar_t__ clearenv();
int /*<<< orphan*/ *getenv(char *);
int /*<<< orphan*/ printf(char *, char *, int);
scalar_t__ setenv(char *, char *, int);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/ *, char *);
scalar_t__ unsetenv(char *);
int test_setenv(void) {
  unsetenv("X");
  do {
    if (!(NULL == getenv("X"))) {
      printf("expression '%s' untrue at %d\n", "NULL == getenv(\"X\")", 31);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == setenv("X", "foo", 0))) {
      printf("expression '%s' untrue at %d\n", "0 == setenv(\"X\", \"foo\", 0)",
             33);
      return 0;
    }
  } while (0);
  do {
    if (!(!strcmp(getenv("X"), "foo"))) {
      printf("expression '%s' untrue at %d\n",
             "!strcmp(getenv(\"X\"), \"foo\")", 34);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == setenv("X", "bar", 0))) {
      printf("expression '%s' untrue at %d\n", "0 == setenv(\"X\", \"bar\", 0)",
             36);
      return 0;
    }
  } while (0);
  do {
    if (!(!strcmp(getenv("X"), "foo"))) {
      printf("expression '%s' untrue at %d\n",
             "!strcmp(getenv(\"X\"), \"foo\")", 37);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == setenv("X", "bar", 1))) {
      printf("expression '%s' untrue at %d\n", "0 == setenv(\"X\", \"bar\", 1)",
             39);
      return 0;
    }
  } while (0);
  do {
    if (!(!strcmp(getenv("X"), "bar"))) {
      printf("expression '%s' untrue at %d\n",
             "!strcmp(getenv(\"X\"), \"bar\")", 40);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == unsetenv("X"))) {
      printf("expression '%s' untrue at %d\n", "0 == unsetenv(\"X\")", 42);
      return 0;
    }
  } while (0);
  do {
    if (!(NULL == getenv("X"))) {
      printf("expression '%s' untrue at %d\n", "NULL == getenv(\"X\")", 43);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == setenv("X", "bar", 1))) {
      printf("expression '%s' untrue at %d\n", "0 == setenv(\"X\", \"bar\", 1)",
             45);
      return 0;
    }
  } while (0);
  do {
    if (!(!strcmp(getenv("X"), "bar"))) {
      printf("expression '%s' untrue at %d\n",
             "!strcmp(getenv(\"X\"), \"bar\")", 46);
      return 0;
    }
  } while (0);
  do {
    if (!(0 == clearenv())) {
      printf("expression '%s' untrue at %d\n", "0 == clearenv()", 48);
      return 0;
    }
  } while (0);
  do {
    if (!(NULL == getenv("X"))) {
      printf("expression '%s' untrue at %d\n", "NULL == getenv(\"X\")", 49);
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<test_setenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1080 <unsetenv@plt>
lea    0xe85(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11b2 <test_setenv+0x52>
lea    0xe6d(%rip),%rdi
lea    0xe84(%rip),%rsi
mov    $0x1f,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    11b7 <test_setenv+0x57>
jmp    11bc <test_setenv+0x5c>
lea    0xe3d(%rip),%rdi
lea    0xe6a(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1203 <test_setenv+0xa3>
lea    0xe1c(%rip),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x21,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    1208 <test_setenv+0xa8>
jmp    120d <test_setenv+0xad>
lea    0xdec(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
lea    0xe11(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     1255 <test_setenv+0xf5>
lea    0xdca(%rip),%rdi
lea    0xe14(%rip),%rsi
mov    $0x22,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    125a <test_setenv+0xfa>
jmp    125f <test_setenv+0xff>
lea    0xd9a(%rip),%rdi
lea    0xe02(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     12a6 <test_setenv+0x146>
lea    0xd79(%rip),%rdi
lea    0xde3(%rip),%rsi
mov    $0x24,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    12ab <test_setenv+0x14b>
jmp    12b0 <test_setenv+0x150>
lea    0xd49(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
lea    0xd6e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     12f8 <test_setenv+0x198>
lea    0xd27(%rip),%rdi
lea    0xd71(%rip),%rsi
mov    $0x25,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    12fd <test_setenv+0x19d>
jmp    1302 <test_setenv+0x1a2>
lea    0xcf7(%rip),%rdi
lea    0xd5f(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     134c <test_setenv+0x1ec>
lea    0xcd3(%rip),%rdi
lea    0xd58(%rip),%rsi
mov    $0x27,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    1351 <test_setenv+0x1f1>
jmp    1356 <test_setenv+0x1f6>
lea    0xca3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
lea    0xd03(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     139e <test_setenv+0x23e>
lea    0xc81(%rip),%rdi
lea    0xd21(%rip),%rsi
mov    $0x28,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    13a3 <test_setenv+0x243>
jmp    13a8 <test_setenv+0x248>
lea    0xc51(%rip),%rdi
call   1080 <unsetenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     13e6 <test_setenv+0x286>
lea    0xc39(%rip),%rdi
lea    0xcf5(%rip),%rsi
mov    $0x2a,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    13eb <test_setenv+0x28b>
jmp    13f0 <test_setenv+0x290>
lea    0xc09(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     142e <test_setenv+0x2ce>
lea    0xbf1(%rip),%rdi
lea    0xc08(%rip),%rsi
mov    $0x2b,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    1433 <test_setenv+0x2d3>
jmp    1438 <test_setenv+0x2d8>
lea    0xbc1(%rip),%rdi
lea    0xc29(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1482 <test_setenv+0x322>
lea    0xb9d(%rip),%rdi
lea    0xc22(%rip),%rsi
mov    $0x2d,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    1487 <test_setenv+0x327>
jmp    148c <test_setenv+0x32c>
lea    0xb6d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
lea    0xbcd(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     14d4 <test_setenv+0x374>
lea    0xb4b(%rip),%rdi
lea    0xbeb(%rip),%rsi
mov    $0x2e,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    14d9 <test_setenv+0x379>
jmp    14de <test_setenv+0x37e>
mov    $0x0,%al
call   1050 <clearenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1517 <test_setenv+0x3b7>
lea    0xb08(%rip),%rdi
lea    0xbd7(%rip),%rsi
mov    $0x30,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    151c <test_setenv+0x3bc>
jmp    1521 <test_setenv+0x3c1>
lea    0xad8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     155f <test_setenv+0x3ff>
lea    0xac0(%rip),%rdi
lea    0xad7(%rip),%rsi
mov    $0x31,%edx
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    156b <test_setenv+0x40b>
jmp    1564 <test_setenv+0x404>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_setenv>:
push   %rbx
lea    0xe98(%rip),%rbx
mov    %rbx,%rdi
call   1080 <unsetenv@plt>
mov    %rbx,%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     119c <test_setenv+0x3c>
lea    0xe7e(%rip),%rdi
lea    0xe95(%rip),%rsi
mov    $0x1f,%edx
call   1060 <printf@plt>
xor    %ebx,%ebx
jmp    13e2 <test_setenv+0x282>
lea    0xe5d(%rip),%rdi
lea    0xe8a(%rip),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <setenv@plt>
test   %rax,%rax
je     11d0 <test_setenv+0x70>
lea    0xe43(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x21,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xe29(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe51(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1207 <test_setenv+0xa7>
lea    0xe0c(%rip),%rdi
lea    0xe56(%rip),%rsi
mov    $0x22,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xdf2(%rip),%rdi
lea    0xe5a(%rip),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <setenv@plt>
test   %rax,%rax
je     123b <test_setenv+0xdb>
lea    0xdd8(%rip),%rdi
lea    0xe42(%rip),%rsi
mov    $0x24,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xdbe(%rip),%rdi
call   1030 <getenv@plt>
lea    0xde6(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1272 <test_setenv+0x112>
lea    0xda1(%rip),%rdi
lea    0xdeb(%rip),%rsi
mov    $0x25,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xd87(%rip),%rdi
lea    0xdef(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
test   %rax,%rax
je     12a7 <test_setenv+0x147>
lea    0xd6c(%rip),%rdi
lea    0xdf1(%rip),%rsi
mov    $0x27,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xd52(%rip),%rdi
call   1030 <getenv@plt>
lea    0xdb5(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12de <test_setenv+0x17e>
lea    0xd35(%rip),%rdi
lea    0xdd5(%rip),%rsi
mov    $0x28,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xd1b(%rip),%rdi
call   1080 <unsetenv@plt>
test   %rax,%rax
je     1307 <test_setenv+0x1a7>
lea    0xd0c(%rip),%rdi
lea    0xdc8(%rip),%rsi
mov    $0x2a,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xcf2(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1330 <test_setenv+0x1d0>
lea    0xce3(%rip),%rdi
lea    0xcfa(%rip),%rsi
mov    $0x2b,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xcc9(%rip),%rdi
lea    0xd31(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
test   %rax,%rax
je     1362 <test_setenv+0x202>
lea    0xcae(%rip),%rdi
lea    0xd33(%rip),%rsi
mov    $0x2d,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xc97(%rip),%rdi
call   1030 <getenv@plt>
lea    0xcfa(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1396 <test_setenv+0x236>
lea    0xc7a(%rip),%rdi
lea    0xd1a(%rip),%rsi
mov    $0x2e,%edx
jmp    13dd <test_setenv+0x27d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <clearenv@plt>
test   %rax,%rax
je     13b9 <test_setenv+0x259>
lea    0xc57(%rip),%rdi
lea    0xd26(%rip),%rsi
mov    $0x30,%edx
jmp    13dd <test_setenv+0x27d>
lea    0xc40(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13e6 <test_setenv+0x286>
lea    0xc31(%rip),%rdi
lea    0xc48(%rip),%rsi
mov    $0x31,%edx
call   1060 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0x1,%ebx
jmp    13e2 <test_setenv+0x282>

LLVM IR (-O0):
@.str = [2 x i8] c"X\00"
@.str.1 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.2 = [20 x i8] c"NULL == getenv(\22X\22)\00"
@.str.3 = [4 x i8] c"foo\00"
@.str.4 = [27 x i8] c"0 == setenv(\22X\22, \22foo\22, 0)\00"
@.str.5 = [28 x i8] c"!strcmp(getenv(\22X\22), \22foo\22)\00"
@.str.6 = [4 x i8] c"bar\00"
@.str.7 = [27 x i8] c"0 == setenv(\22X\22, \22bar\22, 0)\00"
@.str.8 = [27 x i8] c"0 == setenv(\22X\22, \22bar\22, 1)\00"
@.str.9 = [28 x i8] c"!strcmp(getenv(\22X\22), \22bar\22)\00"
@.str.10 = [19 x i8] c"0 == unsetenv(\22X\22)\00"
@.str.11 = [16 x i8] c"0 == clearenv()\00"
define i32 @test_setenv() {
%1 = alloca i32
%2 = call i64 @unsetenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %0
%4 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* null, %4
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 31)
store i32 0, i32* %1
br label %98
8: ; preds = %3
br label %9
9: ; preds = %8
br label %10
10: ; preds = %9
%11 = call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0)
%12 = icmp eq i64 0, %11
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 33)
store i32 0, i32* %1
br label %98
15: ; preds = %10
br label %16
16: ; preds = %15
br label %17
17: ; preds = %16
%18 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @strcmp(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 34)
store i32 0, i32* %1
br label %98
23: ; preds = %17
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 0)
%27 = icmp eq i64 0, %26
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 36)
store i32 0, i32* %1
br label %98
30: ; preds = %25
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @strcmp(i32* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 37)
store i32 0, i32* %1
br label %98
38: ; preds = %32
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
%41 = call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%42 = icmp eq i64 0, %41
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 39)
store i32 0, i32* %1
br label %98
45: ; preds = %40
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
%48 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%49 = call i32 @strcmp(i32* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 40)
store i32 0, i32* %1
br label %98
53: ; preds = %47
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
%56 = call i64 @unsetenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%57 = icmp eq i64 0, %56
br i1 %57, label %60, label %58
58: ; preds = %55
%59 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 42)
store i32 0, i32* %1
br label %98
60: ; preds = %55
br label %61
61: ; preds = %60
br label %62
62: ; preds = %61
%63 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%64 = icmp eq i32* null, %63
br i1 %64, label %67, label %65
65: ; preds = %62
%66 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 43)
store i32 0, i32* %1
br label %98
67: ; preds = %62
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
%70 = call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%71 = icmp eq i64 0, %70
br i1 %71, label %74, label %72
72: ; preds = %69
%73 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 45)
store i32 0, i32* %1
br label %98
74: ; preds = %69
br label %75
75: ; preds = %74
br label %76
76: ; preds = %75
%77 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%78 = call i32 @strcmp(i32* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 46)
store i32 0, i32* %1
br label %98
82: ; preds = %76
br label %83
83: ; preds = %82
br label %84
84: ; preds = %83
%85 = call i64 (...) @clearenv()
%86 = icmp eq i64 0, %85
br i1 %86, label %89, label %87
87: ; preds = %84
%88 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 48)
store i32 0, i32* %1
br label %98
89: ; preds = %84
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
%92 = call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%93 = icmp eq i32* null, %92
br i1 %93, label %96, label %94
94: ; preds = %91
%95 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 49)
store i32 0, i32* %1
br label %98
96: ; preds = %91
br label %97
97: ; preds = %96
store i32 1, i32* %1
br label %98
98: ; preds = %97, %94, %87, %80, %72, %65, %58, %51, %43, %36, %28, %21, %13, %6
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
@.str = [2 x i8] c"X\00"
@.str.1 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.2 = [20 x i8] c"NULL == getenv(\22X\22)\00"
@.str.3 = [4 x i8] c"foo\00"
@.str.4 = [27 x i8] c"0 == setenv(\22X\22, \22foo\22, 0)\00"
@.str.5 = [28 x i8] c"!strcmp(getenv(\22X\22), \22foo\22)\00"
@.str.6 = [4 x i8] c"bar\00"
@.str.7 = [27 x i8] c"0 == setenv(\22X\22, \22bar\22, 0)\00"
@.str.8 = [27 x i8] c"0 == setenv(\22X\22, \22bar\22, 1)\00"
@.str.9 = [28 x i8] c"!strcmp(getenv(\22X\22), \22bar\22)\00"
@.str.10 = [19 x i8] c"0 == unsetenv(\22X\22)\00"
@.str.11 = [16 x i8] c"0 == clearenv()\00"
define i32 @test_setenv() {
%1 = tail call i64 @unsetenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 31)
br label %70
6: ; preds = %0
%7 = tail call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 33)
br label %70
11: ; preds = %6
%12 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @strcmp(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 34)
br label %70
17: ; preds = %11
%18 = tail call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 0)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 36)
br label %70
22: ; preds = %17
%23 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 @strcmp(i32* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 37)
br label %70
28: ; preds = %22
%29 = tail call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 39)
br label %70
33: ; preds = %28
%34 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%35 = tail call i32 @strcmp(i32* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 40)
br label %70
39: ; preds = %33
%40 = tail call i64 @unsetenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 42)
br label %70
44: ; preds = %39
%45 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 43)
br label %70
49: ; preds = %44
%50 = tail call i64 @setenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%51 = icmp eq i64 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 45)
br label %70
54: ; preds = %49
%55 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%56 = tail call i32 @strcmp(i32* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp eq i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 46)
br label %70
60: ; preds = %54
%61 = tail call i64 (...) @clearenv()
%62 = icmp eq i64 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 48)
br label %70
65: ; preds = %60
%66 = tail call i32* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%67 = icmp eq i32* %66, null
br i1 %67, label %70, label %68
68: ; preds = %65
%69 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 49)
br label %70
70: ; preds = %65, %68, %63, %58, %52, %47, %42, %37, %31, %26, %20, %15, %9, %4
%71 = phi i32 [ 0, %15 ], [ 0, %26 ], [ 0, %37 ], [ 0, %58 ], [ 0, %68 ], [ 0, %63 ], [ 0, %52 ], [ 0, %47 ], [ 0, %42 ], [ 0, %31 ], [ 0, %20 ], [ 0, %9 ], [ 0, %4 ], [ 1, %65 ]
ret i32 %71
}