#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*/ buf;

/* Variables and functions */
scalar_t__ http_read_line(int, char *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sprintf(char *, char *, ...);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ url_decode(char *, char *);
const char *http_request_line(int fd, char *reqpath, char *env,
                              size_t *env_len) {
  static char buf[8192];
  char *sp1, *sp2, *qp, *envp = env;
  if (http_read_line(fd, buf, sizeof(buf)) < 0)
    return "Socket IO error";
  sp1 = strchr(buf, ' ');
  if (!sp1)
    return "Cannot parse HTTP request (1)";
  *sp1 = '\0';
  sp1++;
  if (*sp1 != '/')
    return "Bad request path";
  sp2 = strchr(sp1, ' ');
  if (!sp2)
    return "Cannot parse HTTP request (2)";
  *sp2 = '\0';
  sp2++;
  if (strcmp(buf, "GET") && strcmp(buf, "POST"))
    return "Unsupported request (not GET or POST)";
  envp += sprintf(envp, "REQUEST_METHOD=%s", buf) + 1;
  envp += sprintf(envp, "SERVER_PROTOCOL=%s", sp2) + 1;
  if ((qp = strchr(sp1, '?'))) {
    *qp = '\0';
    envp += sprintf(envp, "QUERY_STRING=%s", qp + 1) + 1;
  }
  url_decode(reqpath, sp1);
  envp += sprintf(envp, "REQUEST_URI=%s", reqpath) + 1;
  envp += sprintf(envp, "SERVER_NAME=zoobar.org") + 1;
  *envp = 0;
  *env_len = envp - env + 1;
  printf("env_len = %zu\n", *env_len);
  for (int i = 0; i < *env_len; i++)
    printf("%c", env[i]);
  printf("\n");
  return NULL;
}


x86 assembly (clang, -O0):
<http_request_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%edi
lea    0x2ed7(%rip),%rsi
mov    $0x2000,%edx
call   1070 <http_read_line@plt>
cmp    $0x0,%rax
jge    11ad <http_request_line+0x4d>
lea    0xe5c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13ff <http_request_line+0x29f>
lea    0x2eac(%rip),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11dd <http_request_line+0x7d>
lea    0xe3c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13ff <http_request_line+0x29f>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1210 <http_request_line+0xb0>
lea    0xe27(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13ff <http_request_line+0x29f>
mov    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    123d <http_request_line+0xdd>
lea    0xe0b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13ff <http_request_line+0x29f>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
lea    0x2e09(%rip),%rdi
lea    0xdff(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     129a <http_request_line+0x13a>
lea    0x2dec(%rip),%rdi
lea    0xde6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     129a <http_request_line+0x13a>
lea    0xdd5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    13ff <http_request_line+0x29f>
mov    -0x48(%rbp),%rdi
lea    0xde7(%rip),%rsi
lea    0x2db4(%rip),%rdx
mov    $0x0,%al
call   1080 <sprintf@plt>
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     132a <http_request_line+0x1ca>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rdx
add    $0x1,%rdx
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <url_decode@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rax,%rcx
add    $0x1,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jae    13e9 <http_request_line+0x289>
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13b0 <http_request_line+0x250>
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_request_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
lea    0x2ee5(%rip),%rsi
mov    $0x2000,%edx
call   1080 <http_read_line@plt>
test   %rax,%rax
js     1214 <http_request_line+0xa4>
lea    0x2ecf(%rip),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1220 <http_request_line+0xb0>
mov    %rax,%rbx
movb   $0x0,(%rax)
cmpb   $0x2f,0x1(%rax)
jne    122c <http_request_line+0xbc>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1238 <http_request_line+0xc8>
mov    %rax,%r13
movb   $0x0,(%rax)
lea    0x2e91(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1244 <http_request_line+0xd4>
lea    0x2e79(%rip),%rdi
lea    0xe63(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1244 <http_request_line+0xd4>
lea    0xe57(%rip),%rax
jmp    134f <http_request_line+0x1df>
lea    0xde5(%rip),%rax
jmp    134f <http_request_line+0x1df>
lea    0xde9(%rip),%rax
jmp    134f <http_request_line+0x1df>
lea    0xdfb(%rip),%rax
jmp    134f <http_request_line+0x1df>
lea    0xe00(%rip),%rax
jmp    134f <http_request_line+0x1df>
add    $0x1,%r13
lea    0xe3d(%rip),%rsi
lea    0x2e1a(%rip),%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %rax,%rbp
lea    (%rax,%r12,1),%rdi
add    $0x1,%rdi
add    %r12,%rbp
lea    0xe29(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
lea    (%rax,%rbp,1),%r13
add    $0x2,%r13
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     12bb <http_request_line+0x14b>
movb   $0x0,(%rax)
add    $0x1,%rax
lea    0xe0a(%rip),%rsi
mov    %r13,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
add    %rax,%r13
add    $0x1,%r13
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <url_decode@plt>
lea    0xdf4(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
lea    (%rax,%r13,1),%rbx
lea    (%rax,%r13,1),%rdi
add    $0x1,%rdi
lea    0xde3(%rip),%rsi
xor    %eax,%eax
call   1090 <sprintf@plt>
lea    (%rax,%rbx,1),%rsi
add    $0x2,%rsi
movb   $0x0,0x2(%rax,%rbx,1)
sub    %r12,%rsi
add    $0x1,%rsi
mov    %rsi,(%r14)
lea    0xdd5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpq   $0x0,(%r14)
je     1343 <http_request_line+0x1d3>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,(%r14)
ja     1330 <http_request_line+0x1c0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@http_request_line.buf = internal global [8192 x i8] zeroinitializer
@.str = [16 x i8] c"Socket IO error\00"
@.str.1 = [30 x i8] c"Cannot parse HTTP request (1)\00"
@.str.2 = [17 x i8] c"Bad request path\00"
@.str.3 = [30 x i8] c"Cannot parse HTTP request (2)\00"
@.str.4 = [4 x i8] c"GET\00"
@.str.5 = [5 x i8] c"POST\00"
@.str.6 = [38 x i8] c"Unsupported request (not GET or POST)\00"
@.str.7 = [18 x i8] c"REQUEST_METHOD=%s\00"
@.str.8 = [19 x i8] c"SERVER_PROTOCOL=%s\00"
@.str.9 = [16 x i8] c"QUERY_STRING=%s\00"
@.str.10 = [15 x i8] c"REQUEST_URI=%s\00"
@.str.11 = [23 x i8] c"SERVER_NAME=zoobar.org\00"
@.str.12 = [15 x i8] c"env_len = %zu\0A\00"
@.str.13 = [3 x i8] c"%c\00"
@.str.14 = [2 x i8] c"\0A\00"
define i8* @http_request_line(i32 %0, i8* %1, i8* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i64* %3, i64** %9
%15 = load i8*, i8** %8
store i8* %15, i8** %13
%16 = load i32, i32* %6
%17 = call i64 @http_read_line(i32 %16, i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i32 8192)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %4
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %5
br label %119
20: ; preds = %4
%21 = call i8* @strchr(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8 signext 32)
store i8* %21, i8** %10
%22 = load i8*, i8** %10
%23 = icmp ne i8* %22, null
br i1 %23, label %25, label %24
24: ; preds = %20
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %119
25: ; preds = %20
%26 = load i8*, i8** %10
store i8 0, i8* %26
%27 = load i8*, i8** %10
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %10
%29 = load i8*, i8** %10
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 47
br i1 %32, label %33, label %34
33: ; preds = %25
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %119
34: ; preds = %25
%35 = load i8*, i8** %10
%36 = call i8* @strchr(i8* %35, i8 signext 32)
store i8* %36, i8** %11
%37 = load i8*, i8** %11
%38 = icmp ne i8* %37, null
br i1 %38, label %40, label %39
39: ; preds = %34
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %119
40: ; preds = %34
%41 = load i8*, i8** %11
store i8 0, i8* %41
%42 = load i8*, i8** %11
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %11
%44 = call i64 @strcmp(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = call i64 @strcmp(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %46
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %119
50: ; preds = %46, %40
%51 = load i8*, i8** %13
%52 = call i64 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0))
%53 = add nsw i64 %52, 1
%54 = load i8*, i8** %13
%55 = getelementptr inbounds i8, i8* %54, i64 %53
store i8* %55, i8** %13
%56 = load i8*, i8** %13
%57 = load i8*, i8** %11
%58 = call i64 (i8*, i8*, ...) @sprintf(i8* %56, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %57)
%59 = add nsw i64 %58, 1
%60 = load i8*, i8** %13
%61 = getelementptr inbounds i8, i8* %60, i64 %59
store i8* %61, i8** %13
%62 = load i8*, i8** %10
%63 = call i8* @strchr(i8* %62, i8 signext 63)
store i8* %63, i8** %12
%64 = icmp ne i8* %63, null
br i1 %64, label %65, label %74
65: ; preds = %50
%66 = load i8*, i8** %12
store i8 0, i8* %66
%67 = load i8*, i8** %13
%68 = load i8*, i8** %12
%69 = getelementptr inbounds i8, i8* %68, i64 1
%70 = call i64 (i8*, i8*, ...) @sprintf(i8* %67, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* %69)
%71 = add nsw i64 %70, 1
%72 = load i8*, i8** %13
%73 = getelementptr inbounds i8, i8* %72, i64 %71
store i8* %73, i8** %13
br label %74
74: ; preds = %65, %50
%75 = load i8*, i8** %7
%76 = load i8*, i8** %10
%77 = call i32 @url_decode(i8* %75, i8* %76)
%78 = load i8*, i8** %13
%79 = load i8*, i8** %7
%80 = call i64 (i8*, i8*, ...) @sprintf(i8* %78, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* %79)
%81 = add nsw i64 %80, 1
%82 = load i8*, i8** %13
%83 = getelementptr inbounds i8, i8* %82, i64 %81
store i8* %83, i8** %13
%84 = load i8*, i8** %13
%85 = call i64 (i8*, i8*, ...) @sprintf(i8* %84, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%86 = add nsw i64 %85, 1
%87 = load i8*, i8** %13
%88 = getelementptr inbounds i8, i8* %87, i64 %86
store i8* %88, i8** %13
%89 = load i8*, i8** %13
store i8 0, i8* %89
%90 = load i8*, i8** %13
%91 = load i8*, i8** %8
%92 = ptrtoint i8* %90 to i64
%93 = ptrtoint i8* %91 to i64
%94 = sub i64 %92, %93
%95 = add nsw i64 %94, 1
%96 = load i64*, i64** %9
store i64 %95, i64* %96
%97 = load i64*, i64** %9
%98 = load i64, i64* %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i64 %98)
store i32 0, i32* %14
br label %100
100: ; preds = %114, %74
%101 = load i32, i32* %14
%102 = sext i32 %101 to i64
%103 = load i64*, i64** %9
%104 = load i64, i64* %103
%105 = icmp ult i64 %102, %104
br i1 %105, label %106, label %117
106: ; preds = %100
%107 = load i8*, i8** %8
%108 = load i32, i32* %14
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %112)
br label %114
114: ; preds = %106
%115 = load i32, i32* %14
%116 = add nsw i32 %115, 1
store i32 %116, i32* %14
br label %100
117: ; preds = %100
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i8* null, i8** %5
br label %119
119: ; preds = %117, %49, %39, %33, %24, %19
%120 = load i8*, i8** %5
ret i8* %120
}

LLVM IR (-O2):
@http_request_line.buf = internal global [8192 x i8] zeroinitializer
@.str = [16 x i8] c"Socket IO error\00"
@.str.1 = [30 x i8] c"Cannot parse HTTP request (1)\00"
@.str.2 = [17 x i8] c"Bad request path\00"
@.str.3 = [30 x i8] c"Cannot parse HTTP request (2)\00"
@.str.4 = [4 x i8] c"GET\00"
@.str.5 = [5 x i8] c"POST\00"
@.str.6 = [38 x i8] c"Unsupported request (not GET or POST)\00"
@.str.7 = [18 x i8] c"REQUEST_METHOD=%s\00"
@.str.8 = [19 x i8] c"SERVER_PROTOCOL=%s\00"
@.str.9 = [16 x i8] c"QUERY_STRING=%s\00"
@.str.10 = [15 x i8] c"REQUEST_URI=%s\00"
@.str.11 = [23 x i8] c"SERVER_NAME=zoobar.org\00"
@.str.12 = [15 x i8] c"env_len = %zu\0A\00"
define i8* @http_request_line(i32 %0, i8* %1, i8* %2, i64* nocapture %3) {
%5 = tail call i64 @http_read_line(i32 %0, i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i32 8192)
%6 = icmp slt i64 %5, 0
br i1 %6, label %65, label %7
7: ; preds = %4
%8 = tail call i8* @strchr(i8* dereferenceable(1) getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8 signext 32)
%9 = icmp eq i8* %8, null
br i1 %9, label %65, label %10
10: ; preds = %7
store i8 0, i8* %8
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 47
br i1 %13, label %14, label %65
14: ; preds = %10
%15 = tail call i8* @strchr(i8* %11, i8 signext 32)
%16 = icmp eq i8* %15, null
br i1 %16, label %65, label %17
17: ; preds = %14
store i8 0, i8* %15
%18 = getelementptr inbounds i8, i8* %15, i64 1
%19 = tail call i64 @strcmp(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = tail call i64 @strcmp(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %65
24: ; preds = %21, %17
%25 = tail call i64 (i8*, i8*, ...) @sprintf(i8* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @http_request_line.buf, i64 0, i64 0))
%26 = add nsw i64 %25, 1
%27 = getelementptr inbounds i8, i8* %2, i64 %26
%28 = tail call i64 (i8*, i8*, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %18)
%29 = add nsw i64 %28, 1
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = tail call i8* @strchr(i8* %11, i8 signext 63)
%32 = icmp eq i8* %31, null
br i1 %32, label %38, label %33
33: ; preds = %24
store i8 0, i8* %31
%34 = getelementptr inbounds i8, i8* %31, i64 1
%35 = tail call i64 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* %34)
%36 = add nsw i64 %35, 1
%37 = getelementptr inbounds i8, i8* %30, i64 %36
br label %38
38: ; preds = %33, %24
%39 = phi i8* [ %37, %33 ], [ %30, %24 ]
%40 = tail call i32 @url_decode(i8* %1, i8* %11)
%41 = tail call i64 (i8*, i8*, ...) @sprintf(i8* %39, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* %1)
%42 = add nsw i64 %41, 1
%43 = getelementptr inbounds i8, i8* %39, i64 %42
%44 = tail call i64 (i8*, i8*, ...) @sprintf(i8* %43, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%45 = add nsw i64 %44, 1
%46 = getelementptr inbounds i8, i8* %43, i64 %45
store i8 0, i8* %46
%47 = ptrtoint i8* %46 to i64
%48 = ptrtoint i8* %2 to i64
%49 = sub i64 %47, %48
%50 = add nsw i64 %49, 1
store i64 %50, i64* %3
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i64 %50)
%52 = load i64, i64* %3
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %56, %38
%55 = tail call i32 @putchar(i32 10)
br label %65
56: ; preds = %38, %56
%57 = phi i64 [ %62, %56 ], [ 0, %38 ]
%58 = getelementptr inbounds i8, i8* %2, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = tail call i32 @putchar(i32 %60)
%62 = add nuw i64 %57, 1
%63 = load i64, i64* %3
%64 = icmp ugt i64 %63, %62
br i1 %64, label %56, label %54
65: ; preds = %21, %14, %10, %7, %4, %54
%66 = phi i8* [ null, %54 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), %21 ]
ret i8* %66
}