#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 */
char *index(char *, char);
int strlen(char *);
char *getfield(char *newline) {
  static char *line = NULL;
  char *end, *field, *x;
  if (newline)
    line = newline;
  if (line == NULL)
    return NULL;
  field = line;
  if (*field == '"') {
    field++;
    x = index(field, '"');
    if (!x)
      return NULL;
    *x = '\0';
    x++;
    if (*x == '\n')
      line = NULL;
    else
      line = x;
    end = x;
    line++;
    goto end1;
  }
  if ((end = (char *)index(line, ':')) == NULL) {
    line = NULL;
    if ((end = (char *)index(field, '\n')) == NULL)
      end = field + strlen(field);
  } else
    line = end + 1;
end1:
  *end = '\0';
  return (field);
}


x86 assembly (clang, -O0):
<getfield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1142 <getfield+0x22>
mov    -0x10(%rbp),%rax
mov    %rax,0x2ef6(%rip)
cmpq   $0x0,0x2eee(%rip)
jne    115d <getfield+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    129a <getfield+0x17a>
mov    0x2ed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    120b <getfield+0xeb>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x22,%esi
call   1040 <index@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11ae <getfield+0x8e>
movq   $0x0,-0x8(%rbp)
jmp    129a <getfield+0x17a>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    11e1 <getfield+0xc1>
movq   $0x0,0x2e5c(%rip)
jmp    11ec <getfield+0xcc>
mov    -0x28(%rbp),%rax
mov    %rax,0x2e4c(%rip)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e3d(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2e32(%rip)
jmp    128b <getfield+0x16b>
mov    0x2e26(%rip),%rdi
mov    $0x3a,%esi
call   1040 <index@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1277 <getfield+0x157>
movq   $0x0,0x2e03(%rip)
mov    -0x20(%rbp),%rdi
mov    $0xa,%esi
call   1040 <index@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1272 <getfield+0x152>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1286 <getfield+0x166>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x2db2(%rip)
jmp    128b <getfield+0x16b>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfield>:
push   %rbx
test   %rdi,%rdi
je     1132 <getfield+0x12>
mov    %rdi,%rbx
mov    %rdi,0x2f08(%rip)
jmp    113e <getfield+0x1e>
mov    0x2eff(%rip),%rbx
test   %rbx,%rbx
je     119c <getfield+0x7c>
cmpb   $0x22,(%rbx)
jne    117a <getfield+0x5a>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x22,%esi
call   1040 <index@plt>
test   %rax,%rax
je     119c <getfield+0x7c>
mov    %rax,%rcx
movb   $0x0,(%rax)
add    $0x1,%rax
xor    %edx,%edx
cmpb   $0xa,0x1(%rcx)
cmovne %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x2ec0(%rip)
jmp    11ca <getfield+0xaa>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1040 <index@plt>
test   %rax,%rax
je     11a0 <getfield+0x80>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2e9e(%rip)
jmp    11ca <getfield+0xaa>
xor    %ebx,%ebx
jmp    11cd <getfield+0xad>
movq   $0x0,0x2e8d(%rip)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <index@plt>
test   %rax,%rax
jne    11ca <getfield+0xaa>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@getfield.line = internal global i8* null
define i8* @getfield(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** @getfield.line
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** @getfield.line
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* null, i8** %2
br label %66
15: ; preds = %11
%16 = load i8*, i8** @getfield.line
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 34
br i1 %20, label %21, label %44
21: ; preds = %15
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
%24 = load i8*, i8** %5
%25 = call i8* @index(i8* %24, i8 signext 34)
store i8* %25, i8** %6
%26 = load i8*, i8** %6
%27 = icmp ne i8* %26, null
br i1 %27, label %29, label %28
28: ; preds = %21
store i8* null, i8** %2
br label %66
29: ; preds = %21
%30 = load i8*, i8** %6
store i8 0, i8* %30
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %6
%33 = load i8*, i8** %6
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %29
store i8* null, i8** @getfield.line
br label %40
38: ; preds = %29
%39 = load i8*, i8** %6
store i8* %39, i8** @getfield.line
br label %40
40: ; preds = %38, %37
%41 = load i8*, i8** %6
store i8* %41, i8** %4
%42 = load i8*, i8** @getfield.line
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** @getfield.line
br label %63
44: ; preds = %15
%45 = load i8*, i8** @getfield.line
%46 = call i8* @index(i8* %45, i8 signext 58)
store i8* %46, i8** %4
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %59
48: ; preds = %44
store i8* null, i8** @getfield.line
%49 = load i8*, i8** %5
%50 = call i8* @index(i8* %49, i8 signext 10)
store i8* %50, i8** %4
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i8*, i8** %5
%54 = load i8*, i8** %5
%55 = call i32 @strlen(i8* %54)
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %53, i64 %56
store i8* %57, i8** %4
br label %58
58: ; preds = %52, %48
br label %62
59: ; preds = %44
%60 = load i8*, i8** %4
%61 = getelementptr inbounds i8, i8* %60, i64 1
store i8* %61, i8** @getfield.line
br label %62
62: ; preds = %59, %58
br label %63
63: ; preds = %62, %40
%64 = load i8*, i8** %4
store i8 0, i8* %64
%65 = load i8*, i8** %5
store i8* %65, i8** %2
br label %66
66: ; preds = %63, %28, %14
%67 = load i8*, i8** %2
ret i8* %67
}

LLVM IR (-O2):
@getfield.line = internal unnamed_addr global i8* null
define i8* @getfield(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %4, label %3
3: ; preds = %1
store i8* %0, i8** @getfield.line
br label %7
4: ; preds = %1
%5 = load i8*, i8** @getfield.line
%6 = icmp eq i8* %5, null
br i1 %6, label %36, label %7
7: ; preds = %3, %4
%8 = phi i8* [ %0, %3 ], [ %5, %4 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 34
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = tail call i8* @index(i8* %12, i8 signext 34)
%14 = icmp eq i8* %13, null
br i1 %14, label %36, label %15
15: ; preds = %11
store i8 0, i8* %13
%16 = getelementptr inbounds i8, i8* %13, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 10
%19 = select i1 %18, i8* null, i8* %16
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8* %20, i8** @getfield.line
br label %33
21: ; preds = %7
%22 = tail call i8* @index(i8* %8, i8 signext 58)
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %31
24: ; preds = %21
store i8* null, i8** @getfield.line
%25 = tail call i8* @index(i8* %8, i8 signext 10)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = tail call i32 @strlen(i8* %8)
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %8, i64 %29
br label %33
31: ; preds = %21
%32 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %32, i8** @getfield.line
br label %33
33: ; preds = %31, %27, %24, %15
%34 = phi i8* [ %16, %15 ], [ %30, %27 ], [ %25, %24 ], [ %22, %31 ]
%35 = phi i8* [ %12, %15 ], [ %8, %27 ], [ %8, %24 ], [ %8, %31 ]
store i8 0, i8* %34
br label %36
36: ; preds = %11, %4, %33
%37 = phi i8* [ %35, %33 ], [ null, %4 ], [ null, %11 ]
ret i8* %37
}