#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getStat(char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ *strdup(char *);
char *strtok(int /*<<< orphan*/ *, char *);
int main(int argc, char *argv[]) {
  int i;
  printf("Cache-Control: no-cache, no-store, must-revalidate\n");
  printf("Pragma: no-cache\n");
  printf("Expires: 0\n");
  printf("Content-Type: text/javascript\n\n");
  char *queryString = getenv("QUERY_STRING");
  if (queryString != NULL) {
    char *queryParam;
    queryParam = strtok(strdup(queryString), "=");
    if (queryParam != NULL) {
      queryParam = strtok(NULL, "=");
      if (queryParam != NULL) {
        queryParam = strtok(strdup(queryParam), "&");
        if (queryParam != NULL) {
          getStat(queryParam);
        }
      }
    }
  }
  fflush(stdout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
lea    0xeab(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1246 <main+0xe6>
mov    -0x20(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,%rdi
lea    0xeab(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1241 <main+0xe1>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8c(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     123c <main+0xdc>
mov    -0x28(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,%rdi
lea    0xe67(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1237 <main+0xd7>
mov    -0x28(%rbp),%rdi
call   1040 <getStat@plt>
jmp    123c <main+0xdc>
jmp    1241 <main+0xe1>
jmp    1246 <main+0xe6>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
lea    0xed4(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11f5 <main+0x95>
mov    %rax,%rdi
call   1080 <strdup@plt>
lea    0xe5c(%rip),%rsi
mov    %rax,%rdi
call   1070 <strtok@plt>
test   %rax,%rax
je     11f5 <main+0x95>
lea    0xe48(%rip),%rsi
xor    %edi,%edi
call   1070 <strtok@plt>
test   %rax,%rax
je     11f5 <main+0x95>
mov    %rax,%rdi
call   1080 <strdup@plt>
lea    0xe2f(%rip),%rsi
mov    %rax,%rdi
call   1070 <strtok@plt>
test   %rax,%rax
je     11f5 <main+0x95>
mov    %rax,%rdi
call   1050 <getStat@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Cache-Control: no-cache, no-store, must-revalidate\0A\00"
@.str.1 = [18 x i8] c"Pragma: no-cache\0A\00"
@.str.2 = [12 x i8] c"Expires: 0\0A\00"
@.str.3 = [32 x i8] c"Content-Type: text/javascript\0A\0A\00"
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [2 x i8] c"=\00"
@.str.6 = [2 x i8] c"&\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%13 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %38
16: ; preds = %2
%17 = load i8*, i8** %7
%18 = call i32* @strdup(i8* %17)
%19 = call i8* @strtok(i32* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %19, i8** %8
%20 = load i8*, i8** %8
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %37
22: ; preds = %16
%23 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i8*, i8** %8
%28 = call i32* @strdup(i8* %27)
%29 = call i8* @strtok(i32* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i8*, i8** %8
%34 = call i32 @getStat(i8* %33)
br label %35
35: ; preds = %32, %26
br label %36
36: ; preds = %35, %22
br label %37
37: ; preds = %36, %16
br label %38
38: ; preds = %37, %2
%39 = load i32, i32* @stdout
%40 = call i32 @fflush(i32 %39)
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [2 x i8] c"=\00"
@.str.6 = [2 x i8] c"&\00"
@stdout = global i32 0
@str = [51 x i8] c"Cache-Control: no-cache, no-store, must-revalidate\00"
@str.7 = [17 x i8] c"Pragma: no-cache\00"
@str.8 = [11 x i8] c"Expires: 0\00"
@str.9 = [31 x i8] c"Content-Type: text/javascript\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.9, i64 0, i64 0))
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %22, label %9
9: ; preds = %2
%10 = tail call i32* @strdup(i8* %7)
%11 = tail call i8* @strtok(i32* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %22, label %13
13: ; preds = %9
%14 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = tail call i32* @strdup(i8* %14)
%18 = tail call i8* @strtok(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 @getStat(i8* %18)
br label %22
22: ; preds = %9, %16, %20, %13, %2
%23 = load i32, i32* @stdout
%24 = tail call i32 @fflush(i32 %23)
ret i32 0
}