#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*/ create_label(char *, unsigned short);
unsigned short parse_address(char *);
int /*<<< orphan*/ printf(char *, char *);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ trim(char *);
void process_line(char *line) {
  char *eq = strchr(line, '=');
  char *lab = line;
  char *val;
  if (eq != NULL) {
    unsigned short addr;
    *eq++ = '\0';
    val = eq;
    trim(lab);
    trim(val);
    addr = parse_address(val);
    create_label(lab, addr);
  } else {
    if (strcmp(line, "") != 0) {
      printf("; Crappy line in label file: '%s'\n", line);
    }
  }
}


x86 assembly (clang, -O0):
<process_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11dc <process_line+0x7c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <trim@plt>
mov    -0x20(%rbp),%rdi
call   1060 <trim@plt>
mov    -0x20(%rbp),%rdi
call   1080 <parse_address@plt>
mov    %ax,-0x22(%rbp)
mov    -0x18(%rbp),%rdi
movzwl -0x22(%rbp),%esi
call   1030 <create_label@plt>
jmp    120b <process_line+0xab>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1206 <process_line+0xa6>
mov    -0x8(%rbp),%rsi
lea    0xdff(%rip),%rdi
call   1050 <printf@plt>
jmp    120b <process_line+0xab>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11aa <process_line+0x4a>
mov    %rax,%rbx
add    $0x1,%rbx
movb   $0x0,(%rax)
mov    %r14,%rdi
call   1060 <trim@plt>
mov    %rbx,%rdi
call   1060 <trim@plt>
mov    %rbx,%rdi
call   1080 <parse_address@plt>
movzwl %ax,%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <create_label@plt>
lea    0xe71(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11d4 <process_line+0x74>
lea    0xe3b(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [35 x i8] c"; Crappy line in label file: '%s'\0A\00"
define void @process_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i16
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @strchr(i8* %7, i8 signext 61)
store i8* %8, i8** %3
%9 = load i8*, i8** %2
store i8* %9, i8** %4
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %25
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
store i8 0, i8* %13
%15 = load i8*, i8** %3
store i8* %15, i8** %5
%16 = load i8*, i8** %4
%17 = call i32 @trim(i8* %16)
%18 = load i8*, i8** %5
%19 = call i32 @trim(i8* %18)
%20 = load i8*, i8** %5
%21 = call zeroext i16 @parse_address(i8* %20)
store i16 %21, i16* %6
%22 = load i8*, i8** %4
%23 = load i16, i16* %6
%24 = call i32 @create_label(i8* %22, i16 zeroext %23)
br label %33
25: ; preds = %1
%26 = load i8*, i8** %2
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i8*, i8** %2
%31 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %29, %25
br label %33
33: ; preds = %32, %12
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [35 x i8] c"; Crappy line in label file: '%s'\0A\00"
define void @process_line(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %2
%6 = tail call i32 @trim(i8* %0)
%7 = tail call i32 @trim(i8* %5)
%8 = tail call zeroext i16 @parse_address(i8* %5)
%9 = tail call i32 @create_label(i8* %0, i16 zeroext %8)
br label %15
10: ; preds = %1
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %15
15: ; preds = %10, %13, %4
ret void
}