#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*/ name;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ error(char *, int);
int get_next_ch();
int /*<<< orphan*/ insert_destination(char *, char const *);
scalar_t__ isalnum(int);
scalar_t__ isspace(int);
char *parse_value();
char tolower(int);
int parse_alias_definition() {
  static char name[1024];
  const char *value;
  int c, len = 0;
  for (;;) {
    c = get_next_ch();
    if (c == EOF || isspace(c))
      break;
    if (!(isalnum(c) || (c) == '-')) {
      error("Invalid character '%c' in alias\n", c);
      return -1;
    }
    if (len >= sizeof(name))
      return -1;
    name[len++] = tolower(c);
  }
  name[len] = '\0';
  value = NULL;
  if (c != '\n') {
    value = parse_value();
    if (!value)
      return -1;
  }
  insert_destination(name, value);
  return 0;
}


x86 assembly (clang, -O0):
<parse_alias_definition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <get_next_ch@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
je     11ad <parse_alias_definition+0x3d>
mov    -0x14(%rbp),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
je     11b2 <parse_alias_definition+0x42>
jmp    122c <parse_alias_definition+0xbc>
mov    -0x14(%rbp),%edi
call   1050 <isalnum@plt>
cmp    $0x0,%rax
jne    11e9 <parse_alias_definition+0x79>
cmpl   $0x2d,-0x14(%rbp)
je     11e9 <parse_alias_definition+0x79>
mov    -0x14(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1090 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    128b <parse_alias_definition+0x11b>
movslq -0x18(%rbp),%rax
cmp    $0x400,%rax
jb     1205 <parse_alias_definition+0x95>
movl   $0xffffffff,-0x4(%rbp)
jmp    128b <parse_alias_definition+0x11b>
mov    -0x14(%rbp),%edi
call   1080 <tolower@plt>
mov    %al,%dl
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
movslq %eax,%rcx
lea    0x2e4c(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    117f <parse_alias_definition+0xf>
movslq -0x18(%rbp),%rcx
lea    0x2e39(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
movq   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x14(%rbp)
je     1274 <parse_alias_definition+0x104>
mov    $0x0,%al
call   1040 <parse_value@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    126f <parse_alias_definition+0xff>
movl   $0xffffffff,-0x4(%rbp)
jmp    128b <parse_alias_definition+0x11b>
jmp    1274 <parse_alias_definition+0x104>
mov    -0x10(%rbp),%rsi
lea    0x2df1(%rip),%rdi
call   1060 <insert_destination@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_alias_definition>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_next_ch@plt>
mov    %eax,%ebp
mov    0x2e5f(%rip),%r14
cmp    (%r14),%eax
je     11e5 <parse_alias_definition+0x75>
lea    0x2edb(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1070 <isspace@plt>
test   %rax,%rax
jne    11e3 <parse_alias_definition+0x73>
mov    %ebp,%edi
call   1050 <isalnum@plt>
test   %rax,%rax
jne    11bd <parse_alias_definition+0x4d>
cmp    $0x2d,%ebp
jne    1219 <parse_alias_definition+0xa9>
cmp    $0x400,%rbx
je     1227 <parse_alias_definition+0xb7>
mov    %ebp,%edi
call   1080 <tolower@plt>
mov    %al,(%rbx,%r15,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1030 <get_next_ch@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
jne    11a0 <parse_alias_definition+0x30>
mov    %ebx,%ebx
lea    0x2e84(%rip),%rax
movb   $0x0,(%rbx,%rax,1)
xor    %r14d,%r14d
cmp    $0xa,%ebp
jne    11fc <parse_alias_definition+0x8c>
xor    %esi,%esi
jmp    120b <parse_alias_definition+0x9b>
xor    %eax,%eax
call   1040 <parse_value@plt>
mov    %rax,%rsi
test   %rax,%rax
je     1227 <parse_alias_definition+0xb7>
lea    0x2e5e(%rip),%rdi
call   1060 <insert_destination@plt>
jmp    122d <parse_alias_definition+0xbd>
lea    0xde0(%rip),%rdi
mov    %ebp,%esi
call   1090 <error@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@parse_alias_definition.name = internal global [1024 x i8] zeroinitializer
@EOF = global i32 0
@.str = [33 x i8] c"Invalid character '%c' in alias\0A\00"
define i32 @parse_alias_definition() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %4
br label %5
5: ; preds = %30, %0
%6 = call i32 (...) @get_next_ch()
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = load i32, i32* %3
%12 = call i64 @isspace(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10, %5
br label %37
15: ; preds = %10
%16 = load i32, i32* %3
%17 = call i64 @isalnum(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 45
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %3
%24 = call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %23)
store i32 -1, i32* %1
br label %52
25: ; preds = %19, %15
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = icmp uge i64 %27, 1024
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 -1, i32* %1
br label %52
30: ; preds = %25
%31 = load i32, i32* %3
%32 = call signext i8 @tolower(i32 %31)
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 %35
store i8 %32, i8* %36
br label %5
37: ; preds = %14
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 %39
store i8 0, i8* %40
store i8* null, i8** %2
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 10
br i1 %42, label %43, label %49
43: ; preds = %37
%44 = call i8* (...) @parse_value()
store i8* %44, i8** %2
%45 = load i8*, i8** %2
%46 = icmp ne i8* %45, null
br i1 %46, label %48, label %47
47: ; preds = %43
store i32 -1, i32* %1
br label %52
48: ; preds = %43
br label %49
49: ; preds = %48, %37
%50 = load i8*, i8** %2
%51 = call i32 @insert_destination(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 0), i8* %50)
store i32 0, i32* %1
br label %52
52: ; preds = %49, %47, %29, %22
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@parse_alias_definition.name = internal global [1024 x i8] zeroinitializer
@EOF = global i32 0
@.str = [33 x i8] c"Invalid character '%c' in alias\0A\00"
define i32 @parse_alias_definition() {
%1 = tail call i32 (...) @get_next_ch()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %29, label %4
4: ; preds = %0, %18
%5 = phi i64 [ %20, %18 ], [ 0, %0 ]
%6 = phi i32 [ %22, %18 ], [ %1, %0 ]
%7 = tail call i64 @isspace(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %4
%10 = tail call i64 @isalnum(i32 %6)
%11 = icmp ne i64 %10, 0
%12 = icmp eq i32 %6, 45
%13 = or i1 %11, %12
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i32 @error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %40
16: ; preds = %9
%17 = icmp eq i64 %5, 1024
br i1 %17, label %40, label %18
18: ; preds = %16
%19 = tail call signext i8 @tolower(i32 %6)
%20 = add nuw nsw i64 %5, 1
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 %5
store i8 %19, i8* %21
%22 = tail call i32 (...) @get_next_ch()
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %4
25: ; preds = %18, %4
%26 = phi i64 [ %5, %4 ], [ %20, %18 ]
%27 = phi i32 [ %6, %4 ], [ %22, %18 ]
%28 = and i64 %26, 4294967295
br label %29
29: ; preds = %25, %0
%30 = phi i64 [ 0, %0 ], [ %28, %25 ]
%31 = phi i32 [ %1, %0 ], [ %27, %25 ]
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 %30
store i8 0, i8* %32
%33 = icmp eq i32 %31, 10
br i1 %33, label %37, label %34
34: ; preds = %29
%35 = tail call i8* (...) @parse_value()
%36 = icmp eq i8* %35, null
br i1 %36, label %40, label %37
37: ; preds = %34, %29
%38 = phi i8* [ %35, %34 ], [ null, %29 ]
%39 = tail call i32 @insert_destination(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @parse_alias_definition.name, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %16, %34, %37, %14
%41 = phi i32 [ 0, %37 ], [ -1, %14 ], [ -1, %34 ], [ -1, %16 ]
ret i32 %41
}