#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
main() {
  char line[255], *userline, *passline, *s;
  char user[20], pass[20];
  printf("Content-Type: text/html\n\n");
  printf("<html><head></head>");
  printf("<body>");
  fgets(line, 255, stdin);
  printf("Parameters are: <br />");
  userline = strtok(line, "&");
  passline = strtok(0, "&");
  user[0] = 0;
  if (userline) {
    s = strtok(userline, "=");
    s = strtok(0, "=");
    if (s)
      strcpy(user, s);
  }
  pass[0] = 0;
  if (passline) {
    s = strtok(passline, "=");
    s = strtok(0, "=");
    if (s)
      strcpy(pass, s);
  }
  printf("%s, %s", user, pass);
  printf("</body>");
  printf("</html>");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1050 <fgets@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x118(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe83(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x120(%rbp)
movb   $0x0,-0x140(%rbp)
cmpq   $0x0,-0x118(%rbp)
je     1241 <main+0x101>
mov    -0x118(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x128(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe3f(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     123c <main+0xfc>
lea    -0x140(%rbp),%rdi
mov    -0x128(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1241 <main+0x101>
movb   $0x0,-0x160(%rbp)
cmpq   $0x0,-0x120(%rbp)
je     12ad <main+0x16d>
mov    -0x120(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x128(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xdd3(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     12a8 <main+0x168>
lea    -0x160(%rbp),%rdi
mov    -0x128(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12ad <main+0x16d>
lea    -0x140(%rbp),%rsi
lea    -0x160(%rbp),%rdx
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
lea    0xeea(%rip),%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7e(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <strtok@plt>
mov    %rax,%r14
movb   $0x0,0x20(%rsp)
test   %rbx,%rbx
je     1207 <main+0xb7>
lea    0xe54(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strtok@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     1207 <main+0xb7>
lea    0x20(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movb   $0x0,(%rsp)
test   %r14,%r14
je     123c <main+0xec>
lea    0xe1d(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     123c <main+0xec>
mov    %rsp,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xdf3(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdde(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Content-Type: text/html\0A\0A\00"
@.str.1 = [20 x i8] c"<html><head></head>\00"
@.str.2 = [7 x i8] c"<body>\00"
@stdin = global i32 0
@.str.3 = [23 x i8] c"Parameters are: <br />\00"
@.str.4 = [2 x i8] c"&\00"
@.str.5 = [2 x i8] c"=\00"
@.str.6 = [7 x i8] c"%s, %s\00"
@.str.7 = [8 x i8] c"</body>\00"
@.str.8 = [8 x i8] c"</html>\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 255, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%16 = call i8* @strtok(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* %16, i8** %3
%17 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* %17, i8** %4
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
store i8 0, i8* %18
%19 = load i8*, i8** %3
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %32
21: ; preds = %0
%22 = load i8*, i8** %3
%23 = call i8* @strtok(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %23, i8** %5
%24 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %24, i8** %5
%25 = load i8*, i8** %5
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%29 = load i8*, i8** %5
%30 = call i32 @strcpy(i8* %28, i8* %29)
br label %31
31: ; preds = %27, %21
br label %32
32: ; preds = %31, %0
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %33
%34 = load i8*, i8** %4
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %47
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = call i8* @strtok(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %38, i8** %5
%39 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %39, i8** %5
%40 = load i8*, i8** %5
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%44 = load i8*, i8** %5
%45 = call i32 @strcpy(i8* %43, i8* %44)
br label %46
46: ; preds = %42, %36
br label %47
47: ; preds = %46, %32
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%49 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %48, i8* %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"<html><head></head>\00"
@.str.2 = [7 x i8] c"<body>\00"
@stdin = global i32 0
@.str.3 = [23 x i8] c"Parameters are: <br />\00"
@.str.4 = [2 x i8] c"&\00"
@.str.5 = [2 x i8] c"=\00"
@.str.6 = [7 x i8] c"%s, %s\00"
@.str.7 = [8 x i8] c"</body>\00"
@.str.8 = [8 x i8] c"</html>\00"
@str = [25 x i8] c"Content-Type: text/html\0A\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %4, i32 255, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%13 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%14 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8 0, i8* %5
%15 = icmp eq i8* %13, null
br i1 %15, label %22, label %16
16: ; preds = %0
%17 = call i8* @strtok(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%18 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @strcpy(i8* %5, i8* %18)
br label %22
22: ; preds = %16, %20, %0
store i8 0, i8* %6
%23 = icmp eq i8* %14, null
br i1 %23, label %30, label %24
24: ; preds = %22
%25 = call i8* @strtok(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = call i32 @strcpy(i8* %6, i8* %26)
br label %30
30: ; preds = %24, %28, %22
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %6)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}