#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 */
struct log_file_entry {
  int dummy;
};

/* Variables and functions */
struct log_file_entry *entry_malloc();
int /*<<< orphan*/ free_entry(struct log_file_entry *);
int /*<<< orphan*/ parse_client_field(struct log_file_entry *, char const *,
                                      int *);
int /*<<< orphan*/ parse_identity_field(struct log_file_entry *, char const *,
                                        int *);
int /*<<< orphan*/ parse_referer_field(struct log_file_entry *, char const *,
                                       int *);
int /*<<< orphan*/ parse_request_field(struct log_file_entry *, char const *,
                                       int *);
int /*<<< orphan*/ parse_size_field(struct log_file_entry *, char const *,
                                    int *);
int /*<<< orphan*/ parse_status_code_field(struct log_file_entry *,
                                           char const *, int *);
int /*<<< orphan*/ parse_time_field(struct log_file_entry *, char const *,
                                    int *);
int /*<<< orphan*/ parse_user_agent_field(struct log_file_entry *, char const *,
                                          int *);
int /*<<< orphan*/ parse_user_id_field(struct log_file_entry *, char const *,
                                       int *);
struct log_file_entry *parse_line(const char *line) {
  struct log_file_entry *entry;
  int current_position = 0;
  entry = entry_malloc();
  if (!parse_client_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_identity_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_user_id_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_time_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_request_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_status_code_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_size_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_referer_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  if (!parse_user_agent_field(entry, line, &current_position)) {
    free_entry(entry);
    return NULL;
  }
  return entry;
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1080 <entry_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <parse_client_field@plt>
cmp    $0x0,%eax
jne    11fe <parse_line+0x4e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10c0 <parse_identity_field@plt>
cmp    $0x0,%eax
jne    122e <parse_line+0x7e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10a0 <parse_user_id_field@plt>
cmp    $0x0,%eax
jne    125e <parse_line+0xae>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10b0 <parse_time_field@plt>
cmp    $0x0,%eax
jne    128e <parse_line+0xde>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <parse_request_field@plt>
cmp    $0x0,%eax
jne    12be <parse_line+0x10e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1090 <parse_status_code_field@plt>
cmp    $0x0,%eax
jne    12ee <parse_line+0x13e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <parse_size_field@plt>
cmp    $0x0,%eax
jne    131e <parse_line+0x16e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <parse_referer_field@plt>
cmp    $0x0,%eax
jne    134e <parse_line+0x19e>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <parse_user_agent_field@plt>
cmp    $0x0,%eax
jne    137e <parse_line+0x1ce>
mov    -0x18(%rbp),%rdi
call   1070 <free_entry@plt>
movq   $0x0,-0x8(%rbp)
jmp    1386 <parse_line+0x1d6>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1080 <entry_malloc@plt>
mov    %rax,%rbx
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <parse_client_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <parse_identity_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <parse_user_id_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <parse_time_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <parse_request_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <parse_status_code_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <parse_size_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <parse_referer_field@plt>
test   %eax,%eax
je     1285 <parse_line+0xd5>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <parse_user_agent_field@plt>
test   %eax,%eax
jne    128f <parse_line+0xdf>
mov    %rbx,%rdi
call   1070 <free_entry@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.log_file_entry = type { i32 }
define %struct.log_file_entry* @parse_line(i8* %0) {
%2 = alloca %struct.log_file_entry*
%3 = alloca i8*
%4 = alloca %struct.log_file_entry*
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %5
%6 = call %struct.log_file_entry* (...) @entry_malloc()
store %struct.log_file_entry* %6, %struct.log_file_entry** %4
%7 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%8 = load i8*, i8** %3
%9 = call i32 @parse_client_field(%struct.log_file_entry* %7, i8* %8, i32* %5)
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %1
%12 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%13 = call i32 @free_entry(%struct.log_file_entry* %12)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
14: ; preds = %1
%15 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%16 = load i8*, i8** %3
%17 = call i32 @parse_identity_field(%struct.log_file_entry* %15, i8* %16, i32* %5)
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %14
%20 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%21 = call i32 @free_entry(%struct.log_file_entry* %20)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
22: ; preds = %14
%23 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%24 = load i8*, i8** %3
%25 = call i32 @parse_user_id_field(%struct.log_file_entry* %23, i8* %24, i32* %5)
%26 = icmp ne i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %22
%28 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%29 = call i32 @free_entry(%struct.log_file_entry* %28)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
30: ; preds = %22
%31 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%32 = load i8*, i8** %3
%33 = call i32 @parse_time_field(%struct.log_file_entry* %31, i8* %32, i32* %5)
%34 = icmp ne i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %30
%36 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%37 = call i32 @free_entry(%struct.log_file_entry* %36)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
38: ; preds = %30
%39 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%40 = load i8*, i8** %3
%41 = call i32 @parse_request_field(%struct.log_file_entry* %39, i8* %40, i32* %5)
%42 = icmp ne i32 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %38
%44 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%45 = call i32 @free_entry(%struct.log_file_entry* %44)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
46: ; preds = %38
%47 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%48 = load i8*, i8** %3
%49 = call i32 @parse_status_code_field(%struct.log_file_entry* %47, i8* %48, i32* %5)
%50 = icmp ne i32 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %46
%52 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%53 = call i32 @free_entry(%struct.log_file_entry* %52)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
54: ; preds = %46
%55 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%56 = load i8*, i8** %3
%57 = call i32 @parse_size_field(%struct.log_file_entry* %55, i8* %56, i32* %5)
%58 = icmp ne i32 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %54
%60 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%61 = call i32 @free_entry(%struct.log_file_entry* %60)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
62: ; preds = %54
%63 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%64 = load i8*, i8** %3
%65 = call i32 @parse_referer_field(%struct.log_file_entry* %63, i8* %64, i32* %5)
%66 = icmp ne i32 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %62
%68 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%69 = call i32 @free_entry(%struct.log_file_entry* %68)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
70: ; preds = %62
%71 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%72 = load i8*, i8** %3
%73 = call i32 @parse_user_agent_field(%struct.log_file_entry* %71, i8* %72, i32* %5)
%74 = icmp ne i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %70
%76 = load %struct.log_file_entry*, %struct.log_file_entry** %4
%77 = call i32 @free_entry(%struct.log_file_entry* %76)
store %struct.log_file_entry* null, %struct.log_file_entry** %2
br label %80
78: ; preds = %70
%79 = load %struct.log_file_entry*, %struct.log_file_entry** %4
store %struct.log_file_entry* %79, %struct.log_file_entry** %2
br label %80
80: ; preds = %78, %75, %67, %59, %51, %43, %35, %27, %19, %11
%81 = load %struct.log_file_entry*, %struct.log_file_entry** %2
ret %struct.log_file_entry* %81
}

LLVM IR (-O2):
%struct.log_file_entry = type { i32 }
define %struct.log_file_entry* @parse_line(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call %struct.log_file_entry* (...) @entry_malloc()
%5 = call i32 @parse_client_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %31, label %7
7: ; preds = %1
%8 = call i32 @parse_identity_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %31, label %10
10: ; preds = %7
%11 = call i32 @parse_user_id_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%12 = icmp eq i32 %11, 0
br i1 %12, label %31, label %13
13: ; preds = %10
%14 = call i32 @parse_time_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %31, label %16
16: ; preds = %13
%17 = call i32 @parse_request_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%18 = icmp eq i32 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %16
%20 = call i32 @parse_status_code_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%21 = icmp eq i32 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = call i32 @parse_size_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%24 = icmp eq i32 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = call i32 @parse_referer_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%27 = icmp eq i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i32 @parse_user_agent_field(%struct.log_file_entry* %4, i8* %0, i32* %2)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28, %25, %22, %19, %16, %13, %10, %7, %1
%32 = call i32 @free_entry(%struct.log_file_entry* %4)
br label %33
33: ; preds = %31, %28
%34 = phi %struct.log_file_entry* [ %4, %28 ], [ null, %31 ]
ret %struct.log_file_entry* %34
}