#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 */
char *i3_escape_name(char const *);
int /*<<< orphan*/ i3_write_buffer(char const *);
void i3_write_header(const char *identifier, const char *originator_mudname,
                     const char *originator_username,
                     const char *target_mudname, const char *target_username) {
  i3_write_buffer("({\"");
  i3_write_buffer(identifier);
  i3_write_buffer("\",5,");
  if (originator_mudname) {
    i3_write_buffer("\"");
    i3_write_buffer(originator_mudname);
    i3_write_buffer("\",");
  } else
    i3_write_buffer("0,");
  if (originator_username) {
    i3_write_buffer("\"");
    i3_write_buffer(i3_escape_name(originator_username));
    i3_write_buffer("\",");
  } else
    i3_write_buffer("0,");
  if (target_mudname) {
    i3_write_buffer("\"");
    i3_write_buffer(target_mudname);
    i3_write_buffer("\",");
  } else
    i3_write_buffer("0,");
  if (target_username) {
    i3_write_buffer("\"");
    i3_write_buffer(target_username);
    i3_write_buffer("\",");
  } else
    i3_write_buffer("0,");
}


x86 assembly (clang, -O0):
<i3_write_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    -0x8(%rbp),%rdi
call   1040 <i3_write_buffer@plt>
lea    0xeac(%rip),%rdi
call   1040 <i3_write_buffer@plt>
cmpq   $0x0,-0x10(%rbp)
je     118e <i3_write_header+0x6e>
lea    0xe93(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    -0x10(%rbp),%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe85(%rip),%rdi
call   1040 <i3_write_buffer@plt>
jmp    119a <i3_write_header+0x7a>
lea    0xe77(%rip),%rdi
call   1040 <i3_write_buffer@plt>
cmpq   $0x0,-0x18(%rbp)
je     11d3 <i3_write_header+0xb3>
lea    0xe56(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    -0x18(%rbp),%rdi
call   1030 <i3_escape_name@plt>
mov    %rax,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe40(%rip),%rdi
call   1040 <i3_write_buffer@plt>
jmp    11df <i3_write_header+0xbf>
lea    0xe32(%rip),%rdi
call   1040 <i3_write_buffer@plt>
cmpq   $0x0,-0x20(%rbp)
je     1210 <i3_write_header+0xf0>
lea    0xe11(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    -0x20(%rbp),%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe03(%rip),%rdi
call   1040 <i3_write_buffer@plt>
jmp    121c <i3_write_header+0xfc>
lea    0xdf5(%rip),%rdi
call   1040 <i3_write_buffer@plt>
cmpq   $0x0,-0x28(%rbp)
je     124d <i3_write_header+0x12d>
lea    0xdd4(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    -0x28(%rbp),%rdi
call   1040 <i3_write_buffer@plt>
lea    0xdc6(%rip),%rdi
call   1040 <i3_write_buffer@plt>
jmp    1259 <i3_write_header+0x139>
lea    0xdb8(%rip),%rdi
call   1040 <i3_write_buffer@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i3_write_header>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %rbx,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xeb1(%rip),%rdi
call   1040 <i3_write_buffer@plt>
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
test   %r13,%r13
je     1182 <i3_write_header+0x62>
lea    0xe94(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %r13,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe87(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %rbx,%rdi
test   %r12,%r12
je     11b2 <i3_write_header+0x92>
lea    0xe6c(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %r12,%rdi
call   1030 <i3_escape_name@plt>
mov    %rax,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe57(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %rbx,%rdi
test   %r15,%r15
je     11da <i3_write_header+0xba>
lea    0xe3c(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %r15,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe2f(%rip),%rdi
call   1040 <i3_write_buffer@plt>
test   %r14,%r14
je     11ff <i3_write_header+0xdf>
lea    0xe17(%rip),%rdi
call   1040 <i3_write_buffer@plt>
mov    %r14,%rdi
call   1040 <i3_write_buffer@plt>
lea    0xe0a(%rip),%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <i3_write_buffer@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"({\22\00"
@.str.1 = [5 x i8] c"\22,5,\00"
@.str.2 = [2 x i8] c"\22\00"
@.str.3 = [3 x i8] c"\22,\00"
@.str.4 = [3 x i8] c"0,\00"
define void @i3_write_header(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = call i32 @i3_write_buffer(i8* %12)
%14 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %5
%18 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = load i8*, i8** %7
%20 = call i32 @i3_write_buffer(i8* %19)
%21 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %5
%23 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %17
%25 = load i8*, i8** %8
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = load i8*, i8** %8
%30 = call i8* @i3_escape_name(i8* %29)
%31 = call i32 @i3_write_buffer(i8* %30)
%32 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %35
33: ; preds = %24
%34 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %27
%36 = load i8*, i8** %9
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = load i8*, i8** %9
%41 = call i32 @i3_write_buffer(i8* %40)
%42 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %45
43: ; preds = %35
%44 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %38
%46 = load i8*, i8** %10
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%50 = load i8*, i8** %10
%51 = call i32 @i3_write_buffer(i8* %50)
%52 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %55
53: ; preds = %45
%54 = call i32 @i3_write_buffer(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %55
55: ; preds = %53, %48
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"({\22\00"
@.str.1 = [5 x i8] c"\22,5,\00"
@.str.2 = [2 x i8] c"\22\00"
@.str.3 = [3 x i8] c"\22,\00"
@.str.4 = [3 x i8] c"0,\00"
define void @i3_write_header(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @i3_write_buffer(i8* %0)
%8 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %1, null
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @i3_write_buffer(i8* %1)
br label %13
13: ; preds = %5, %10
%14 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %5 ]
%15 = tail call i32 @i3_write_buffer(i8* %14)
%16 = icmp eq i8* %2, null
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i8* @i3_escape_name(i8* %2)
%20 = tail call i32 @i3_write_buffer(i8* %19)
br label %21
21: ; preds = %13, %17
%22 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %17 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %13 ]
%23 = tail call i32 @i3_write_buffer(i8* %22)
%24 = icmp eq i8* %3, null
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = tail call i32 @i3_write_buffer(i8* %3)
br label %28
28: ; preds = %21, %25
%29 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %25 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %21 ]
%30 = tail call i32 @i3_write_buffer(i8* %29)
%31 = icmp eq i8* %4, null
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = tail call i32 @i3_write_buffer(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = tail call i32 @i3_write_buffer(i8* %4)
br label %35
35: ; preds = %28, %32
%36 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %32 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %28 ]
%37 = tail call i32 @i3_write_buffer(i8* %36)
ret void
}