#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*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char const *, char *, char *, char *, char *, char *);
bool parse(const char *line) {
  char method[20], request_target[8190], HTTP_version[20], CRLF[20];
  if (line == NULL) {
    return false;
  } else {
    sscanf(line, "%s %s %s %s", method, request_target, HTTP_version, CRLF);
    printf("Method: %s\n", method);
    printf("Request Target: %s\n", request_target);
    printf("HTTP Version: %s\n", method);
    printf("CRLF: %s\n", method);
    return true;
  }
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2070,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <parse+0x26>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <parse+0x99>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x2030(%rbp),%rcx
lea    -0x2050(%rbp),%r8
lea    -0x2070(%rbp),%r9
lea    0xe96(%rip),%rsi
call   1040 <sscanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    -0x2030(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
test   %rdi,%rdi
je     119f <parse+0x7f>
push   %r14
push   %rbx
sub    $0x2068,%rsp
lea    0xeca(%rip),%rsi
lea    0x40(%rsp),%rbx
lea    0x60(%rsp),%r14
lea    0x20(%rsp),%r8
mov    %rsp,%r9
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <sscanf@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x2068,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s %s %s %s\00"
@.str.1 = [12 x i8] c"Method: %s\0A\00"
@.str.2 = [20 x i8] c"Request Target: %s\0A\00"
@.str.3 = [18 x i8] c"HTTP Version: %s\0A\00"
@.str.4 = [10 x i8] c"CRLF: %s\0A\00"
define i32 @parse(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [20 x i8]
%5 = alloca [8190 x i8]
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %26
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [8190 x i8], [8190 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%17 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14, i8* %15, i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [8190 x i8], [8190 x i8]* %5, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %24)
store i32 1, i32* %2
br label %26
26: ; preds = %11, %10
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s %s %s %s\00"
@.str.1 = [12 x i8] c"Method: %s\0A\00"
@.str.2 = [20 x i8] c"Request Target: %s\0A\00"
@.str.3 = [18 x i8] c"HTTP Version: %s\0A\00"
@.str.4 = [10 x i8] c"CRLF: %s\0A\00"
define i32 @parse(i8* %0) {
%2 = alloca [20 x i8]
%3 = alloca [8190 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [8190 x i8], [8190 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%10 = icmp eq i8* %0, null
br i1 %10, label %17, label %11
11: ; preds = %1
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* %8, i8* %9)
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %6)
br label %17
17: ; preds = %1, %11
%18 = phi i32 [ 1, %11 ], [ 0, %1 ]
ret i32 %18
}