#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 atoi(char *);
int /*<<< orphan*/ err_abort(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
char *realloc(char *, int);
int /*<<< orphan*/ send_html(int, char *, char *);
int /*<<< orphan*/ send_post_calculation(int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
char *strstr(char *, char *);
char *strtok(char *, char *);
void scan_request(int sockfd, char *rootDir) {
  int n;
  int headerSize = 1;
  char requestBuffer[255 + 1];
  char *request = (char *)malloc(sizeof(char) * 255);
  for (;;) {
    n = read(sockfd, requestBuffer, 255);
    requestBuffer[n] = '\0';
    sprintf(request, "%s%s", request, requestBuffer);
    if (n == 0) {
      err_abort("Header empty\n");
    } else if (n < 0) {
      err_abort("Fehler beim Lesen des Sockets!");
    } else if (n < 255) {
      printf("Request komplett (%d chunks)!\n", headerSize);
      break;
    }
    headerSize++;
    request = realloc(request, headerSize * sizeof(char) * 255);
  }
  char *header = request;
  char *body = strstr(request, "\r\n\r\n");
  header[body - header] = '\0';
  body = &body[4];
  printf("header:\n%s\n", header);
  printf("body:\n%s\n", body);
  char *command = strtok(header, " ");
  printf("command: %s\n", command);
  if (strcmp(command, "GET") == 0) {
    char path[255];
    sprintf(path, "%s%s", rootDir, strtok(NULL, " "));
    char *version;
    version = strtok(NULL, "\n");
    printf("path: %s\nversion: %s\n", path, version);
    free(request);
    send_html(sockfd, path, version);
  } else if (strcmp(command, "POST") == 0) {
    strtok(body, "=");
    int num1 = atoi(strtok(NULL, "&"));
    strtok(NULL, "=");
    int num2 = atoi(strtok(NULL, "&"));
    free(request);
    send_post_calculation(sockfd, num1, num2);
  } else {
    free(request);
    err_abort("Header invalid!\n");
  }
}


x86 assembly (clang, -O0):
<scan_request>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    $0xff,%edi
call   1090 <malloc@plt>
mov    %rax,-0x128(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xff,%edx
call   1060 <read@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x128(%rbp),%rdi
mov    -0x128(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xdc7(%rip),%rsi
call   10e0 <sprintf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1259 <scan_request+0x89>
lea    0xdb6(%rip),%rdi
call   10a0 <err_abort@plt>
jmp    12a1 <scan_request+0xd1>
cmpl   $0x0,-0x14(%rbp)
jge    1274 <scan_request+0xa4>
lea    0xda9(%rip),%rdi
call   10a0 <err_abort@plt>
jmp    129c <scan_request+0xcc>
cmpl   $0xff,-0x14(%rbp)
jge    1297 <scan_request+0xc7>
mov    -0x18(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d3 <scan_request+0x103>
jmp    129c <scan_request+0xcc>
jmp    12a1 <scan_request+0xd1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x128(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x0,%rax
imul   $0xff,%rax,%rax
mov    %eax,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x128(%rbp)
jmp    11fa <scan_request+0x2a>
mov    -0x128(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x128(%rbp),%rdi
lea    0xd62(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x138(%rbp)
mov    -0x130(%rbp),%rax
mov    -0x138(%rbp),%rcx
mov    -0x130(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x138(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x138(%rbp)
mov    -0x130(%rbp),%rsi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x138(%rbp),%rsi
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x130(%rbp),%rdi
lea    0xd0b(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rsi
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x140(%rbp),%rdi
lea    0xceb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    143f <scan_request+0x26f>
lea    -0x240(%rbp),%rax
mov    %rax,-0x260(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x258(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xca9(%rip),%rsi
call   10c0 <strtok@plt>
mov    -0x260(%rbp),%rdi
mov    -0x258(%rbp),%rdx
mov    %rax,%rcx
lea    0xc20(%rip),%rsi
call   10e0 <sprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xc64(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x248(%rbp)
lea    -0x240(%rbp),%rsi
mov    -0x248(%rbp),%rdx
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x128(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%edi
lea    -0x240(%rbp),%rsi
mov    -0x248(%rbp),%rdx
call   1080 <send_html@plt>
jmp    14fd <scan_request+0x32d>
mov    -0x140(%rbp),%rdi
lea    0xc48(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14e0 <scan_request+0x310>
mov    -0x138(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   10c0 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xc22(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x24c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc02(%rip),%rsi
call   10c0 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xbf4(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x250(%rbp)
mov    -0x128(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%edi
mov    -0x24c(%rbp),%esi
mov    -0x250(%rbp),%edx
call   1050 <send_post_calculation@plt>
jmp    14f8 <scan_request+0x328>
mov    -0x128(%rbp),%rdi
call   1030 <free@plt>
lea    0xbab(%rip),%rdi
call   10a0 <err_abort@plt>
jmp    14fd <scan_request+0x32d>
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_request>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,0x8(%rsp)
mov    %edi,0x4(%rsp)
mov    $0xff,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    $0x1,%ebp
mov    $0x1fe,%ebx
lea    0x10(%rsp),%r13
jmp    122b <scan_request+0x5b>
nopl   0x0(%rax,%rax,1)
call   10a0 <err_abort@plt>
add    $0x1,%ebp
mov    %r12,%rdi
mov    %ebx,%esi
call   10b0 <realloc@plt>
mov    %rax,%r12
add    $0xff,%ebx
mov    0x4(%rsp),%edi
mov    %r13,%rsi
mov    $0xff,%edx
call   1060 <read@plt>
mov    %eax,%r15d
movslq %eax,%r14
movb   $0x0,0x10(%rsp,%r14,1)
mov    %r12,%rdi
lea    0xdae(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   10e0 <sprintf@plt>
lea    0xda1(%rip),%rdi
test   %r14d,%r14d
je     1210 <scan_request+0x40>
lea    0xda3(%rip),%rdi
js     1210 <scan_request+0x40>
cmp    $0xfe,%r15d
ja     1215 <scan_request+0x45>
lea    0xdb0(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdbf(%rip),%rsi
mov    %r12,%rdi
call   10f0 <strstr@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x4,%rbx
lea    0xdab(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xda6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd9f(%rip),%rsi
mov    %r12,%rdi
call   10c0 <strtok@plt>
mov    %rax,%rbp
lea    0xd8f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd8b(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     132e <scan_request+0x15e>
lea    0xd91(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1399 <scan_request+0x1c9>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xd7a(%rip),%rdi
call   10a0 <err_abort@plt>
jmp    13f9 <scan_request+0x229>
lea    0xd37(%rip),%rsi
xor    %edi,%edi
call   10c0 <strtok@plt>
lea    0xcbd(%rip),%rsi
lea    0x110(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rdx
mov    %rax,%rcx
call   10e0 <sprintf@plt>
lea    0xcf2(%rip),%rsi
xor    %edi,%edi
call   10c0 <strtok@plt>
mov    %rax,%rbp
lea    0xd0c(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1080 <send_html@plt>
jmp    13f9 <scan_request+0x229>
lea    0xcfa(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <strtok@plt>
lea    0xcea(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %r14,%rsi
call   10c0 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <send_post_calculation@plt>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [14 x i8] c"Header empty\0A\00"
@.str.2 = [31 x i8] c"Fehler beim Lesen des Sockets!\00"
@.str.3 = [31 x i8] c"Request komplett (%d chunks)!\0A\00"
@.str.4 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.5 = [12 x i8] c"header:\0A%s\0A\00"
@.str.6 = [10 x i8] c"body:\0A%s\0A\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [13 x i8] c"command: %s\0A\00"
@.str.9 = [4 x i8] c"GET\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [22 x i8] c"path: %s\0Aversion: %s\0A\00"
@.str.12 = [5 x i8] c"POST\00"
@.str.13 = [2 x i8] c"=\00"
@.str.14 = [2 x i8] c"&\00"
@.str.15 = [17 x i8] c"Header invalid!\0A\00"
define void @scan_request(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [255 x i8]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1, i32* %6
%16 = call i64 @malloc(i32 255)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %8
br label %18
18: ; preds = %46, %2
%19 = load i32, i32* %3
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%21 = call i32 @read(i32 %19, i8* %20, i32 255)
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %23
store i8 0, i8* %24
%25 = load i8*, i8** %8
%26 = load i8*, i8** %8
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%28 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %27)
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %18
%32 = call i32 @err_abort(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %46
33: ; preds = %18
%34 = load i32, i32* %5
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @err_abort(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %45
38: ; preds = %33
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 255
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %6
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %56
44: ; preds = %38
br label %45
45: ; preds = %44, %36
br label %46
46: ; preds = %45, %31
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
%49 = load i8*, i8** %8
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 1
%53 = mul i64 %52, 255
%54 = trunc i64 %53 to i32
%55 = call i8* @realloc(i8* %49, i32 %54)
store i8* %55, i8** %8
br label %18
56: ; preds = %41
%57 = load i8*, i8** %8
store i8* %57, i8** %9
%58 = load i8*, i8** %8
%59 = call i8* @strstr(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8* %59, i8** %10
%60 = load i8*, i8** %9
%61 = load i8*, i8** %10
%62 = load i8*, i8** %9
%63 = ptrtoint i8* %61 to i64
%64 = ptrtoint i8* %62 to i64
%65 = sub i64 %63, %64
%66 = getelementptr inbounds i8, i8* %60, i64 %65
store i8 0, i8* %66
%67 = load i8*, i8** %10
%68 = getelementptr inbounds i8, i8* %67, i64 4
store i8* %68, i8** %10
%69 = load i8*, i8** %9
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %69)
%71 = load i8*, i8** %10
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %71)
%73 = load i8*, i8** %9
%74 = call i8* @strtok(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i8* %74, i8** %11
%75 = load i8*, i8** %11
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %75)
%77 = load i8*, i8** %11
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %95
80: ; preds = %56
%81 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%82 = load i8*, i8** %4
%83 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%84 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %82, i8* %83)
%85 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i8* %85, i8** %13
%86 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%87 = load i8*, i8** %13
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %86, i8* %87)
%89 = load i8*, i8** %8
%90 = call i32 @free(i8* %89)
%91 = load i32, i32* %3
%92 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%93 = load i8*, i8** %13
%94 = call i32 @send_html(i32 %91, i8* %92, i8* %93)
br label %118
95: ; preds = %56
%96 = load i8*, i8** %11
%97 = call i64 @strcmp(i8* %96, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %113
99: ; preds = %95
%100 = load i8*, i8** %10
%101 = call i8* @strtok(i8* %100, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%102 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%103 = call i32 @atoi(i8* %102)
store i32 %103, i32* %14
%104 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%105 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%106 = call i32 @atoi(i8* %105)
store i32 %106, i32* %15
%107 = load i8*, i8** %8
%108 = call i32 @free(i8* %107)
%109 = load i32, i32* %3
%110 = load i32, i32* %14
%111 = load i32, i32* %15
%112 = call i32 @send_post_calculation(i32 %109, i32 %110, i32 %111)
br label %117
113: ; preds = %95
%114 = load i8*, i8** %8
%115 = call i32 @free(i8* %114)
%116 = call i32 @err_abort(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
br label %117
117: ; preds = %113, %99
br label %118
118: ; preds = %117, %80
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [14 x i8] c"Header empty\0A\00"
@.str.2 = [31 x i8] c"Fehler beim Lesen des Sockets!\00"
@.str.3 = [31 x i8] c"Request komplett (%d chunks)!\0A\00"
@.str.4 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.5 = [12 x i8] c"header:\0A%s\0A\00"
@.str.6 = [10 x i8] c"body:\0A%s\0A\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [13 x i8] c"command: %s\0A\00"
@.str.9 = [4 x i8] c"GET\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [22 x i8] c"path: %s\0Aversion: %s\0A\00"
@.str.12 = [5 x i8] c"POST\00"
@.str.13 = [2 x i8] c"=\00"
@.str.14 = [2 x i8] c"&\00"
@.str.15 = [17 x i8] c"Header invalid!\0A\00"
define void @scan_request(i32 %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = tail call i64 @malloc(i32 255)
%7 = inttoptr i64 %6 to i8*
br label %8
8: ; preds = %37, %2
%9 = phi i8* [ %7, %2 ], [ %40, %37 ]
%10 = phi i32 [ 1, %2 ], [ %38, %37 ]
%11 = call i32 @read(i32 %0, i8* %5, i32 255)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %12
store i8 0, i8* %13
%14 = call i32 @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %5)
%15 = icmp eq i32 %11, 0
br i1 %15, label %34, label %16
16: ; preds = %8
%17 = icmp slt i32 %11, 0
br i1 %17, label %34, label %18
18: ; preds = %16
%19 = icmp ult i32 %11, 255
br i1 %19, label %20, label %37
20: ; preds = %18
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%22 = call i8* @strstr(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%23 = ptrtoint i8* %22 to i64
%24 = ptrtoint i8* %9 to i64
%25 = sub i64 %23, %24
%26 = getelementptr inbounds i8, i8* %9, i64 %25
store i8 0, i8* %26
%27 = getelementptr inbounds i8, i8* %22, i64 4
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %27)
%30 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %30)
%32 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %41, label %49
34: ; preds = %16, %8
%35 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), %16 ]
%36 = call i32 @err_abort(i8* %35)
br label %37
37: ; preds = %34, %18
%38 = add nuw nsw i32 %10, 1
%39 = mul i32 %38, 255
%40 = call i8* @realloc(i8* %9, i32 %39)
br label %8
41: ; preds = %20
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%43 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%44 = call i32 @sprintf(i8* %42, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %43)
%45 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %42, i8* %45)
%47 = call i32 @free(i8* %9)
%48 = call i32 @send_html(i32 %0, i8* %42, i8* %45)
br label %64
49: ; preds = %20
%50 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = call i8* @strtok(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%54 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%55 = call i32 @atoi(i8* %54)
%56 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%57 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%58 = call i32 @atoi(i8* %57)
%59 = call i32 @free(i8* %9)
%60 = call i32 @send_post_calculation(i32 %0, i32 %55, i32 %58)
br label %64
61: ; preds = %49
%62 = call i32 @free(i8* %9)
%63 = call i32 @err_abort(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
br label %64
64: ; preds = %52, %61, %41
ret void
}