#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*/ add_hook(char const *, char *);
int /*<<< orphan*/ clear_list();
int /*<<< orphan*/ print_hooks();
int /*<<< orphan*/ strcmp(char const *, char *);
char *strrchr(char const *, char);
void process_one_line(const char *line) {
  char *action;
  if (!line)
    return;
  if (!strcmp(line, "clear")) {
    clear_list();
    return;
  }
  if (!strcmp(line, "print")) {
    print_hooks();
    return;
  }
  action = strrchr(line, ',');
  if (action)
    *(action++) = '\0';
  add_hook(line, action);
}


x86 assembly (clang, -O0):
<process_one_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116c <process_one_line+0x1c>
jmp    11f2 <process_one_line+0xa2>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1191 <process_one_line+0x41>
mov    $0x0,%al
call   1060 <clear_list@plt>
jmp    11f2 <process_one_line+0xa2>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11b6 <process_one_line+0x66>
mov    $0x0,%al
call   1040 <print_hooks@plt>
jmp    11f2 <process_one_line+0xa2>
mov    -0x8(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11e5 <process_one_line+0x95>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <add_hook@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_one_line>:
push   %rbx
test   %rdi,%rdi
je     119a <process_one_line+0x4a>
mov    %rdi,%rbx
lea    0xea0(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     119c <process_one_line+0x4c>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11a4 <process_one_line+0x54>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     11ac <process_one_line+0x5c>
mov    %rax,%rsi
add    $0x1,%rsi
movb   $0x0,(%rax)
jmp    11ae <process_one_line+0x5e>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1060 <clear_list@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <print_hooks@plt>
xor    %esi,%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1070 <add_hook@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [6 x i8] c"print\00"
define void @process_one_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
br label %31
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 (...) @clear_list()
br label %31
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (...) @print_hooks()
br label %31
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = call i8* @strrchr(i8* %20, i8 signext 44)
store i8* %21, i8** %3
%22 = load i8*, i8** %3
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
store i8 0, i8* %25
br label %27
27: ; preds = %24, %19
%28 = load i8*, i8** %2
%29 = load i8*, i8** %3
%30 = call i32 @add_hook(i8* %28, i8* %29)
br label %31
31: ; preds = %27, %17, %11, %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [6 x i8] c"print\00"
define void @process_one_line(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %21, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @clear_list()
br label %21
8: ; preds = %3
%9 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (...) @print_hooks()
br label %21
13: ; preds = %8
%14 = tail call i8* @strrchr(i8* %0, i8 signext 44)
%15 = icmp eq i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = getelementptr inbounds i8, i8* %14, i64 1
store i8 0, i8* %14
br label %18
18: ; preds = %16, %13
%19 = phi i8* [ %17, %16 ], [ null, %13 ]
%20 = tail call i32 @add_hook(i8* %0, i8* %19)
br label %21
21: ; preds = %1, %18, %11, %6
ret void
}