#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*/ irc_out(char *, char *);
int /*<<< orphan*/ irc_privmsg_event(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
char *skip(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ trim(char *);
void irc_in(char *cmd) {
  char *usr, *par, *txt;
  usr = "irc.libslack.so";
  if (!cmd || !*cmd)
    return;
  printf("IN: %s", cmd);
  if (cmd[0] == ':') {
    usr = cmd + 1;
    cmd = skip(usr, ' ');
    if (cmd[0] == '\0')
      return;
    skip(usr, '!');
  }
  skip(cmd, '\r');
  par = skip(cmd, ' ');
  txt = skip(par, ':');
  trim(par);
  if (!strcmp("PONG", cmd))
    return;
  if (!strcmp("PING", cmd))
    irc_out("PONG %s", txt);
  else if (!strcmp("PRIVMSG", cmd))
    irc_privmsg_event(usr, par, txt);
}


x86 assembly (clang, -O0):
<irc_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118f <irc_in+0x2f>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1194 <irc_in+0x34>
jmp    12ab <irc_in+0x14b>
mov    -0x8(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    11f5 <irc_in+0x95>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1030 <skip@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11e7 <irc_in+0x87>
jmp    12ab <irc_in+0x14b>
mov    -0x10(%rbp),%rdi
mov    $0x21,%esi
call   1030 <skip@plt>
mov    -0x8(%rbp),%rdi
mov    $0xd,%esi
call   1030 <skip@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <skip@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <skip@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <trim@plt>
mov    -0x8(%rbp),%rsi
lea    0xddc(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    124e <irc_in+0xee>
jmp    12ab <irc_in+0x14b>
mov    -0x8(%rbp),%rsi
lea    0xdc3(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    127c <irc_in+0x11c>
mov    -0x20(%rbp),%rsi
lea    0xdaf(%rip),%rdi
call   1080 <irc_out@plt>
jmp    12ab <irc_in+0x14b>
mov    -0x8(%rbp),%rsi
lea    0xda2(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12a6 <irc_in+0x146>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <irc_privmsg_event@plt>
jmp    12ab <irc_in+0x14b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_in>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1238 <irc_in+0xd8>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1238 <irc_in+0xd8>
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
cmpb   $0x3a,(%rbx)
jne    11c3 <irc_in+0x63>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <skip@plt>
cmpb   $0x0,(%rax)
je     1238 <irc_in+0xd8>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x21,%esi
call   1030 <skip@plt>
mov    %rbx,%r14
mov    %r15,%rbx
jmp    11ca <irc_in+0x6a>
lea    0xe36(%rip),%r14
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <skip@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <skip@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x3a,%esi
call   1030 <skip@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1050 <trim@plt>
lea    0xe11(%rip),%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1238 <irc_in+0xd8>
lea    0xe03(%rip),%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1244 <irc_in+0xe4>
lea    0xdfd(%rip),%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     125e <irc_in+0xfe>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xdd6(%rip),%rdi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <irc_out@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <irc_privmsg_event@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"irc.libslack.so\00"
@.str.1 = [7 x i8] c"IN: %s\00"
@.str.2 = [5 x i8] c"PONG\00"
@.str.3 = [5 x i8] c"PING\00"
@.str.4 = [8 x i8] c"PONG %s\00"
@.str.5 = [8 x i8] c"PRIVMSG\00"
define void @irc_in(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8, %1
br label %65
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 58
br i1 %20, label %21, label %35
21: ; preds = %13
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %3
%24 = load i8*, i8** %3
%25 = call i8* @skip(i8* %24, i8 signext 32)
store i8* %25, i8** %2
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %21
br label %65
32: ; preds = %21
%33 = load i8*, i8** %3
%34 = call i8* @skip(i8* %33, i8 signext 33)
br label %35
35: ; preds = %32, %13
%36 = load i8*, i8** %2
%37 = call i8* @skip(i8* %36, i8 signext 13)
%38 = load i8*, i8** %2
%39 = call i8* @skip(i8* %38, i8 signext 32)
store i8* %39, i8** %4
%40 = load i8*, i8** %4
%41 = call i8* @skip(i8* %40, i8 signext 58)
store i8* %41, i8** %5
%42 = load i8*, i8** %4
%43 = call i32 @trim(i8* %42)
%44 = load i8*, i8** %2
%45 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %35
br label %65
48: ; preds = %35
%49 = load i8*, i8** %2
%50 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = icmp ne i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %48
%53 = load i8*, i8** %5
%54 = call i32 @irc_out(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %53)
br label %65
55: ; preds = %48
%56 = load i8*, i8** %2
%57 = call i32 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %64, label %59
59: ; preds = %55
%60 = load i8*, i8** %3
%61 = load i8*, i8** %4
%62 = load i8*, i8** %5
%63 = call i32 @irc_privmsg_event(i8* %60, i8* %61, i8* %62)
br label %64
64: ; preds = %59, %55
br label %65
65: ; preds = %12, %31, %47, %64, %52
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"irc.libslack.so\00"
@.str.1 = [7 x i8] c"IN: %s\00"
@.str.2 = [5 x i8] c"PONG\00"
@.str.3 = [5 x i8] c"PING\00"
@.str.4 = [8 x i8] c"PONG %s\00"
@.str.5 = [8 x i8] c"PRIVMSG\00"
define void @irc_in(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %36, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %36, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 58
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = tail call i8* @skip(i8* %11, i8 signext 32)
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %36, label %15
15: ; preds = %10
%16 = tail call i8* @skip(i8* %11, i8 signext 33)
br label %17
17: ; preds = %15, %6
%18 = phi i8* [ %11, %15 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %6 ]
%19 = phi i8* [ %12, %15 ], [ %0, %6 ]
%20 = tail call i8* @skip(i8* %19, i8 signext 13)
%21 = tail call i8* @skip(i8* %19, i8 signext 32)
%22 = tail call i8* @skip(i8* %21, i8 signext 58)
%23 = tail call i32 @trim(i8* %21)
%24 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%25 = icmp eq i32 %24, 0
br i1 %25, label %36, label %26
26: ; preds = %17
%27 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @irc_out(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %22)
br label %36
31: ; preds = %26
%32 = tail call i32 @strcmp(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = tail call i32 @irc_privmsg_event(i8* %18, i8* %21, i8* %22)
br label %36
36: ; preds = %29, %34, %31, %17, %10, %1, %3
ret void
}