#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 t_hashtable {
  int dummy;
};
typedef int /*<<< orphan*/ prefix;

/* Variables and functions */
int irc_message_split_string(struct t_hashtable *, char *, char *, char *,
                             char *, char *, char *, char *, char, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int irc_message_split_privmsg_notice(struct t_hashtable *hashtable, char *tags,
                                     char *host, char *command, char *target,
                                     char *arguments, int max_length_host) {
  char prefix[512], suffix[2], *pos, saved_char;
  int length, rc;
  prefix[0] = '\0';
  suffix[0] = '\0';
  length = strlen(arguments);
  if ((arguments[0] == '\01') && (arguments[length - 1] == '\01')) {
    pos = strchr(arguments, ' ');
    if (pos) {
      pos++;
      saved_char = pos[0];
      pos[0] = '\0';
      snprintf(prefix, sizeof(prefix), ":%s", arguments);
      pos[0] = saved_char;
      arguments[length - 1] = '\0';
      arguments = pos;
      suffix[0] = '\01';
      suffix[1] = '\0';
    }
  }
  if (!prefix[0])
    strcpy(prefix, ":");
  rc = irc_message_split_string(hashtable, tags, host, command, target, prefix,
                                arguments, suffix, ' ', max_length_host);
  return rc;
}


x86 assembly (clang, -O0):
<irc_message_split_privmsg_notice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movb   $0x0,-0x230(%rbp)
movb   $0x0,-0x232(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x248(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
jne    126b <irc_message_split_privmsg_notice+0x11b>
mov    -0x30(%rbp),%rax
mov    -0x248(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x1,%eax
jne    126b <irc_message_split_privmsg_notice+0x11b>
mov    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,-0x240(%rbp)
cmpq   $0x0,-0x240(%rbp)
je     1266 <irc_message_split_privmsg_notice+0x116>
mov    -0x240(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x240(%rbp)
mov    -0x240(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x241(%rbp)
mov    -0x240(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x230(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x200,%esi
lea    0xddb(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x241(%rbp),%cl
mov    -0x240(%rbp),%rax
mov    %cl,(%rax)
mov    -0x30(%rbp),%rax
mov    -0x248(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x240(%rbp),%rax
mov    %rax,-0x30(%rbp)
movb   $0x1,-0x232(%rbp)
movb   $0x0,-0x231(%rbp)
jmp    126b <irc_message_split_privmsg_notice+0x11b>
cmpb   $0x0,-0x230(%rbp)
jne    128b <irc_message_split_privmsg_notice+0x13b>
lea    -0x230(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x230(%rbp),%r9
mov    -0x30(%rbp),%r11
lea    -0x232(%rbp),%r10
mov    0x10(%rbp),%eax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
movl   $0x20,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1070 <irc_message_split_string@plt>
mov    %eax,-0x24c(%rbp)
mov    -0x24c(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_message_split_privmsg_notice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %r9,%r12
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,0x18(%rsp)
mov    0x260(%rsp),%r15d
movb   $0x0,0x20(%rsp)
movb   $0x0,0x6(%rsp)
mov    %r9,%rdi
call   1040 <strlen@plt>
cmpb   $0x1,(%r12)
jne    1246 <irc_message_split_privmsg_notice+0xf6>
mov    %rbp,0x8(%rsp)
movslq %eax,%r15
cmpb   $0x1,-0x1(%r15,%r12,1)
jne    1237 <irc_message_split_privmsg_notice+0xe7>
mov    %r13,0x10(%rsp)
mov    %r14,%r13
mov    %r12,%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     122f <irc_message_split_privmsg_notice+0xdf>
mov    %rax,%r14
mov    %rax,%rbp
add    $0x1,%rbp
mov    0x1(%rax),%al
mov    %al,0x5(%rsp)
movb   $0x0,0x1(%r14)
lea    0xe1b(%rip),%rdx
lea    0x20(%rsp),%rdi
mov    $0x200,%esi
mov    %r12,%rcx
call   1060 <snprintf@plt>
mov    0x5(%rsp),%al
mov    %al,0x1(%r14)
movb   $0x0,-0x1(%r12,%r15,1)
movw   $0x1,0x6(%rsp)
cmpb   $0x0,0x20(%rsp)
mov    %rbp,%r12
mov    %r13,%r14
mov    0x10(%rsp),%r13
mov    0x260(%rsp),%ebp
mov    %rbp,%r15
mov    0x8(%rsp),%rbp
jne    1257 <irc_message_split_privmsg_notice+0x107>
jmp    1246 <irc_message_split_privmsg_notice+0xf6>
mov    %r13,%r14
mov    0x10(%rsp),%r13
mov    0x260(%rsp),%ebp
mov    %rbp,%r15
mov    0x8(%rsp),%rbp
lea    0xdb7(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0x6(%rsp),%rax
lea    0x20(%rsp),%r9
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %r14,%r8
push   %r15
push   $0x20
push   %rax
push   %r12
call   1070 <irc_message_split_string@plt>
add    $0x248,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.t_hashtable = type { i32 }
@.str = [4 x i8] c":%s\00"
@.str.1 = [2 x i8] c":\00"
define i32 @irc_message_split_privmsg_notice(%struct.t_hashtable* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i32 %6) {
%8 = alloca %struct.t_hashtable*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca [512 x i8]
%16 = alloca [2 x i8]
%17 = alloca i8*
%18 = alloca i8
%19 = alloca i32
%20 = alloca i32
store %struct.t_hashtable* %0, %struct.t_hashtable** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
store i8 0, i8* %21
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
store i8 0, i8* %22
%23 = load i8*, i8** %13
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %19
%25 = load i8*, i8** %13
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %67
30: ; preds = %7
%31 = load i8*, i8** %13
%32 = load i32, i32* %19
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %67
39: ; preds = %30
%40 = load i8*, i8** %13
%41 = call i8* @strchr(i8* %40, i8 signext 32)
store i8* %41, i8** %17
%42 = load i8*, i8** %17
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %66
44: ; preds = %39
%45 = load i8*, i8** %17
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %17
%47 = load i8*, i8** %17
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
store i8 %49, i8* %18
%50 = load i8*, i8** %17
%51 = getelementptr inbounds i8, i8* %50, i64 0
store i8 0, i8* %51
%52 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%53 = load i8*, i8** %13
%54 = call i32 @snprintf(i8* %52, i32 512, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %53)
%55 = load i8, i8* %18
%56 = load i8*, i8** %17
%57 = getelementptr inbounds i8, i8* %56, i64 0
store i8 %55, i8* %57
%58 = load i8*, i8** %13
%59 = load i32, i32* %19
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %58, i64 %61
store i8 0, i8* %62
%63 = load i8*, i8** %17
store i8* %63, i8** %13
%64 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
store i8 1, i8* %64
%65 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 1
store i8 0, i8* %65
br label %66
66: ; preds = %44, %39
br label %67
67: ; preds = %66, %30, %7
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%69 = load i8, i8* %68
%70 = icmp ne i8 %69, 0
br i1 %70, label %74, label %71
71: ; preds = %67
%72 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%73 = call i32 @strcpy(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %74
74: ; preds = %71, %67
%75 = load %struct.t_hashtable*, %struct.t_hashtable** %8
%76 = load i8*, i8** %9
%77 = load i8*, i8** %10
%78 = load i8*, i8** %11
%79 = load i8*, i8** %12
%80 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%81 = load i8*, i8** %13
%82 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%83 = load i32, i32* %14
%84 = call i32 @irc_message_split_string(%struct.t_hashtable* %75, i8* %76, i8* %77, i8* %78, i8* %79, i8* %80, i8* %81, i8* %82, i8 signext 32, i32 %83)
store i32 %84, i32* %20
%85 = load i32, i32* %20
ret i32 %85
}

LLVM IR (-O2):
%struct.t_hashtable = type { i32 }
@.str = [4 x i8] c":%s\00"
@.str.1 = [2 x i8] c":\00"
define i32 @irc_message_split_privmsg_notice(%struct.t_hashtable* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i32 %6) {
%8 = alloca [512 x i8]
%9 = alloca [2 x i8]
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
store i8 0, i8* %10
store i8 0, i8* %11
%12 = tail call i32 @strlen(i8* %5)
%13 = load i8, i8* %5
%14 = icmp eq i8 %13, 1
br i1 %14, label %15, label %31
15: ; preds = %7
%16 = add nsw i32 %12, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %5, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 1
br i1 %20, label %21, label %31
21: ; preds = %15
%22 = tail call i8* @strchr(i8* %5, i8 signext 32)
%23 = icmp eq i8* %22, null
br i1 %23, label %31, label %24
24: ; preds = %21
%25 = getelementptr inbounds i8, i8* %22, i64 1
%26 = load i8, i8* %25
store i8 0, i8* %25
%27 = call i32 @snprintf(i8* %10, i32 512, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
store i8 %26, i8* %25
store i8 0, i8* %18
store i8 1, i8* %11
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 1
store i8 0, i8* %28
%29 = load i8, i8* %10
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %7, %15, %21, %24
%32 = phi i8* [ %25, %24 ], [ %5, %21 ], [ %5, %15 ], [ %5, %7 ]
%33 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %31, %24
%35 = phi i8* [ %32, %31 ], [ %25, %24 ]
%36 = call i32 @irc_message_split_string(%struct.t_hashtable* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %10, i8* %35, i8* %11, i8 signext 32, i32 %6)
ret i32 %36
}