#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*/ firc_send(char *, char *, char *);
char *strtok(int /*<<< orphan*/, char *);
void part() {
  char *chan = strtok(0, " \r\n");
  char *message = strtok(0, "\r\n");
  if (chan)
    firc_send("PART %s :%s", chan, message ? message : "Leaving");
}


x86 assembly (clang, -O0):
<part>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
lea    0xecf(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x8(%rbp)
xor    %edi,%edi
lea    0xebe(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119b <part+0x7b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1177 <part+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1187 <part+0x67>
lea    0xe92(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1187 <part+0x67>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe6e(%rip),%rdi
call   1030 <firc_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<part>:
push   %rbx
lea    0xed8(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
mov    %rax,%rbx
lea    0xec8(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rbx,%rbx
je     1163 <part+0x43>
test   %rax,%rax
lea    0xec1(%rip),%rdx
cmovne %rax,%rdx
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <firc_send@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
@.str.2 = [12 x i8] c"PART %s :%s\00"
@.str.3 = [8 x i8] c"Leaving\00"
define void @part() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @strtok(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = call i8* @strtok(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %1
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = load i8*, i8** %1
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i8*, i8** %2
br label %14
13: ; preds = %7
br label %14
14: ; preds = %13, %11
%15 = phi i8* [ %12, %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %13 ]
%16 = call i32 @firc_send(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %15)
br label %17
17: ; preds = %14, %0
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
@.str.2 = [12 x i8] c"PART %s :%s\00"
@.str.3 = [8 x i8] c"Leaving\00"
define void @part() {
%1 = tail call i8* @strtok(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i8* @strtok(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = icmp eq i8* %2, null
%6 = select i1 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %2
%7 = tail call i32 @firc_send(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %6)
br label %8
8: ; preds = %4, %0
ret void
}