#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getfield(char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
void parse(FILE *outkline, FILE *outdline, char *line) {
  char conf_letter;
  char *tmp;
  char *user_field = NULL;
  char *passwd_field = NULL;
  char *host_field = NULL;
  char *operpasswd_field = NULL;
  tmp = getfield(line);
  conf_letter = *tmp;
  for (;;) {
    if ((host_field = getfield(NULL)) == NULL)
      return;
    if ((passwd_field = getfield(NULL)) == NULL)
      break;
    else {
      char *p;
      if ((p = strchr(passwd_field, '|'))) {
        *p++ = '\0';
        operpasswd_field = p;
      } else
        operpasswd_field = "";
    }
    if ((user_field = getfield(NULL)) == NULL)
      break;
    break;
  }
  if (!passwd_field) {
    passwd_field = "";
    operpasswd_field = "";
  }
  if (!user_field)
    user_field = "";
  switch (conf_letter) {
  case 'd':
    fprintf(stderr, "exempt in old file, ignoring.\n");
    break;
  case 'D':
    if (host_field && passwd_field)
      fprintf(outdline, "\"%s\",\"%s\",\"%s\",\"\",\"Unknown\",0\n", host_field,
              passwd_field, operpasswd_field);
    break;
  case 'K':
  case 'k':
    if (host_field && passwd_field && user_field)
      fprintf(outkline, "\"%s\",\"%s\",\"%s\",\"%s\",\"\",\"Unknown\",0\n",
              user_field, host_field, passwd_field, operpasswd_field);
    break;
  default:
    fprintf(stderr, "Error in config file: %s", line);
    break;
  }
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <getfield@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <getfield@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1196 <parse+0x66>
jmp    133b <parse+0x20b>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <getfield@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    11b2 <parse+0x82>
jmp    121e <parse+0xee>
mov    -0x38(%rbp),%rdi
mov    $0x7c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     11ed <parse+0xbd>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x50(%rbp)
movb   $0x0,(%rax)
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    11f8 <parse+0xc8>
lea    0xeca(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11fd <parse+0xcd>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <getfield@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1219 <parse+0xe9>
jmp    121e <parse+0xee>
jmp    121e <parse+0xee>
cmpq   $0x0,-0x38(%rbp)
jne    123f <parse+0x10f>
lea    0xe8e(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe83(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1255 <parse+0x125>
lea    0xe6d(%rip),%rax
mov    %rax,-0x30(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x27,%eax
ja     1320 <parse+0x1f0>
mov    -0x58(%rbp),%rax
lea    0xd8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133b <parse+0x20b>
cmpq   $0x0,-0x40(%rbp)
je     12d1 <parse+0x1a1>
cmpq   $0x0,-0x38(%rbp)
je     12d1 <parse+0x1a1>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x48(%rbp),%r8
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133b <parse+0x20b>
cmpq   $0x0,-0x40(%rbp)
je     131b <parse+0x1eb>
cmpq   $0x0,-0x38(%rbp)
je     131b <parse+0x1eb>
cmpq   $0x0,-0x30(%rbp)
je     131b <parse+0x1eb>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x30(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x48(%rbp),%r9
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133b <parse+0x20b>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rdx,%rdi
call   1030 <getfield@plt>
movsbl (%rax),%r14d
xor    %edi,%edi
call   1030 <getfield@plt>
test   %rax,%rax
je     119c <parse+0x6c>
mov    %rax,%r13
mov    %rbx,0x8(%rsp)
xor    %r12d,%r12d
xor    %edi,%edi
call   1030 <getfield@plt>
test   %rax,%rax
mov    %rbp,0x10(%rsp)
je     11ab <parse+0x7b>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x7c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11b7 <parse+0x87>
mov    %rax,%rbp
add    $0x1,%rbp
movb   $0x0,(%rax)
jmp    11be <parse+0x8e>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf0c(%rip),%rbp
mov    %rbp,%rbx
jmp    11c8 <parse+0x98>
lea    0xf00(%rip),%rbp
xor    %edi,%edi
call   1030 <getfield@plt>
mov    %rax,%r12
add    $0xffffffbc,%r14d
cmp    $0x27,%r14d
ja     1244 <parse+0x114>
lea    0xe27(%rip),%rax
movslq (%rax,%r14,4),%rcx
add    %rax,%rcx
jmp    *%rcx
test   %r12,%r12
lea    0xed2(%rip),%rdx
cmovne %r12,%rdx
lea    0xec8(%rip),%rsi
mov    0x10(%rsp),%rdi
mov    %r13,%rcx
mov    %rbx,%r8
mov    %rbp,%r9
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>
lea    0xea3(%rip),%rsi
mov    0x8(%rsp),%rdi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xe24(%rip),%rsi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [31 x i8] c"exempt in old file, ignoring.\0A\00"
@.str.2 = [31 x i8] c"\22%s\22,\22%s\22,\22%s\22,\22\22,\22Unknown\22,0\0A\00"
@.str.3 = [36 x i8] c"\22%s\22,\22%s\22,\22%s\22,\22%s\22,\22\22,\22Unknown\22,0\0A\00"
@.str.4 = [25 x i8] c"Error in config file: %s\00"
define void @parse(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i8* null, i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
store i8* null, i8** %12
%14 = load i8*, i8** %6
%15 = call i8* @getfield(i8* %14)
store i8* %15, i8** %8
%16 = load i8*, i8** %8
%17 = load i8, i8* %16
store i8 %17, i8* %7
br label %18
18: ; preds = %3
%19 = call i8* @getfield(i8* null)
store i8* %19, i8** %11
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %18
br label %91
22: ; preds = %18
%23 = call i8* @getfield(i8* null)
store i8* %23, i8** %10
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %26
25: ; preds = %22
br label %41
26: ; preds = %22
%27 = load i8*, i8** %10
%28 = call i8* @strchr(i8* %27, i8 signext 124)
store i8* %28, i8** %13
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i8*, i8** %13
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %13
store i8 0, i8* %31
%33 = load i8*, i8** %13
store i8* %33, i8** %12
br label %35
34: ; preds = %26
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %12
br label %35
35: ; preds = %34, %30
br label %36
36: ; preds = %35
%37 = call i8* @getfield(i8* null)
store i8* %37, i8** %9
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %36
br label %41
40: ; preds = %36
br label %41
41: ; preds = %40, %39, %25
%42 = load i8*, i8** %10
%43 = icmp ne i8* %42, null
br i1 %43, label %45, label %44
44: ; preds = %41
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %12
br label %45
45: ; preds = %44, %41
%46 = load i8*, i8** %9
%47 = icmp ne i8* %46, null
br i1 %47, label %49, label %48
48: ; preds = %45
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %9
br label %49
49: ; preds = %48, %45
%50 = load i8, i8* %7
%51 = sext i8 %50 to i32
switch i32 %51, label %87 [
i32 100, label %52
i32 68, label %55
i32 75, label %69
i32 107, label %69
]
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %91
55: ; preds = %49
%56 = load i8*, i8** %11
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %68
58: ; preds = %55
%59 = load i8*, i8** %10
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %68
61: ; preds = %58
%62 = load i32*, i32** %5
%63 = ptrtoint i32* %62 to i32
%64 = load i8*, i8** %11
%65 = load i8*, i8** %10
%66 = load i8*, i8** %12
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %64, i8* %65, i8* %66)
br label %68
68: ; preds = %61, %58, %55
br label %91
69: ; preds = %49, %49
%70 = load i8*, i8** %11
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %86
72: ; preds = %69
%73 = load i8*, i8** %10
%74 = icmp ne i8* %73, null
br i1 %74, label %75, label %86
75: ; preds = %72
%76 = load i8*, i8** %9
%77 = icmp ne i8* %76, null
br i1 %77, label %78, label %86
78: ; preds = %75
%79 = load i32*, i32** %4
%80 = ptrtoint i32* %79 to i32
%81 = load i8*, i8** %9
%82 = load i8*, i8** %11
%83 = load i8*, i8** %10
%84 = load i8*, i8** %12
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %81, i8* %82, i8* %83, i8* %84)
br label %86
86: ; preds = %78, %75, %72, %69
br label %91
87: ; preds = %49
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %6
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %21, %87, %86, %68, %52
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [31 x i8] c"exempt in old file, ignoring.\0A\00"
@.str.2 = [31 x i8] c"\22%s\22,\22%s\22,\22%s\22,\22\22,\22Unknown\22,0\0A\00"
@.str.3 = [36 x i8] c"\22%s\22,\22%s\22,\22%s\22,\22%s\22,\22\22,\22Unknown\22,0\0A\00"
@.str.4 = [25 x i8] c"Error in config file: %s\00"
define void @parse(i32* %0, i32* %1, i8* %2) {
%4 = tail call i8* @getfield(i8* %2)
%5 = load i8, i8* %4
%6 = tail call i8* @getfield(i8* null)
%7 = icmp eq i8* %6, null
br i1 %7, label %40, label %8
8: ; preds = %3
%9 = tail call i8* @getfield(i8* null)
%10 = icmp eq i8* %9, null
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = tail call i8* @strchr(i8* %9, i8 signext 124)
%13 = icmp eq i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = getelementptr inbounds i8, i8* %12, i64 1
store i8 0, i8* %12
br label %16
16: ; preds = %11, %14
%17 = phi i8* [ %15, %14 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %11 ]
%18 = tail call i8* @getfield(i8* null)
br label %19
19: ; preds = %16, %8
%20 = phi i8* [ %17, %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %8 ]
%21 = phi i8* [ %9, %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %8 ]
%22 = phi i8* [ %18, %16 ], [ null, %8 ]
%23 = sext i8 %5 to i32
switch i32 %23, label %37 [
i32 100, label %24
i32 68, label %27
i32 75, label %31
i32 107, label %31
]
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %40
27: ; preds = %19
%28 = ptrtoint i32* %1 to i64
%29 = trunc i64 %28 to i32
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %21, i8* %20)
br label %40
31: ; preds = %19, %19
%32 = icmp eq i8* %22, null
%33 = select i1 %32, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %22
%34 = ptrtoint i32* %0 to i64
%35 = trunc i64 %34 to i32
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %33, i8* %6, i8* %21, i8* %20)
br label %40
37: ; preds = %19
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %2)
br label %40
40: ; preds = %24, %37, %27, %31, %3
ret void
}