#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 */
struct userlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ info_log(char *, char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ privmsg(int /*<<< orphan*/, char const *, char *, ...);
int strlen(char *);
char *strtok(char *, char *);
int /*<<< orphan*/ unick(struct userlist *);
int /*<<< orphan*/ usinfo(struct userlist *);
int msg_hu(const char *replyto, struct userlist *user, char *data) {
  char *message;
  if (data == NULL) {
    privmsg(usinfo(user), replyto, "huuuuuuuuuuu!!");
    return (0);
  }
  message = strtok(data, "");
  info_log("Huing %s on %s by %s\n", message, replyto, unick(user));
  if (message[strlen(message) - 1] == ' ')
    message[strlen(message) - 1] = '\0';
  privmsg(usinfo(user), replyto, "%s: huuuuuuuuuuu!!", message);
  return (0);
}


x86 assembly (clang, -O0):
<msg_hu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11a8 <msg_hu+0x48>
mov    -0x18(%rbp),%rdi
call   1080 <usinfo@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
lea    0xe85(%rip),%rdx
mov    $0x0,%al
call   1060 <privmsg@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <msg_hu+0xfe>
mov    -0x20(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <unick@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    %eax,%ecx
lea    0xe1a(%rip),%rdi
call   1050 <info_log@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1236 <msg_hu+0xd6>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1080 <usinfo@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    0xdc6(%rip),%rdx
mov    $0x0,%al
call   1060 <privmsg@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_hu>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rdx,%rdx
je     11de <msg_hu+0x7e>
lea    0xe9e(%rip),%rsi
mov    %rdx,%rdi
call   1070 <strtok@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <unick@plt>
lea    0xe6f(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1050 <info_log@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x20,-0x1(%rax,%rbx,1)
jne    11be <msg_hu+0x5e>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %r15,%rdi
call   1080 <usinfo@plt>
lea    0xe49(%rip),%rdx
mov    %eax,%edi
mov    %r14,%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <privmsg@plt>
jmp    11f9 <msg_hu+0x99>
mov    %r15,%rdi
call   1080 <usinfo@plt>
lea    0xe2d(%rip),%rdx
mov    %eax,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <privmsg@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.userlist = type { i32 }
@.str = [15 x i8] c"huuuuuuuuuuu!!\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [22 x i8] c"Huing %s on %s by %s\0A\00"
@.str.3 = [19 x i8] c"%s: huuuuuuuuuuu!!\00"
define i32 @msg_hu(i8* %0, %struct.userlist* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.userlist*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store %struct.userlist* %1, %struct.userlist** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load %struct.userlist*, %struct.userlist** %6
%13 = call i32 @usinfo(%struct.userlist* %12)
%14 = load i8*, i8** %5
%15 = call i32 (i32, i8*, i8*, ...) @privmsg(i32 %13, i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %46
16: ; preds = %3
%17 = load i8*, i8** %7
%18 = call i8* @strtok(i8* %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* %18, i8** %8
%19 = load i8*, i8** %8
%20 = load i8*, i8** %5
%21 = load %struct.userlist*, %struct.userlist** %6
%22 = call i32 @unick(%struct.userlist* %21)
%23 = call i32 @info_log(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %20, i32 %22)
%24 = load i8*, i8** %8
%25 = load i8*, i8** %8
%26 = call i32 @strlen(i8* %25)
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %24, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 32
br i1 %32, label %33, label %40
33: ; preds = %16
%34 = load i8*, i8** %8
%35 = load i8*, i8** %8
%36 = call i32 @strlen(i8* %35)
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %34, i64 %38
store i8 0, i8* %39
br label %40
40: ; preds = %33, %16
%41 = load %struct.userlist*, %struct.userlist** %6
%42 = call i32 @usinfo(%struct.userlist* %41)
%43 = load i8*, i8** %5
%44 = load i8*, i8** %8
%45 = call i32 (i32, i8*, i8*, ...) @privmsg(i32 %42, i8* %43, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %44)
store i32 0, i32* %4
br label %46
46: ; preds = %40, %11
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
%struct.userlist = type { i32 }
@.str = [15 x i8] c"huuuuuuuuuuu!!\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [22 x i8] c"Huing %s on %s by %s\0A\00"
@.str.3 = [19 x i8] c"%s: huuuuuuuuuuu!!\00"
define i32 @msg_hu(i8* %0, %struct.userlist* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @usinfo(%struct.userlist* %1)
%7 = tail call i32 (i32, i8*, i8*, ...) @privmsg(i32 %6, i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %26
8: ; preds = %3
%9 = tail call i8* @strtok(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @unick(%struct.userlist* %1)
%11 = tail call i32 @info_log(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %0, i32 %10)
%12 = tail call i32 @strlen(i8* %9)
%13 = add nsw i32 %12, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %9, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 32
br i1 %17, label %18, label %23
18: ; preds = %8
%19 = tail call i32 @strlen(i8* %9)
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %9, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %18, %8
%24 = tail call i32 @usinfo(%struct.userlist* %1)
%25 = tail call i32 (i32, i8*, i8*, ...) @privmsg(i32 %24, i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %26
26: ; preds = %23, %5
ret i32 0
}