#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*/ eraseline();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ prettyprint(char *, scalar_t__);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_color(int);
int /*<<< orphan*/ show_prompt();
char *strip_html(char const *);
scalar_t__ strlen(char const *);
void buddy_awaymsg(void *c, const char *who, const char *msg) {
  char *ptext;
  eraseline();
  {
    set_color(102);
    printf(":: ");
    set_color(0);
  };
  printf("[%s] Away: ", who);
  ptext = strip_html(msg);
  prettyprint(ptext, 12 + strlen(who));
  if (ptext[0] == 0)
    printf("\n");
  free(ptext);
  show_prompt();
}


x86 assembly (clang, -O0):
<buddy_awaymsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1050 <eraseline@plt>
mov    $0x66,%edi
call   1090 <set_color@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1090 <set_color@plt>
mov    -0x10(%rbp),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <strip_html@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
add    $0xc,%rsi
call   10a0 <prettyprint@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1218 <buddy_awaymsg+0x98>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <show_prompt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buddy_awaymsg>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
xor    %eax,%eax
call   1060 <eraseline@plt>
mov    $0x66,%edi
call   10a0 <set_color@plt>
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %edi,%edi
call   10a0 <set_color@plt>
lea    0xe3c(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r14,%rdi
call   1070 <strip_html@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1080 <strlen@plt>
lea    0xc(%rax),%rsi
mov    %rbx,%rdi
call   10b0 <prettyprint@plt>
cmpb   $0x0,(%rbx)
jne    1200 <buddy_awaymsg+0x70>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <show_prompt@plt>

LLVM IR (-O0):
@.str = [4 x i8] c":: \00"
@.str.1 = [12 x i8] c"[%s] Away: \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @buddy_awaymsg(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = call i32 (...) @eraseline()
%9 = call i32 @set_color(i32 102)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @set_color(i32 0)
%12 = load i8*, i8** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %6
%15 = call i8* @strip_html(i8* %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = load i8*, i8** %5
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 12, %18
%20 = call i32 @prettyprint(i8* %16, i64 %19)
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %3
%29 = load i8*, i8** %7
%30 = call i32 @free(i8* %29)
%31 = call i32 (...) @show_prompt()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c":: \00"
@.str.1 = [12 x i8] c"[%s] Away: \00"
define void @buddy_awaymsg(i8* nocapture readnone %0, i8* %1, i8* %2) {
%4 = tail call i32 (...) @eraseline()
%5 = tail call i32 @set_color(i32 102)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @set_color(i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%9 = tail call i8* @strip_html(i8* %2)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%11 = add nsw i64 %10, 12
%12 = tail call i32 @prettyprint(i8* %9, i64 %11)
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = tail call i32 @putchar(i32 10)
br label %17
17: ; preds = %15, %3
%18 = tail call i32 @free(i8* %9)
%19 = tail call i32 (...) @show_prompt()
ret void
}