#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
char *getenv(char *);
char *getinput(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, long *);
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
size_t strlen(char *);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  long len;
  char buf[BUFSIZ];
  char *user_file, *pass_file;
  char *pathmem = "Members.csv";
  char *pathuser = "LoggedIn.csv";
  FILE *fp = fopen(pathmem, "r");
  char input[400];
  int ok = 0;
  char *length = getenv("CONTENT_LENGTH");
  FILE *gp = fopen(pathuser, "a");
  char *username, *password, *ignore, *temp;
  printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1", 13, 10);
  printf("<!DOCTYPE>");
  printf("<html>");
  if (length == NULL || sscanf(length, "%ld", &len) != 1 || len > 40) {
    printf("<p>There seems to be an error </p>");
  } else {
    fgets(input, len + 1, stdin);
    user_file = strtok(input, "&");
    user_file = strtok(NULL, "&");
    temp = user_file;
    username = getinput(input);
    password = getinput(temp);
    char *line = malloc(192 * sizeof(char));
    while (fgets(line, 192, fp)) {
      user_file = strtok(line, ",");
      user_file = strtok(NULL, ",");
      if (strcmp(user_file, username) == 0) {
        user_file = strtok(NULL, ",");
        if (user_file[strlen(password)] = '\n') {
          user_file[strlen(password)] = '\0';
        }
        if (strcmp(password, user_file) == 0) {
          ok = 1;
        }
      }
    }
    fclose(fp);
    if (ok == 0) {
      printf("<title>LOGIN</title><br>\n");
      printf("<center>There was an error with your login!<br>");
      printf("<a href=\"http://cs.mcgill.ca/~ysibou/\">Click here to go back "
             "to the home page!</a> <a "
             "href=\"http://cs.mcgill.ca/~ysibou/login.html\">Click here to "
             "login again!</a></center>");
      printf("</body>");
    } else {
      fprintf(gp, "%s/n", username);
      fclose(gp);
      printf("<title>Catalogue</title>");
      printf("<head>");
      printf("<body>");
      printf("<form name=\"input\" action=\"Purchase.py\" method=\"get\">");
      printf(" <input type=\"hidden\" name=\"username\" value=\"%s\">",
             username);
      printf("<table class=\"items\" align = \"center\">");
      printf("<tr>");
      printf("<th> The nebula </th>");
      printf("<th> The galaxy </th>");
      printf(" </tr>");
      printf("<tr>");
      printf("<td> It's shiny</td>");
      printf("</tr>");
      printf("<td><input type=\"checkbox\" name=\"checkneb\">Add to cart</td>");
      printf("<td><input type=\"checkbox\" name=\"checkgal\">Add to cart</td>");
      printf("<tr>");
      printf("<td> Enter purchase amount:<input type=\"positive floating-point "
             "number\" name=\"neb\" value=\"0\"></td>");
      printf("<td> Enter purchase amount:<input type=\"number\" name=\"gal\" "
             "value=\"0\"></td>");
      printf("</tr>");
      printf("<tr>");
      printf("<td><input type=\"submit\" value=\"Purchase\"></td>");
      printf("</body>");
      printf("</html>");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
lea    0xe0c(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe0d(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x1e4(%rbp)
lea    0xdf3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x1f0(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x1f8(%rbp)
lea    0xdda(%rip),%rdi
lea    0xddb(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x1f0(%rbp)
je     12bf <main+0xff>
mov    -0x1f0(%rbp),%rdi
lea    0xdce(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    12bf <main+0xff>
cmpq   $0x28,-0x18(%rbp)
jle    12d2 <main+0x112>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1625 <main+0x465>
lea    -0x1e0(%rbp),%rdi
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %eax,%esi
mov    0x2cfe(%rip),%rax
mov    (%rax),%rdx
call   1070 <fgets@plt>
lea    -0x1e0(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd83(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    -0x1e0(%rbp),%rdi
call   10a0 <getinput@plt>
mov    %rax,-0x200(%rbp)
mov    -0x218(%rbp),%rdi
call   10a0 <getinput@plt>
mov    %rax,-0x208(%rbp)
mov    $0xc0,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x220(%rbp)
mov    -0x220(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    $0xc0,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     145e <main+0x29e>
mov    -0x220(%rbp),%rdi
lea    0xd0d(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xcf9(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x200(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1459 <main+0x299>
xor    %eax,%eax
mov    %eax,%edi
lea    0xccb(%rip),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x208(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x228(%rbp),%rax
movb   $0xa,(%rax,%rcx,1)
mov    $0x1,%al
test   $0x1,%al
jne    140b <main+0x24b>
jmp    1430 <main+0x270>
mov    -0x30(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x208(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x230(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x208(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1454 <main+0x294>
movl   $0x1,-0x1e4(%rbp)
jmp    1459 <main+0x299>
jmp    135f <main+0x19f>
mov    -0x50(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x1e4(%rbp)
jne    14b1 <main+0x2f1>
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc4e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1620 <main+0x460>
mov    -0x1f8(%rbp),%rdi
mov    -0x200(%rbp),%rdx
lea    0xcd3(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x1f8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x200(%rbp),%rsi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xb86(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1625 <main+0x465>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
mov    %rsp,%r14
lea    0xe15(%rip),%rdi
lea    0xe27(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r15
lea    0xe1a(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbp
lea    0xdfc(%rip),%rdi
lea    0xe13(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r12
lea    0xe06(%rip),%rdi
lea    0xe07(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe19(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe16(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe13(%rip),%rbx
test   %rbp,%rbp
je     1551 <main+0x381>
lea    0xdff(%rip),%rsi
lea    0x28(%rsp),%rdx
mov    %rbp,%rdi
call   10d0 <sscanf@plt>
cmp    $0x1,%eax
jne    1551 <main+0x381>
mov    0x28(%rsp),%rsi
cmp    $0x28,%rsi
jg     1551 <main+0x381>
mov    %r12,0x10(%rsp)
mov    %r14,0x8(%rsp)
add    $0x1,%esi
mov    0x2d3e(%rip),%rax
mov    (%rax),%rdx
lea    0x30(%rsp),%r12
mov    %r12,%rdi
call   1080 <fgets@plt>
lea    0xdd6(%rip),%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   10f0 <strtok@plt>
xor    %r14d,%r14d
xor    %edi,%edi
mov    %rbp,%rsi
call   10f0 <strtok@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   10b0 <getinput@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10b0 <getinput@plt>
mov    %rax,0x18(%rsp)
mov    $0xc0,%edi
call   10c0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xc0,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1512 <main+0x342>
lea    0xd78(%rip),%r13
mov    0x18(%rsp),%r12
jmp    1348 <main+0x178>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r14d
mov    %rbx,%rdi
mov    $0xc0,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13ba <main+0x1ea>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10f0 <strtok@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
mov    %rax,%rdi
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1333 <main+0x163>
mov    %r14,0x20(%rsp)
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1060 <strlen@plt>
movb   $0xa,(%r14,%rax,1)
mov    %r12,%rdi
call   1060 <strlen@plt>
movb   $0x0,(%r14,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
je     1330 <main+0x160>
mov    0x20(%rsp),%rax
mov    %eax,%ecx
jmp    1330 <main+0x160>
mov    %r15,%rdi
call   1050 <fclose@plt>
test   %r14d,%r14d
je     151a <main+0x34a>
lea    0xdad(%rip),%rsi
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rdx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd9e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd97(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd90(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdb8(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdd9(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdf2(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xde5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdd1(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xedb(%rip),%rbx
lea    0xc6e(%rip),%rbp
lea    0xe9d(%rip),%rdi
jmp    153b <main+0x36b>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xc4a(%rip),%rbx
lea    0xb97(%rip),%rbp
lea    0xb60(%rip),%rdi
mov    0x8(%rsp),%r14
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rsp
xor    %eax,%eax
add    $0x1c8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [12 x i8] c"Members.csv\00"
@.str.1 = [13 x i8] c"LoggedIn.csv\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [8 x i8] c"%s%c%c\0A\00"
@.str.6 = [42 x i8] c"Content-Type:text/html;charset=iso-8859-1\00"
@.str.7 = [11 x i8] c"<!DOCTYPE>\00"
@.str.8 = [7 x i8] c"<html>\00"
@.str.9 = [4 x i8] c"%ld\00"
@.str.10 = [35 x i8] c"<p>There seems to be an error </p>\00"
@stdin = global i32* null
@.str.11 = [2 x i8] c"&\00"
@.str.12 = [2 x i8] c",\00"
@.str.13 = [26 x i8] c"<title>LOGIN</title><br>\0A\00"
@.str.14 = [48 x i8] c"<center>There was an error with your login!<br>\00"
@.str.15 = [172 x i8] c"<a href=\22http://cs.mcgill.ca/~ysibou/\22>Click here to go back to the home page!</a> <a href=\22http://cs.mcgill.ca/~ysibou/login.html\22>Click here to login again!</a></center>\00"
@.str.16 = [8 x i8] c"</body>\00"
@.str.17 = [5 x i8] c"%s/n\00"
@.str.18 = [25 x i8] c"<title>Catalogue</title>\00"
@.str.19 = [7 x i8] c"<head>\00"
@.str.20 = [7 x i8] c"<body>\00"
@.str.21 = [54 x i8] c"<form name=\22input\22 action=\22Purchase.py\22 method=\22get\22>\00"
@.str.22 = [50 x i8] c" <input type=\22hidden\22 name=\22username\22 value=\22%s\22>\00"
@.str.23 = [39 x i8] c"<table class=\22items\22 align = \22center\22>\00"
@.str.24 = [5 x i8] c"<tr>\00"
@.str.25 = [22 x i8] c"<th> The nebula </th>\00"
@.str.26 = [22 x i8] c"<th> The galaxy </th>\00"
@.str.27 = [7 x i8] c" </tr>\00"
@.str.28 = [21 x i8] c"<td> It's shiny</td>\00"
@.str.29 = [6 x i8] c"</tr>\00"
@.str.30 = [60 x i8] c"<td><input type=\22checkbox\22 name=\22checkneb\22>Add to cart</td>\00"
@.str.31 = [60 x i8] c"<td><input type=\22checkbox\22 name=\22checkgal\22>Add to cart</td>\00"
@.str.32 = [99 x i8] c"<td> Enter purchase amount:<input type=\22positive floating-point number\22 name=\22neb\22 value=\220\22></td>\00"
@.str.33 = [75 x i8] c"<td> Enter purchase amount:<input type=\22number\22 name=\22gal\22 value=\220\22></td>\00"
@.str.34 = [48 x i8] c"<td><input type=\22submit\22 value=\22Purchase\22></td>\00"
@.str.35 = [8 x i8] c"</html>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca [400 x i8]
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = load i32, i32* @BUFSIZ
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
store i8* %25, i8** %7
%26 = alloca i8, i64 %24
store i64 %24, i64* %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %12
%27 = load i8*, i8** %11
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %13
store i32 0, i32* %15
%29 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i8* %29, i8** %16
%30 = load i8*, i8** %12
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %31, i32** %17
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 13, i32 10)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%35 = load i8*, i8** %16
%36 = icmp eq i8* %35, null
br i1 %36, label %44, label %37
37: ; preds = %2
%38 = load i8*, i8** %16
%39 = call i32 @sscanf(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i64* %6)
%40 = icmp ne i32 %39, 1
br i1 %40, label %44, label %41
41: ; preds = %37
%42 = load i64, i64* %6
%43 = icmp sgt i64 %42, 40
br i1 %43, label %44, label %46
44: ; preds = %41, %37, %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
br label %135
46: ; preds = %41
%47 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%48 = load i64, i64* %6
%49 = add nsw i64 %48, 1
%50 = trunc i64 %49 to i32
%51 = load i32*, i32** @stdin
%52 = call i64 @fgets(i8* %47, i32 %50, i32* %51)
%53 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%54 = call i8* @strtok(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i8* %54, i8** %9
%55 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i8* %55, i8** %9
%56 = load i8*, i8** %9
store i8* %56, i8** %21
%57 = getelementptr inbounds [400 x i8], [400 x i8]* %14, i64 0, i64 0
%58 = call i8* @getinput(i8* %57)
store i8* %58, i8** %18
%59 = load i8*, i8** %21
%60 = call i8* @getinput(i8* %59)
store i8* %60, i8** %19
%61 = call i8* @malloc(i32 192)
store i8* %61, i8** %22
br label %62
62: ; preds = %93, %46
%63 = load i8*, i8** %22
%64 = load i32*, i32** %13
%65 = call i64 @fgets(i8* %63, i32 192, i32* %64)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %94
67: ; preds = %62
%68 = load i8*, i8** %22
%69 = call i8* @strtok(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i8* %69, i8** %9
%70 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i8* %70, i8** %9
%71 = load i8*, i8** %9
%72 = load i8*, i8** %18
%73 = call i64 @strcmp(i8* %71, i8* %72)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %93
75: ; preds = %67
%76 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i8* %76, i8** %9
%77 = load i8*, i8** %9
%78 = load i8*, i8** %19
%79 = call i64 @strlen(i8* %78)
%80 = getelementptr inbounds i8, i8* %77, i64 %79
store i8 10, i8* %80
br i1 true, label %81, label %86
81: ; preds = %75
%82 = load i8*, i8** %9
%83 = load i8*, i8** %19
%84 = call i64 @strlen(i8* %83)
%85 = getelementptr inbounds i8, i8* %82, i64 %84
store i8 0, i8* %85
br label %86
86: ; preds = %81, %75
%87 = load i8*, i8** %19
%88 = load i8*, i8** %9
%89 = call i64 @strcmp(i8* %87, i8* %88)
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %92
91: ; preds = %86
store i32 1, i32* %15
br label %92
92: ; preds = %91, %86
br label %93
93: ; preds = %92, %67
br label %62
94: ; preds = %62
%95 = load i32*, i32** %13
%96 = call i32 @fclose(i32* %95)
%97 = load i32, i32* %15
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %104
99: ; preds = %94
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0))
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.15, i64 0, i64 0))
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
br label %134
104: ; preds = %94
%105 = load i32*, i32** %17
%106 = load i8*, i8** %18
%107 = call i32 @fprintf(i32* %105, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i8* %106)
%108 = load i32*, i32** %17
%109 = call i32 @fclose(i32* %108)
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0))
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.21, i64 0, i64 0))
%114 = load i8*, i8** %18
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.22, i64 0, i64 0), i8* %114)
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0))
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.25, i64 0, i64 0))
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.26, i64 0, i64 0))
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.27, i64 0, i64 0))
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.28, i64 0, i64 0))
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0))
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.30, i64 0, i64 0))
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.31, i64 0, i64 0))
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.32, i64 0, i64 0))
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.33, i64 0, i64 0))
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0))
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.34, i64 0, i64 0))
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.35, i64 0, i64 0))
br label %134
134: ; preds = %104, %99
br label %135
135: ; preds = %134, %44
%136 = load i8*, i8** %7
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [12 x i8] c"Members.csv\00"
@.str.1 = [13 x i8] c"LoggedIn.csv\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [8 x i8] c"%s%c%c\0A\00"
@.str.6 = [42 x i8] c"Content-Type:text/html;charset=iso-8859-1\00"
@.str.7 = [11 x i8] c"<!DOCTYPE>\00"
@.str.8 = [7 x i8] c"<html>\00"
@.str.9 = [4 x i8] c"%ld\00"
@.str.10 = [35 x i8] c"<p>There seems to be an error </p>\00"
@stdin = global i32* null
@.str.11 = [2 x i8] c"&\00"
@.str.12 = [2 x i8] c",\00"
@.str.14 = [48 x i8] c"<center>There was an error with your login!<br>\00"
@.str.15 = [172 x i8] c"<a href=\22http://cs.mcgill.ca/~ysibou/\22>Click here to go back to the home page!</a> <a href=\22http://cs.mcgill.ca/~ysibou/login.html\22>Click here to login again!</a></center>\00"
@.str.16 = [8 x i8] c"</body>\00"
@.str.17 = [5 x i8] c"%s/n\00"
@.str.18 = [25 x i8] c"<title>Catalogue</title>\00"
@.str.19 = [7 x i8] c"<head>\00"
@.str.20 = [7 x i8] c"<body>\00"
@.str.21 = [54 x i8] c"<form name=\22input\22 action=\22Purchase.py\22 method=\22get\22>\00"
@.str.22 = [50 x i8] c" <input type=\22hidden\22 name=\22username\22 value=\22%s\22>\00"
@.str.23 = [39 x i8] c"<table class=\22items\22 align = \22center\22>\00"
@.str.24 = [5 x i8] c"<tr>\00"
@.str.25 = [22 x i8] c"<th> The nebula </th>\00"
@.str.26 = [22 x i8] c"<th> The galaxy </th>\00"
@.str.27 = [7 x i8] c" </tr>\00"
@.str.28 = [21 x i8] c"<td> It's shiny</td>\00"
@.str.29 = [6 x i8] c"</tr>\00"
@.str.30 = [60 x i8] c"<td><input type=\22checkbox\22 name=\22checkneb\22>Add to cart</td>\00"
@.str.31 = [60 x i8] c"<td><input type=\22checkbox\22 name=\22checkgal\22>Add to cart</td>\00"
@.str.32 = [99 x i8] c"<td> Enter purchase amount:<input type=\22positive floating-point number\22 name=\22neb\22 value=\220\22></td>\00"
@.str.33 = [75 x i8] c"<td> Enter purchase amount:<input type=\22number\22 name=\22gal\22 value=\220\22></td>\00"
@.str.34 = [48 x i8] c"<td><input type=\22submit\22 value=\22Purchase\22></td>\00"
@.str.35 = [8 x i8] c"</html>\00"
@str = [25 x i8] c"<title>LOGIN</title><br>\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca [400 x i8]
%5 = bitcast i64* %3 to i8*
%6 = tail call i8* @llvm.stacksave()
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = getelementptr inbounds [400 x i8], [400 x i8]* %4, i64 0, i64 0
%9 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 13, i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%14 = icmp eq i8* %9, null
br i1 %14, label %88, label %15
15: ; preds = %2
%16 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i64* %3)
%17 = icmp ne i32 %16, 1
%18 = load i64, i64* %3
%19 = icmp sgt i64 %18, 40
%20 = select i1 %17, i1 true, i1 %19
br i1 %20, label %88, label %21
21: ; preds = %15
%22 = trunc i64 %18 to i32
%23 = add i32 %22, 1
%24 = load i32*, i32** @stdin
%25 = call i64 @fgets(i8* %8, i32 %23, i32* %24)
%26 = call i8* @strtok(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%27 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%28 = call i8* @getinput(i8* %8)
%29 = call i8* @getinput(i8* %27)
%30 = call dereferenceable_or_null(192) i8* @malloc(i32 192)
%31 = call i64 @fgets(i8* %30, i32 192, i32* %7)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %21
%34 = call i32 @fclose(i32* %7)
br label %57
35: ; preds = %21, %50
%36 = phi i32 [ %51, %50 ], [ 0, %21 ]
%37 = call i8* @strtok(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%38 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%39 = call i64 @strcmp(i8* %38, i8* %28)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %35
%42 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%43 = call i64 @strlen(i8* dereferenceable(1) %29)
%44 = getelementptr inbounds i8, i8* %42, i64 %43
store i8 10, i8* %44
%45 = call i64 @strlen(i8* dereferenceable(1) %29)
%46 = getelementptr inbounds i8, i8* %42, i64 %45
store i8 0, i8* %46
%47 = call i64 @strcmp(i8* %29, i8* %42)
%48 = icmp eq i64 %47, 0
%49 = select i1 %48, i32 1, i32 %36
br label %50
50: ; preds = %41, %35
%51 = phi i32 [ %36, %35 ], [ %49, %41 ]
%52 = call i64 @fgets(i8* %30, i32 192, i32* %7)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %35
54: ; preds = %50
%55 = call i32 @fclose(i32* %7)
%56 = icmp eq i32 %51, 0
br i1 %56, label %57, label %59
57: ; preds = %33, %54
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %82
59: ; preds = %54
%60 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i8* %28)
%61 = call i32 @fclose(i32* %10)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.21, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.22, i64 0, i64 0), i8* %28)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.25, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.26, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.27, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.28, i64 0, i64 0))
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0))
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.30, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.31, i64 0, i64 0))
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str.32, i64 0, i64 0))
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.33, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
br label %82
82: ; preds = %59, %57
%83 = phi i8* [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), %57 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.34, i64 0, i64 0), %59 ]
%84 = phi i8* [ getelementptr inbounds ([172 x i8], [172 x i8]* @.str.15, i64 0, i64 0), %57 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), %59 ]
%85 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), %57 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.35, i64 0, i64 0), %59 ]
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %83)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %84)
br label %88
88: ; preds = %82, %2, %15
%89 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), %15 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), %2 ], [ %85, %82 ]
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %89)
ret i32 0
}