#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*/ ShowAllRefs();
int /*<<< orphan*/ ShowEnv();
int /*<<< orphan*/ ShowRefs(char *);
int /*<<< orphan*/ ShowStats(int);
int /*<<< orphan*/ ShowVersion();
int /*<<< orphan*/ UpdateAllRefs();
int /*<<< orphan*/ UpdateRefs(char *);
int /*<<< orphan*/ geteuid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ strcasecmp(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int fancy;
  int ref;
  int show = 0;
  setuid(geteuid());
  if (argc > 1 && !strcasecmp(argv[1], "version")) {
    puts("Content-type: text/html");
    puts("");
    ShowVersion();
    return (0);
  }
  if (argc > 1 && !strcasecmp(argv[1], "env")) {
    puts("Content-type: text/html");
    puts("");
    ShowEnv();
    return (0);
  }
  if (argc > 1 && !strcasecmp(argv[1], "text"))
    fancy = 0;
  else
    fancy = 1;
  if (argc > 1 && !strcasecmp(argv[1], "ref_update")) {
    if (argc > 2 && strlen(argv[2]))
      ref = 2;
    else
      ref = 1;
  } else
    ref = 0;
  if (argc > 1 && !strcasecmp(argv[1], "ref_show")) {
    if (argc > 2 && strlen(argv[2]))
      show = 2;
    else
      show = 1;
  } else
    show = 0;
  puts("Content-type: text/html");
  puts("");
  if (ref == 1) {
    UpdateAllRefs();
    puts("<html><head><title>Finished Updating All URL Ref "
         "Pages</title></head>");
    puts("<body><center><h1>Finished Updating All URL Ref Pages</h1></center>");
    ShowAllRefs();
    printf("<hr><font size=-1><i><a href=\"%s\">PHP Tools</a> Copyright &copy "
           "1995 Rasmus Lerdorf</i></font><br>\n",
           "http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html");
    puts("</body></html>");
  } else if (ref == 2) {
    UpdateRefs(argv[2]);
    puts("<html><head><title>Finished Updating Ref Page</title></head>");
    puts("<body><center><h1>Finished Updating Ref Page</h1></center>");
    ShowRefs(argv[2]);
    printf("<hr><font size=-1><i><a href=\"%s\">PHP Tools</a> Copyright &copy "
           "1995 Rasmus Lerdorf</i></font><br>\n",
           "http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html");
    puts("</body></html>");
  } else if (show == 1) {
    puts("<html><head><title>Referring URL List for All Pages</title></head>");
    puts("<body><center><h1>Referring URL List for All Pages</h1></center>");
    ShowAllRefs();
    printf("<a href=\"phplmon.cgi?ref_update\">Update Reference URL's for All "
           "pages</a><br>\n");
    printf("<hr><font size=-1><i><a href=\"%s\">PHP Tools</a> Copyright &copy "
           "1995 Rasmus Lerdorf</i></font><br>\n",
           "http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html");
    puts("</body></html>");
  } else if (show == 2) {
    puts("<html><head><title>Referring URL List</title></head>");
    puts("<body><center><h1>Referring URL List</h1></center>");
    ShowRefs(argv[2]);
    printf("<a href=\"phplmon.cgi?ref_show\">Show Reference URL's for All "
           "pages</a><br>\n");
    printf("<a href=\"phplmon.cgi?ref_update+%s\">Update Reference URL's for "
           "this page</a><br>\n",
           argv[2]);
    printf("<a href=\"phplmon.cgi?ref_update\">Update Reference URL's for All "
           "pages</a><br>\n");
    printf("<hr><font size=-1><i><a href=\"%s\">PHP Tools</a> Copyright &copy "
           "1995 Rasmus Lerdorf</i></font><br>\n",
           "http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html");
    puts("</body></html>");
  } else
    ShowStats(fancy);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <geteuid@plt>
mov    %eax,%edi
call   10e0 <setuid@plt>
cmpl   $0x1,-0x8(%rbp)
jle    124d <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdec(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    124d <main+0x7d>
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
lea    0x118b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1080 <ShowVersion@plt>
movl   $0x0,-0x4(%rbp)
jmp    1579 <main+0x3a9>
cmpl   $0x1,-0x8(%rbp)
jle    129f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdba(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    129f <main+0xcf>
lea    0xd8d(%rip),%rdi
call   1040 <puts@plt>
lea    0x1139(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10b0 <ShowEnv@plt>
movl   $0x0,-0x4(%rbp)
jmp    1579 <main+0x3a9>
cmpl   $0x1,-0x8(%rbp)
jle    12d2 <main+0x102>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd6c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12d2 <main+0x102>
movl   $0x0,-0x14(%rbp)
jmp    12d9 <main+0x109>
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1339 <main+0x169>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd37(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1339 <main+0x169>
cmpl   $0x2,-0x8(%rbp)
jle    132d <main+0x15d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
je     132d <main+0x15d>
movl   $0x2,-0x18(%rbp)
jmp    1334 <main+0x164>
movl   $0x1,-0x18(%rbp)
jmp    1340 <main+0x170>
movl   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    13a0 <main+0x1d0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcdb(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    13a0 <main+0x1d0>
cmpl   $0x2,-0x8(%rbp)
jle    1394 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
je     1394 <main+0x1c4>
movl   $0x2,-0x1c(%rbp)
jmp    139b <main+0x1cb>
movl   $0x1,-0x1c(%rbp)
jmp    13a7 <main+0x1d7>
movl   $0x0,-0x1c(%rbp)
lea    0xc5a(%rip),%rdi
call   1040 <puts@plt>
lea    0x1006(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x1,-0x18(%rbp)
jne    1415 <main+0x245>
mov    $0x0,%al
call   1090 <UpdateAllRefs@plt>
lea    0xc66(%rip),%rdi
call   1040 <puts@plt>
lea    0xca0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10a0 <ShowAllRefs@plt>
lea    0xcd1(%rip),%rdi
lea    0xd2e(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd57(%rip),%rdi
call   1040 <puts@plt>
jmp    1572 <main+0x3a2>
cmpl   $0x2,-0x18(%rbp)
jne    1477 <main+0x2a7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <UpdateRefs@plt>
lea    0xd3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xd6f(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <ShowRefs@plt>
lea    0xc6f(%rip),%rdi
lea    0xccc(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcf5(%rip),%rdi
call   1040 <puts@plt>
jmp    156d <main+0x39d>
cmpl   $0x1,-0x1c(%rbp)
jne    14d4 <main+0x304>
lea    0xd61(%rip),%rdi
call   1040 <puts@plt>
lea    0xd98(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10a0 <ShowAllRefs@plt>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc12(%rip),%rdi
lea    0xc6f(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc98(%rip),%rdi
call   1040 <puts@plt>
jmp    1568 <main+0x398>
cmpl   $0x2,-0x1c(%rbp)
jne    155b <main+0x38b>
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
lea    0xe00(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <ShowRefs@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xb8b(%rip),%rdi
lea    0xbe8(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc11(%rip),%rdi
call   1040 <puts@plt>
jmp    1563 <main+0x393>
mov    -0x14(%rbp),%edi
call   10c0 <ShowStats@plt>
jmp    1568 <main+0x398>
jmp    156d <main+0x39d>
jmp    1572 <main+0x3a2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r13d
xor    %r12d,%r12d
xor    %eax,%eax
call   1070 <geteuid@plt>
mov    %eax,%edi
call   10e0 <setuid@plt>
mov    $0x1,%al
mov    $0x0,%ebp
mov    $0x0,%ebx
mov    $0x0,%r15d
cmp    $0x2,%r13d
jl     12fb <main+0x12b>
mov    0x8(%r14),%rbx
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     1265 <main+0x95>
lea    0xdf4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     1287 <main+0xb7>
lea    0xde5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
setne  0x7(%rsp)
lea    0xdd4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     12a9 <main+0xd9>
xor    %ebp,%ebp
jmp    12c2 <main+0xf2>
lea    0xd9c(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1080 <ShowVersion@plt>
jmp    140b <main+0x23b>
lea    0xd7a(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   10b0 <ShowEnv@plt>
jmp    140b <main+0x23b>
cmp    $0x3,%r13d
jb     12bf <main+0xef>
mov    0x10(%r14),%rax
cmpb   $0x0,(%rax)
je     12bf <main+0xef>
mov    $0x1,%r12b
xor    %ebp,%ebp
jmp    12c5 <main+0xf5>
mov    $0x1,%bpl
xor    %r12d,%r12d
lea    0xd68(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     12dc <main+0x10c>
xor    %ebx,%ebx
jmp    12f4 <main+0x124>
cmp    $0x3,%r13d
jb     12f2 <main+0x122>
mov    0x10(%r14),%rax
cmpb   $0x0,(%rax)
je     12f2 <main+0x122>
mov    $0x1,%r15b
xor    %ebx,%ebx
jmp    12f7 <main+0x127>
mov    $0x1,%bl
xor    %r15d,%r15d
mov    0x7(%rsp),%al
mov    %eax,%r13d
lea    0xd03(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %bpl,%bpl
je     1344 <main+0x174>
xor    %eax,%eax
call   1090 <UpdateAllRefs@plt>
lea    0xd16(%rip),%rdi
call   1050 <puts@plt>
lea    0xd50(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10a0 <ShowAllRefs@plt>
jmp    13ea <main+0x21a>
test   %r12b,%r12b
je     1375 <main+0x1a5>
mov    0x10(%r14),%rdi
call   10f0 <UpdateRefs@plt>
lea    0xe18(%rip),%rdi
call   1050 <puts@plt>
lea    0xe49(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%r14),%rdi
call   10d0 <ShowRefs@plt>
jmp    13ea <main+0x21a>
test   %bl,%bl
je     139a <main+0x1ca>
lea    0xe69(%rip),%rdi
call   1050 <puts@plt>
lea    0xea0(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10a0 <ShowAllRefs@plt>
jmp    13de <main+0x20e>
test   %r15b,%r15b
je     141c <main+0x24c>
lea    0xec7(%rip),%rdi
call   1050 <puts@plt>
lea    0xef0(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%r14),%rdi
call   10d0 <ShowRefs@plt>
lea    0xf60(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%r14),%rsi
lea    0xefe(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf8c(%rip),%rdi
call   1050 <puts@plt>
lea    0xcd6(%rip),%rdi
lea    0xd33(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd5c(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movzbl %r13b,%edi
call   10c0 <ShowStats@plt>
jmp    140b <main+0x23b>

LLVM IR (-O0):
@.str = [8 x i8] c"version\00"
@.str.1 = [24 x i8] c"Content-type: text/html\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"env\00"
@.str.4 = [5 x i8] c"text\00"
@.str.5 = [11 x i8] c"ref_update\00"
@.str.6 = [9 x i8] c"ref_show\00"
@.str.7 = [70 x i8] c"<html><head><title>Finished Updating All URL Ref Pages</title></head>\00"
@.str.8 = [68 x i8] c"<body><center><h1>Finished Updating All URL Ref Pages</h1></center>\00"
@.str.9 = [100 x i8] c"<hr><font size=-1><i><a href=\22%s\22>PHP Tools</a> Copyright &copy 1995 Rasmus Lerdorf</i></font><br>\0A\00"
@.str.10 = [55 x i8] c"http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html\00"
@.str.11 = [15 x i8] c"</body></html>\00"
@.str.12 = [61 x i8] c"<html><head><title>Finished Updating Ref Page</title></head>\00"
@.str.13 = [59 x i8] c"<body><center><h1>Finished Updating Ref Page</h1></center>\00"
@.str.14 = [67 x i8] c"<html><head><title>Referring URL List for All Pages</title></head>\00"
@.str.15 = [65 x i8] c"<body><center><h1>Referring URL List for All Pages</h1></center>\00"
@.str.16 = [79 x i8] c"<a href=\22phplmon.cgi?ref_update\22>Update Reference URL's for All pages</a><br>\0A\00"
@.str.17 = [53 x i8] c"<html><head><title>Referring URL List</title></head>\00"
@.str.18 = [51 x i8] c"<body><center><h1>Referring URL List</h1></center>\00"
@.str.19 = [75 x i8] c"<a href=\22phplmon.cgi?ref_show\22>Show Reference URL's for All pages</a><br>\0A\00"
@.str.20 = [82 x i8] c"<a href=\22phplmon.cgi?ref_update+%s\22>Update Reference URL's for this page</a><br>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%9 = call i32 (...) @geteuid()
%10 = call i32 @setuid(i32 %9)
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcasecmp(i8* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %13
%20 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @ShowVersion()
store i32 0, i32* %3
br label %154
23: ; preds = %13, %2
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 1
br i1 %25, label %26, label %36
26: ; preds = %23
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @strcasecmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %26
%33 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 (...) @ShowEnv()
store i32 0, i32* %3
br label %154
36: ; preds = %26, %23
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 1
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @strcasecmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %39
store i32 0, i32* %6
br label %47
46: ; preds = %39, %36
store i32 1, i32* %6
br label %47
47: ; preds = %46, %45
%48 = load i32, i32* %4
%49 = icmp sgt i32 %48, 1
br i1 %49, label %50, label %68
50: ; preds = %47
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @strcasecmp(i8* %53, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %68, label %56
56: ; preds = %50
%57 = load i32, i32* %4
%58 = icmp sgt i32 %57, 2
br i1 %58, label %59, label %66
59: ; preds = %56
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i64 @strlen(i8* %62)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %59
store i32 2, i32* %7
br label %67
66: ; preds = %59, %56
store i32 1, i32* %7
br label %67
67: ; preds = %66, %65
br label %69
68: ; preds = %50, %47
store i32 0, i32* %7
br label %69
69: ; preds = %68, %67
%70 = load i32, i32* %4
%71 = icmp sgt i32 %70, 1
br i1 %71, label %72, label %90
72: ; preds = %69
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = call i32 @strcasecmp(i8* %75, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%77 = icmp ne i32 %76, 0
br i1 %77, label %90, label %78
78: ; preds = %72
%79 = load i32, i32* %4
%80 = icmp sgt i32 %79, 2
br i1 %80, label %81, label %88
81: ; preds = %78
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 2
%84 = load i8*, i8** %83
%85 = call i64 @strlen(i8* %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %81
store i32 2, i32* %8
br label %89
88: ; preds = %81, %78
store i32 1, i32* %8
br label %89
89: ; preds = %88, %87
br label %91
90: ; preds = %72, %69
store i32 0, i32* %8
br label %91
91: ; preds = %90, %89
%92 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%93 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%94 = load i32, i32* %7
%95 = icmp eq i32 %94, 1
br i1 %95, label %96, label %103
96: ; preds = %91
%97 = call i32 (...) @UpdateAllRefs()
%98 = call i32 @puts(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0))
%99 = call i32 @puts(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.8, i64 0, i64 0))
%100 = call i32 (...) @ShowAllRefs()
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%102 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %153
103: ; preds = %91
%104 = load i32, i32* %7
%105 = icmp eq i32 %104, 2
br i1 %105, label %106, label %119
106: ; preds = %103
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
%110 = call i32 @UpdateRefs(i8* %109)
%111 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%112 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.13, i64 0, i64 0))
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 2
%115 = load i8*, i8** %114
%116 = call i32 @ShowRefs(i8* %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%118 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %152
119: ; preds = %103
%120 = load i32, i32* %8
%121 = icmp eq i32 %120, 1
br i1 %121, label %122, label %129
122: ; preds = %119
%123 = call i32 @puts(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.14, i64 0, i64 0))
%124 = call i32 @puts(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.15, i64 0, i64 0))
%125 = call i32 (...) @ShowAllRefs()
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.16, i64 0, i64 0))
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%128 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %151
129: ; preds = %119
%130 = load i32, i32* %8
%131 = icmp eq i32 %130, 2
br i1 %131, label %132, label %147
132: ; preds = %129
%133 = call i32 @puts(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0))
%134 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.18, i64 0, i64 0))
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 2
%137 = load i8*, i8** %136
%138 = call i32 @ShowRefs(i8* %137)
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.19, i64 0, i64 0))
%140 = load i8**, i8*** %5
%141 = getelementptr inbounds i8*, i8** %140, i64 2
%142 = load i8*, i8** %141
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.20, i64 0, i64 0), i8* %142)
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.16, i64 0, i64 0))
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%146 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %150
147: ; preds = %129
%148 = load i32, i32* %6
%149 = call i32 @ShowStats(i32 %148)
br label %150
150: ; preds = %147, %132
br label %151
151: ; preds = %150, %122
br label %152
152: ; preds = %151, %106
br label %153
153: ; preds = %152, %96
store i32 0, i32* %3
br label %154
154: ; preds = %153, %32, %19
%155 = load i32, i32* %3
ret i32 %155
}

LLVM IR (-O2):
@.str = [8 x i8] c"version\00"
@.str.1 = [24 x i8] c"Content-type: text/html\00"
@.str.3 = [4 x i8] c"env\00"
@.str.4 = [5 x i8] c"text\00"
@.str.5 = [11 x i8] c"ref_update\00"
@.str.6 = [9 x i8] c"ref_show\00"
@.str.7 = [70 x i8] c"<html><head><title>Finished Updating All URL Ref Pages</title></head>\00"
@.str.8 = [68 x i8] c"<body><center><h1>Finished Updating All URL Ref Pages</h1></center>\00"
@.str.9 = [100 x i8] c"<hr><font size=-1><i><a href=\22%s\22>PHP Tools</a> Copyright &copy 1995 Rasmus Lerdorf</i></font><br>\0A\00"
@.str.10 = [55 x i8] c"http://www.io.org/~rasmus/phpl.cgi?pages/phptools.html\00"
@.str.11 = [15 x i8] c"</body></html>\00"
@.str.12 = [61 x i8] c"<html><head><title>Finished Updating Ref Page</title></head>\00"
@.str.13 = [59 x i8] c"<body><center><h1>Finished Updating Ref Page</h1></center>\00"
@.str.14 = [67 x i8] c"<html><head><title>Referring URL List for All Pages</title></head>\00"
@.str.15 = [65 x i8] c"<body><center><h1>Referring URL List for All Pages</h1></center>\00"
@.str.17 = [53 x i8] c"<html><head><title>Referring URL List</title></head>\00"
@.str.18 = [51 x i8] c"<body><center><h1>Referring URL List</h1></center>\00"
@.str.20 = [82 x i8] c"<a href=\22phplmon.cgi?ref_update+%s\22>Update Reference URL's for this page</a><br>\0A\00"
@str = [74 x i8] c"<a href=\22phplmon.cgi?ref_show\22>Show Reference URL's for All pages</a><br>\00"
@str.22 = [78 x i8] c"<a href=\22phplmon.cgi?ref_update\22>Update Reference URL's for All pages</a><br>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @geteuid()
%4 = tail call i32 @setuid(i32 %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %48
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 (...) @ShowVersion()
br label %98
15: ; preds = %6
%16 = tail call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 (...) @ShowEnv()
br label %98
22: ; preds = %15
%23 = tail call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
%25 = tail call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %22
%28 = icmp ugt i32 %0, 2
br i1 %28, label %29, label %34
29: ; preds = %27
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29, %27
br label %35
35: ; preds = %22, %29, %34
%36 = phi i1 [ false, %22 ], [ false, %29 ], [ true, %34 ]
%37 = phi i1 [ false, %22 ], [ true, %29 ], [ false, %34 ]
%38 = tail call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %35
%41 = icmp ugt i32 %0, 2
br i1 %41, label %42, label %47
42: ; preds = %40
%43 = getelementptr inbounds i8*, i8** %1, i64 2
%44 = load i8*, i8** %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %42, %40
br label %48
48: ; preds = %2, %35, %42, %47
%49 = phi i1 [ %37, %47 ], [ %37, %42 ], [ %37, %35 ], [ false, %2 ]
%50 = phi i1 [ %36, %47 ], [ %36, %42 ], [ %36, %35 ], [ false, %2 ]
%51 = phi i1 [ %24, %47 ], [ %24, %42 ], [ %24, %35 ], [ true, %2 ]
%52 = phi i1 [ true, %47 ], [ false, %42 ], [ false, %35 ], [ false, %2 ]
%53 = phi i1 [ false, %47 ], [ true, %42 ], [ false, %35 ], [ false, %2 ]
%54 = zext i1 %51 to i32
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%56 = tail call i32 @putchar(i32 10)
br i1 %50, label %57, label %64
57: ; preds = %48
%58 = tail call i32 (...) @UpdateAllRefs()
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0))
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.8, i64 0, i64 0))
%61 = tail call i32 (...) @ShowAllRefs()
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %98
64: ; preds = %48
br i1 %49, label %65, label %75
65: ; preds = %64
%66 = getelementptr inbounds i8*, i8** %1, i64 2
%67 = load i8*, i8** %66
%68 = tail call i32 @UpdateRefs(i8* %67)
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.13, i64 0, i64 0))
%71 = load i8*, i8** %66
%72 = tail call i32 @ShowRefs(i8* %71)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %98
75: ; preds = %64
br i1 %52, label %76, label %83
76: ; preds = %75
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.14, i64 0, i64 0))
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.15, i64 0, i64 0))
%79 = tail call i32 (...) @ShowAllRefs()
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.22, i64 0, i64 0))
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %98
83: ; preds = %75
br i1 %53, label %84, label %96
84: ; preds = %83
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0))
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.18, i64 0, i64 0))
%87 = getelementptr inbounds i8*, i8** %1, i64 2
%88 = load i8*, i8** %87
%89 = tail call i32 @ShowRefs(i8* %88)
%90 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%91 = load i8*, i8** %87
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @.str.20, i64 0, i64 0), i8* %91)
%93 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.22, i64 0, i64 0))
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%95 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
br label %98
96: ; preds = %83
%97 = tail call i32 @ShowStats(i32 %54)
br label %98
98: ; preds = %57, %76, %96, %84, %65, %18, %11
ret i32 0
}