#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);
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,
                                     int max_length) {
  char prefix[4096], 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,
                                max_length);
  return rc;
}


x86 assembly (clang, -O0):
<irc_message_split_privmsg_notice>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x1088,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movb   $0x0,-0x1040(%rbp)
movb   $0x0,-0x1042(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1058(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
jne    126f <irc_message_split_privmsg_notice+0x11f>
mov    -0x38(%rbp),%rax
mov    -0x1058(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x1,%eax
jne    126f <irc_message_split_privmsg_notice+0x11f>
mov    -0x38(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,-0x1050(%rbp)
cmpq   $0x0,-0x1050(%rbp)
je     126a <irc_message_split_privmsg_notice+0x11a>
mov    -0x1050(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1050(%rbp)
mov    -0x1050(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1051(%rbp)
mov    -0x1050(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x1040(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x1000,%esi
lea    0xdd7(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x1051(%rbp),%cl
mov    -0x1050(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
mov    -0x1058(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1050(%rbp),%rax
mov    %rax,-0x38(%rbp)
movb   $0x1,-0x1042(%rbp)
movb   $0x0,-0x1041(%rbp)
jmp    126f <irc_message_split_privmsg_notice+0x11f>
cmpb   $0x0,-0x1040(%rbp)
jne    128f <irc_message_split_privmsg_notice+0x13f>
lea    -0x1040(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
lea    -0x1040(%rbp),%r9
mov    -0x38(%rbp),%rbx
lea    -0x1042(%rbp),%r11
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
movl   $0x20,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1070 <irc_message_split_string@plt>
mov    %eax,-0x105c(%rbp)
mov    -0x105c(%rbp),%eax
add    $0x1088,%rsp
pop    %rbx
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    $0x1038,%rsp
mov    %r9,%r12
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,0x28(%rsp)
mov    %rdi,0x20(%rsp)
mov    0x1078(%rsp),%ebx
mov    0x1070(%rsp),%r13d
movb   $0x0,0x30(%rsp)
movb   $0x0,0xe(%rsp)
mov    %r9,%rdi
call   1040 <strlen@plt>
cmpb   $0x1,(%r12)
jne    1251 <irc_message_split_privmsg_notice+0x101>
mov    %rbp,0x10(%rsp)
mov    %r15,0x18(%rsp)
movslq %eax,%r15
cmpb   $0x1,-0x1(%r15,%r12,1)
jne    1240 <irc_message_split_privmsg_notice+0xf0>
mov    %r14,%rbp
mov    %r12,%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1235 <irc_message_split_privmsg_notice+0xe5>
mov    %rax,%r14
mov    %rax,%rbx
add    $0x1,%rbx
mov    0x1(%rax),%r13b
movb   $0x0,0x1(%rax)
lea    0xe16(%rip),%rdx
lea    0x30(%rsp),%rdi
mov    $0x1000,%esi
mov    %r12,%rcx
call   1060 <snprintf@plt>
mov    %r13b,0x1(%r14)
movb   $0x0,-0x1(%r12,%r15,1)
movw   $0x1,0xe(%rsp)
cmpb   $0x0,0x30(%rsp)
mov    %rbx,%r12
mov    %rbp,%r14
mov    0x1070(%rsp),%r13d
mov    0x18(%rsp),%r15
mov    0x1078(%rsp),%ebx
mov    0x10(%rsp),%rbp
jne    1262 <irc_message_split_privmsg_notice+0x112>
jmp    1251 <irc_message_split_privmsg_notice+0x101>
mov    %rbp,%r14
mov    0x1070(%rsp),%r13d
mov    0x18(%rsp),%r15
mov    0x1078(%rsp),%ebx
mov    0x10(%rsp),%rbp
lea    0xdac(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1030 <strcpy@plt>
sub    $0x8,%rsp
lea    0x16(%rsp),%rax
lea    0x38(%rsp),%r9
mov    0x28(%rsp),%rdi
mov    0x30(%rsp),%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
push   %rbx
push   %r13
push   $0x20
push   %rax
push   %r12
call   1070 <irc_message_split_string@plt>
add    $0x1068,%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, i32 %7) {
%9 = alloca %struct.t_hashtable*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca [4096 x i8]
%18 = alloca [2 x i8]
%19 = alloca i8*
%20 = alloca i8
%21 = alloca i32
%22 = alloca i32
store %struct.t_hashtable* %0, %struct.t_hashtable** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
store i8 0, i8* %23
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %18, i64 0, i64 0
store i8 0, i8* %24
%25 = load i8*, i8** %14
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %21
%27 = load i8*, i8** %14
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %69
32: ; preds = %8
%33 = load i8*, i8** %14
%34 = load i32, i32* %21
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %69
41: ; preds = %32
%42 = load i8*, i8** %14
%43 = call i8* @strchr(i8* %42, i8 signext 32)
store i8* %43, i8** %19
%44 = load i8*, i8** %19
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %68
46: ; preds = %41
%47 = load i8*, i8** %19
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %19
%49 = load i8*, i8** %19
%50 = getelementptr inbounds i8, i8* %49, i64 0
%51 = load i8, i8* %50
store i8 %51, i8* %20
%52 = load i8*, i8** %19
%53 = getelementptr inbounds i8, i8* %52, i64 0
store i8 0, i8* %53
%54 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
%55 = load i8*, i8** %14
%56 = call i32 @snprintf(i8* %54, i32 4096, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %55)
%57 = load i8, i8* %20
%58 = load i8*, i8** %19
%59 = getelementptr inbounds i8, i8* %58, i64 0
store i8 %57, i8* %59
%60 = load i8*, i8** %14
%61 = load i32, i32* %21
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %60, i64 %63
store i8 0, i8* %64
%65 = load i8*, i8** %19
store i8* %65, i8** %14
%66 = getelementptr inbounds [2 x i8], [2 x i8]* %18, i64 0, i64 0
store i8 1, i8* %66
%67 = getelementptr inbounds [2 x i8], [2 x i8]* %18, i64 0, i64 1
store i8 0, i8* %67
br label %68
68: ; preds = %46, %41
br label %69
69: ; preds = %68, %32, %8
%70 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
%71 = load i8, i8* %70
%72 = icmp ne i8 %71, 0
br i1 %72, label %76, label %73
73: ; preds = %69
%74 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
%75 = call i32 @strcpy(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %76
76: ; preds = %73, %69
%77 = load %struct.t_hashtable*, %struct.t_hashtable** %9
%78 = load i8*, i8** %10
%79 = load i8*, i8** %11
%80 = load i8*, i8** %12
%81 = load i8*, i8** %13
%82 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
%83 = load i8*, i8** %14
%84 = getelementptr inbounds [2 x i8], [2 x i8]* %18, i64 0, i64 0
%85 = load i32, i32* %15
%86 = load i32, i32* %16
%87 = call i32 @irc_message_split_string(%struct.t_hashtable* %77, i8* %78, i8* %79, i8* %80, i8* %81, i8* %82, i8* %83, i8* %84, i8 signext 32, i32 %85, i32 %86)
store i32 %87, i32* %22
%88 = load i32, i32* %22
ret i32 %88
}

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