#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*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
char *strtok(char *, char const *);
int parse_field(char *one_line, char *field_id, char *field_body) {
  const char SEPCHARS[] = " \n";
  char *tmp1, *tmp2, *tmp3;
  tmp1 = strtok(one_line, SEPCHARS);
  tmp2 = strtok(NULL, " ");
  tmp3 = strtok(NULL, SEPCHARS);
  if (tmp1 == NULL || tmp2 == NULL || tmp3 == NULL) {
    fprintf(stderr, "parse_field finds unrecognized line structure: %s\n",
            strerror(errno));
    return 0;
  }
  strcpy(field_id, tmp1);
  strcpy(field_body, tmp3);
  return 1;
}


x86 assembly (clang, -O0):
<parse_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x23(%rbp),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe7f(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x38(%rbp)
lea    -0x23(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1050 <strtok@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11bf <parse_field+0x7f>
cmpq   $0x0,-0x38(%rbp)
je     11bf <parse_field+0x7f>
cmpq   $0x0,-0x40(%rbp)
jne    11f7 <parse_field+0xb7>
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xe1f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1218 <parse_field+0xd8>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_field>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
movb   $0x0,0x6(%rsp)
movw   $0xa20,0x4(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <strtok@plt>
mov    %rax,%r13
lea    0xe8f(%rip),%rsi
xor    %r12d,%r12d
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rax,%rbp
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
test   %r13,%r13
je     11bb <parse_field+0x7b>
test   %rbp,%rbp
je     11bb <parse_field+0x7b>
mov    %rax,%rbx
test   %rax,%rax
je     11bb <parse_field+0x7b>
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    $0x1,%r12d
jmp    11e3 <parse_field+0xa3>
mov    0x2e1e(%rip),%rax
mov    (%rax),%ebx
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe2c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.parse_field.SEPCHARS = [3 x i8] c" \0A\00"
@.str = [2 x i8] c" \00"
@stderr = global i32 0
@.str.1 = [51 x i8] c"parse_field finds unrecognized line structure: %s\0A\00"
@errno = global i32 0
define i32 @parse_field(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [3 x i8]
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%12 = bitcast [3 x i8]* %8 to i8*
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%15 = call i8* @strtok(i8* %13, i8* %14)
store i8* %15, i8** %9
%16 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %10
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%18 = call i8* @strtok(i8* null, i8* %17)
store i8* %18, i8** %11
%19 = load i8*, i8** %9
%20 = icmp eq i8* %19, null
br i1 %20, label %27, label %21
21: ; preds = %3
%22 = load i8*, i8** %10
%23 = icmp eq i8* %22, null
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i8*, i8** %11
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %32
27: ; preds = %24, %21, %3
%28 = load i32, i32* @stderr
%29 = load i32, i32* @errno
%30 = call i8* @strerror(i32 %29)
%31 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %30)
store i32 0, i32* %4
br label %39
32: ; preds = %24
%33 = load i8*, i8** %6
%34 = load i8*, i8** %9
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = load i8*, i8** %7
%37 = load i8*, i8** %11
%38 = call i32 @strcpy(i8* %36, i8* %37)
store i32 1, i32* %4
br label %39
39: ; preds = %32, %27
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
@__const.parse_field.SEPCHARS = [3 x i8] c" \0A\00"
@.str = [2 x i8] c" \00"
@stderr = global i32 0
@.str.1 = [51 x i8] c"parse_field finds unrecognized line structure: %s\0A\00"
@errno = global i32 0
define i32 @parse_field(i8* %0, i8* %1, i8* %2) {
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%6 = call i8* @strtok(i8* %0, i8* %5)
%7 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @strtok(i8* null, i8* %5)
%9 = icmp eq i8* %6, null
%10 = icmp eq i8* %7, null
%11 = select i1 %9, i1 true, i1 %10
%12 = icmp eq i8* %8, null
%13 = select i1 %11, i1 true, i1 %12
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = load i32, i32* @errno
%17 = tail call i8* @strerror(i32 %16)
%18 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %22
19: ; preds = %3
%20 = tail call i32 @strcpy(i8* %1, i8* %6)
%21 = tail call i32 @strcpy(i8* %2, i8* %8)
br label %22
22: ; preds = %19, %14
%23 = phi i32 [ 0, %14 ], [ 1, %19 ]
ret i32 %23
}