#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__ getenv(char const *);
scalar_t__ isspace(unsigned char);
int /*<<< orphan*/ putenv(char *);
scalar_t__ rfx_alloc(int);
int /*<<< orphan*/ rfx_free(unsigned char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int /*<<< orphan*/ swf_url_unescape(unsigned char *);
void swf_cgienv(unsigned char *var) {
  unsigned char *buf, *c, *s, *t, *oldval = NULL, *newval;
  int despace = 0, got_cr = 0;
  swf_url_unescape(var);
  buf = (unsigned char *)rfx_alloc(strlen((const char *)var) + sizeof("WWW_") +
                                   2);
  if (!buf)
    return;
  strcpy((char *)buf, (const char *)"WWW_");
  if (var[0] == '_') {
    strcpy((char *)&buf[sizeof("WWW_") - 1], (const char *)&var[1]);
    despace = 1;
  } else
    strcpy((char *)&buf[sizeof("WWW_") - 1], (const char *)var);
  for (c = buf; c[0]; c++) {
    if (c[0] == '.')
      c[0] = '_';
    if (c[0] == '=')
      break;
  }
  if (!c[0])
    c[1] = 0;
  c[0] = 0;
  if (despace && c[1]) {
    for (s = c + 1; s[0] && isspace(s[0]); s++)
      ;
    t = c + 1;
    while (s[0]) {
      if (s[0] == '\r') {
        got_cr = 1;
        s++;
        continue;
      }
      if (got_cr) {
        if (s[0] != '\n')
          *t++ = '\n';
        got_cr = 0;
      }
      *t++ = *s++;
    }
    while (t > c && isspace(*--t))
      ;
    t[1] = 0;
  }
  if ((oldval = (unsigned char *)getenv((const char *)buf))) {
    newval = (unsigned char *)rfx_alloc(strlen((const char *)oldval) +
                                        strlen((const char *)buf) +
                                        strlen((const char *)&c[1]) + 3);
    if (!newval)
      return;
    c[0] = '=';
    sprintf((char *)newval, "%s#%s", buf, oldval);
    c[0] = 0;
    oldval -= strlen((const char *)buf) + 1;
  } else {
    c[0] = '=';
    newval = buf;
  }
  putenv((char *)newval);
  if (oldval) {
    rfx_free(oldval);
    rfx_free(buf);
  }
}


x86 assembly (clang, -O0):
<swf_cgienv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <swf_url_unescape@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
cltq
add    $0x5,%rax
add    $0x2,%rax
mov    %eax,%edi
call   1090 <rfx_alloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e9 <swf_cgienv+0x59>
jmp    14fd <swf_cgienv+0x36d>
mov    -0x10(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5f,%eax
jne    122a <swf_cgienv+0x9a>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x3c(%rbp)
jmp    123b <swf_cgienv+0xab>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1292 <swf_cgienv+0x102>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2e,%eax
jne    1267 <swf_cgienv+0xd7>
mov    -0x18(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x3d,%eax
jne    127c <swf_cgienv+0xec>
jmp    1292 <swf_cgienv+0x102>
jmp    1281 <swf_cgienv+0xf1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1243 <swf_cgienv+0xb3>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    12a7 <swf_cgienv+0x117>
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x0,-0x3c(%rbp)
je     1418 <swf_cgienv+0x288>
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1418 <swf_cgienv+0x288>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x41(%rbp)
je     1300 <swf_cgienv+0x170>
mov    -0x20(%rbp),%rax
movzbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1310 <swf_cgienv+0x180>
jmp    1326 <swf_cgienv+0x196>
jmp    1315 <swf_cgienv+0x185>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    12d5 <swf_cgienv+0x145>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     13c1 <swf_cgienv+0x231>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xd,%eax
jne    1367 <swf_cgienv+0x1d7>
movl   $0x1,-0x40(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1332 <swf_cgienv+0x1a2>
cmpl   $0x0,-0x40(%rbp)
je     139a <swf_cgienv+0x20a>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa,%eax
je     1393 <swf_cgienv+0x203>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0xa,(%rax)
movl   $0x0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1332 <swf_cgienv+0x1a2>
jmp    13c6 <swf_cgienv+0x236>
mov    -0x28(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x42(%rbp)
jbe    13fb <swf_cgienv+0x26b>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x28(%rbp)
movzbl -0x1(%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    140b <swf_cgienv+0x27b>
jmp    1410 <swf_cgienv+0x280>
jmp    13c6 <swf_cgienv+0x236>
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     14c8 <swf_cgienv+0x338>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <strlen@plt>
mov    -0x48(%rbp),%edi
add    %eax,%edi
add    $0x3,%edi
call   1090 <rfx_alloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    147c <swf_cgienv+0x2ec>
jmp    14fd <swf_cgienv+0x36d>
mov    -0x18(%rbp),%rax
movb   $0x3d,(%rax)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xb6f(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
jmp    14d7 <swf_cgienv+0x347>
mov    -0x18(%rbp),%rax
movb   $0x3d,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <putenv@plt>
cmpq   $0x0,-0x30(%rbp)
je     14fd <swf_cgienv+0x36d>
mov    -0x30(%rbp),%rdi
call   1070 <rfx_free@plt>
mov    -0x10(%rbp),%rdi
call   1070 <rfx_free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swf_cgienv>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
call   10a0 <swf_url_unescape@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x7(%rax),%edi
call   1090 <rfx_alloc@plt>
test   %rax,%rax
je     1342 <swf_cgienv+0x1b2>
mov    %rax,%r14
lea    0xe3d(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    (%rbx),%bpl
xor    %esi,%esi
cmp    $0x5f,%bpl
sete   %sil
mov    %r14,%rdi
add    $0x4,%rdi
add    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rbx
jmp    11f7 <swf_cgienv+0x67>
nopl   0x0(%rax)
movb   $0x5f,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2e,%al
je     11f0 <swf_cgienv+0x60>
test   %al,%al
je     1208 <swf_cgienv+0x78>
cmp    $0x3d,%al
jne    11f3 <swf_cgienv+0x63>
jmp    120c <swf_cgienv+0x7c>
movb   $0x0,0x1(%rbx)
movb   $0x0,(%rbx)
cmp    $0x5f,%bpl
jne    12ad <swf_cgienv+0x11d>
mov    0x1(%rbx),%al
test   %al,%al
je     12ad <swf_cgienv+0x11d>
lea    0x1(%rbx),%r15
mov    %r15,%rbp
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1060 <isspace@plt>
test   %rax,%rax
je     1257 <swf_cgienv+0xc7>
movzbl 0x1(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
jne    1230 <swf_cgienv+0xa0>
jmp    1257 <swf_cgienv+0xc7>
nopl   0x0(%rax,%rax,1)
mov    %al,(%r15)
add    $0x1,%r15
add    $0x1,%rbp
mov    $0x1,%cl
nopl   (%rax)
movzbl -0x1(%rbp),%eax
cmp    $0xd,%al
jne    1270 <swf_cgienv+0xe0>
add    $0x1,%rbp
xor    %ecx,%ecx
jmp    1260 <swf_cgienv+0xd0>
test   %al,%al
je     1290 <swf_cgienv+0x100>
cmp    $0xa,%al
sete   %dl
or     %dl,%cl
test   $0x1,%cl
jne    1250 <swf_cgienv+0xc0>
movb   $0xa,(%r15)
add    $0x1,%r15
mov    -0x1(%rbp),%al
jmp    1250 <swf_cgienv+0xc0>
nopl   (%rax)
cmp    %rbx,%r15
jbe    12a8 <swf_cgienv+0x118>
movzbl -0x1(%r15),%edi
add    $0xffffffffffffffff,%r15
call   1060 <isspace@plt>
test   %rax,%rax
jne    1290 <swf_cgienv+0x100>
movb   $0x0,0x1(%r15)
mov    %r14,%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     134b <swf_cgienv+0x1bb>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
lea    0x1(%rbx),%rdi
call   1050 <strlen@plt>
add    %r15d,%ebp
lea    (%rax,%rbp,1),%edi
add    $0x3,%edi
call   1090 <rfx_alloc@plt>
test   %rax,%rax
je     1342 <swf_cgienv+0x1b2>
mov    %rax,%r15
movb   $0x3d,(%rbx)
lea    0xd06(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
mov    %r12,%rcx
call   10b0 <sprintf@plt>
movb   $0x0,(%rbx)
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1080 <putenv@plt>
not    %ebp
movslq %ebp,%rax
add    %rax,%r12
mov    %r12,%rdi
call   1070 <rfx_free@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <rfx_free@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x3d,(%rbx)
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <putenv@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"WWW_\00"
@.str.1 = [6 x i8] c"%s#%s\00"
define void @swf_cgienv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %2
store i8* null, i8** %7
store i32 0, i32* %9
store i32 0, i32* %10
%11 = load i8*, i8** %2
%12 = call i32 @swf_url_unescape(i8* %11)
%13 = load i8*, i8** %2
%14 = call i32 @strlen(i8* %13)
%15 = sext i32 %14 to i64
%16 = add i64 %15, 5
%17 = add i64 %16, 2
%18 = trunc i64 %17 to i32
%19 = call i64 @rfx_alloc(i32 %18)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %3
%21 = load i8*, i8** %3
%22 = icmp ne i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %1
br label %214
24: ; preds = %1
%25 = load i8*, i8** %3
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 95
br i1 %31, label %32, label %38
32: ; preds = %24
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 4
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = call i32 @strcpy(i8* %34, i8* %36)
store i32 1, i32* %9
br label %43
38: ; preds = %24
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 4
%41 = load i8*, i8** %2
%42 = call i32 @strcpy(i8* %40, i8* %41)
br label %43
43: ; preds = %38, %32
%44 = load i8*, i8** %3
store i8* %44, i8** %4
br label %45
45: ; preds = %67, %43
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = icmp ne i8 %48, 0
br i1 %49, label %50, label %70
50: ; preds = %45
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = icmp eq i32 %54, 46
br i1 %55, label %56, label %59
56: ; preds = %50
%57 = load i8*, i8** %4
%58 = getelementptr inbounds i8, i8* %57, i64 0
store i8 95, i8* %58
br label %59
59: ; preds = %56, %50
%60 = load i8*, i8** %4
%61 = getelementptr inbounds i8, i8* %60, i64 0
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = icmp eq i32 %63, 61
br i1 %64, label %65, label %66
65: ; preds = %59
br label %70
66: ; preds = %59
br label %67
67: ; preds = %66
%68 = load i8*, i8** %4
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %4
br label %45
70: ; preds = %65, %45
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = icmp ne i8 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %70
%76 = load i8*, i8** %4
%77 = getelementptr inbounds i8, i8* %76, i64 1
store i8 0, i8* %77
br label %78
78: ; preds = %75, %70
%79 = load i8*, i8** %4
%80 = getelementptr inbounds i8, i8* %79, i64 0
store i8 0, i8* %80
%81 = load i32, i32* %9
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %163
83: ; preds = %78
%84 = load i8*, i8** %4
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %163
89: ; preds = %83
%90 = load i8*, i8** %4
%91 = getelementptr inbounds i8, i8* %90, i64 1
store i8* %91, i8** %5
br label %92
92: ; preds = %107, %89
%93 = load i8*, i8** %5
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %104
98: ; preds = %92
%99 = load i8*, i8** %5
%100 = getelementptr inbounds i8, i8* %99, i64 0
%101 = load i8, i8* %100
%102 = call i64 @isspace(i8 zeroext %101)
%103 = icmp ne i64 %102, 0
br label %104
104: ; preds = %98, %92
%105 = phi i1 [ false, %92 ], [ %103, %98 ]
br i1 %105, label %106, label %110
106: ; preds = %104
br label %107
107: ; preds = %106
%108 = load i8*, i8** %5
%109 = getelementptr inbounds i8, i8* %108, i32 1
store i8* %109, i8** %5
br label %92
110: ; preds = %104
%111 = load i8*, i8** %4
%112 = getelementptr inbounds i8, i8* %111, i64 1
store i8* %112, i8** %6
br label %113
113: ; preds = %140, %124, %110
%114 = load i8*, i8** %5
%115 = getelementptr inbounds i8, i8* %114, i64 0
%116 = load i8, i8* %115
%117 = icmp ne i8 %116, 0
br i1 %117, label %118, label %146
118: ; preds = %113
%119 = load i8*, i8** %5
%120 = getelementptr inbounds i8, i8* %119, i64 0
%121 = load i8, i8* %120
%122 = zext i8 %121 to i32
%123 = icmp eq i32 %122, 13
br i1 %123, label %124, label %127
124: ; preds = %118
store i32 1, i32* %10
%125 = load i8*, i8** %5
%126 = getelementptr inbounds i8, i8* %125, i32 1
store i8* %126, i8** %5
br label %113
127: ; preds = %118
%128 = load i32, i32* %10
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %140
130: ; preds = %127
%131 = load i8*, i8** %5
%132 = getelementptr inbounds i8, i8* %131, i64 0
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = icmp ne i32 %134, 10
br i1 %135, label %136, label %139
136: ; preds = %130
%137 = load i8*, i8** %6
%138 = getelementptr inbounds i8, i8* %137, i32 1
store i8* %138, i8** %6
store i8 10, i8* %137
br label %139
139: ; preds = %136, %130
store i32 0, i32* %10
br label %140
140: ; preds = %139, %127
%141 = load i8*, i8** %5
%142 = getelementptr inbounds i8, i8* %141, i32 1
store i8* %142, i8** %5
%143 = load i8, i8* %141
%144 = load i8*, i8** %6
%145 = getelementptr inbounds i8, i8* %144, i32 1
store i8* %145, i8** %6
store i8 %143, i8* %144
br label %113
146: ; preds = %113
br label %147
147: ; preds = %159, %146
%148 = load i8*, i8** %6
%149 = load i8*, i8** %4
%150 = icmp ugt i8* %148, %149
br i1 %150, label %151, label %157
151: ; preds = %147
%152 = load i8*, i8** %6
%153 = getelementptr inbounds i8, i8* %152, i32 -1
store i8* %153, i8** %6
%154 = load i8, i8* %153
%155 = call i64 @isspace(i8 zeroext %154)
%156 = icmp ne i64 %155, 0
br label %157
157: ; preds = %151, %147
%158 = phi i1 [ false, %147 ], [ %156, %151 ]
br i1 %158, label %159, label %160
159: ; preds = %157
br label %147
160: ; preds = %157
%161 = load i8*, i8** %6
%162 = getelementptr inbounds i8, i8* %161, i64 1
store i8 0, i8* %162
br label %163
163: ; preds = %160, %83, %78
%164 = load i8*, i8** %3
%165 = call i64 @getenv(i8* %164)
%166 = inttoptr i64 %165 to i8*
store i8* %166, i8** %7
%167 = icmp ne i8* %166, null
br i1 %167, label %168, label %200
168: ; preds = %163
%169 = load i8*, i8** %7
%170 = call i32 @strlen(i8* %169)
%171 = load i8*, i8** %3
%172 = call i32 @strlen(i8* %171)
%173 = add nsw i32 %170, %172
%174 = load i8*, i8** %4
%175 = getelementptr inbounds i8, i8* %174, i64 1
%176 = call i32 @strlen(i8* %175)
%177 = add nsw i32 %173, %176
%178 = add nsw i32 %177, 3
%179 = call i64 @rfx_alloc(i32 %178)
%180 = inttoptr i64 %179 to i8*
store i8* %180, i8** %8
%181 = load i8*, i8** %8
%182 = icmp ne i8* %181, null
br i1 %182, label %184, label %183
183: ; preds = %168
br label %214
184: ; preds = %168
%185 = load i8*, i8** %4
%186 = getelementptr inbounds i8, i8* %185, i64 0
store i8 61, i8* %186
%187 = load i8*, i8** %8
%188 = load i8*, i8** %3
%189 = load i8*, i8** %7
%190 = call i32 @sprintf(i8* %187, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %188, i8* %189)
%191 = load i8*, i8** %4
%192 = getelementptr inbounds i8, i8* %191, i64 0
store i8 0, i8* %192
%193 = load i8*, i8** %3
%194 = call i32 @strlen(i8* %193)
%195 = add nsw i32 %194, 1
%196 = load i8*, i8** %7
%197 = sext i32 %195 to i64
%198 = sub i64 0, %197
%199 = getelementptr inbounds i8, i8* %196, i64 %198
store i8* %199, i8** %7
br label %204
200: ; preds = %163
%201 = load i8*, i8** %4
%202 = getelementptr inbounds i8, i8* %201, i64 0
store i8 61, i8* %202
%203 = load i8*, i8** %3
store i8* %203, i8** %8
br label %204
204: ; preds = %200, %184
%205 = load i8*, i8** %8
%206 = call i32 @putenv(i8* %205)
%207 = load i8*, i8** %7
%208 = icmp ne i8* %207, null
br i1 %208, label %209, label %214
209: ; preds = %204
%210 = load i8*, i8** %7
%211 = call i32 @rfx_free(i8* %210)
%212 = load i8*, i8** %3
%213 = call i32 @rfx_free(i8* %212)
br label %214
214: ; preds = %23, %183, %209, %204
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"WWW_\00"
@.str.1 = [6 x i8] c"%s#%s\00"
define void @swf_cgienv(i8* %0) {
%2 = tail call i32 @swf_url_unescape(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = add i32 %3, 7
%5 = tail call i64 @rfx_alloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %97, label %8
8: ; preds = %1
%9 = tail call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 95
%12 = getelementptr inbounds i8, i8* %6, i64 4
%13 = zext i1 %11 to i64
%14 = getelementptr i8, i8* %0, i64 %13
%15 = tail call i32 @strcpy(i8* %12, i8* %14)
br label %16
16: ; preds = %20, %8
%17 = phi i8* [ %6, %8 ], [ %21, %20 ]
%18 = load i8, i8* %17
switch i8 %18, label %20 [
i8 0, label %22
i8 46, label %19
i8 61, label %24
]
19: ; preds = %16
store i8 95, i8* %17
br label %20
20: ; preds = %16, %19
%21 = getelementptr inbounds i8, i8* %17, i64 1
br label %16
22: ; preds = %16
%23 = getelementptr inbounds i8, i8* %17, i64 1
store i8 0, i8* %23
br label %24
24: ; preds = %16, %22
store i8 0, i8* %17
br i1 %11, label %25, label %71
25: ; preds = %24
%26 = getelementptr inbounds i8, i8* %17, i64 1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %71, label %29
29: ; preds = %25, %34
%30 = phi i8* [ %35, %34 ], [ %26, %25 ]
%31 = phi i8 [ %36, %34 ], [ %27, %25 ]
%32 = tail call i64 @isspace(i8 zeroext %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %29
%35 = getelementptr inbounds i8, i8* %30, i64 1
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %29
38: ; preds = %29, %34
%39 = phi i8* [ %30, %29 ], [ %35, %34 ]
br label %40
40: ; preds = %38, %55
%41 = phi i8* [ %58, %55 ], [ %39, %38 ]
%42 = phi i8* [ %59, %55 ], [ %26, %38 ]
br label %43
43: ; preds = %40, %47
%44 = phi i8* [ %48, %47 ], [ %41, %40 ]
%45 = phi i1 [ false, %47 ], [ true, %40 ]
%46 = load i8, i8* %44
switch i8 %46, label %49 [
i8 0, label %60
i8 13, label %47
]
47: ; preds = %43
%48 = getelementptr inbounds i8, i8* %44, i64 1
br label %43
49: ; preds = %43
%50 = icmp eq i8 %46, 10
%51 = select i1 %45, i1 true, i1 %50
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = getelementptr inbounds i8, i8* %42, i64 1
store i8 10, i8* %42
%54 = load i8, i8* %44
br label %55
55: ; preds = %52, %49
%56 = phi i8 [ %46, %49 ], [ %54, %52 ]
%57 = phi i8* [ %42, %49 ], [ %53, %52 ]
%58 = getelementptr inbounds i8, i8* %44, i64 1
%59 = getelementptr inbounds i8, i8* %57, i64 1
store i8 %56, i8* %57
br label %40
60: ; preds = %43, %63
%61 = phi i8* [ %64, %63 ], [ %42, %43 ]
%62 = icmp ugt i8* %61, %17
br i1 %62, label %63, label %68
63: ; preds = %60
%64 = getelementptr inbounds i8, i8* %61, i64 -1
%65 = load i8, i8* %64
%66 = tail call i64 @isspace(i8 zeroext %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %60
68: ; preds = %60, %63
%69 = phi i8* [ %64, %63 ], [ %61, %60 ]
%70 = getelementptr inbounds i8, i8* %69, i64 1
store i8 0, i8* %70
br label %71
71: ; preds = %68, %25, %24
%72 = tail call i64 @getenv(i8* %6)
%73 = inttoptr i64 %72 to i8*
%74 = icmp eq i64 %72, 0
br i1 %74, label %86, label %75
75: ; preds = %71
%76 = tail call i32 @strlen(i8* %73)
%77 = tail call i32 @strlen(i8* %6)
%78 = getelementptr inbounds i8, i8* %17, i64 1
%79 = tail call i32 @strlen(i8* %78)
%80 = add i32 %76, 3
%81 = add i32 %80, %77
%82 = add i32 %81, %79
%83 = tail call i64 @rfx_alloc(i32 %82)
%84 = inttoptr i64 %83 to i8*
%85 = icmp eq i64 %83, 0
br i1 %85, label %97, label %88
86: ; preds = %71
store i8 61, i8* %17
%87 = tail call i32 @putenv(i8* %6)
br label %97
88: ; preds = %75
store i8 61, i8* %17
%89 = tail call i32 @sprintf(i8* %84, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %73)
store i8 0, i8* %17
%90 = tail call i32 @strlen(i8* %6)
%91 = tail call i32 @putenv(i8* %84)
%92 = xor i32 %90, -1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %73, i64 %93
%95 = tail call i32 @rfx_free(i8* %94)
%96 = tail call i32 @rfx_free(i8* %6)
br label %97
97: ; preds = %86, %88, %75, %1
ret void
}