#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ sflap_send(char *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
void serv_warn(char *name, int anon) {
  char *send = malloc(256);
  snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm"));
  sflap_send(send, -1, 2);
  free(send);
}


x86 assembly (clang, -O0):
<serv_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
lea    0xea5(%rip),%r8
lea    0xe99(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r8
mov    $0xff,%esi
lea    0xe77(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x18(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1060 <sflap_send@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serv_warn>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
lea    0xeb5(%rip),%rax
lea    0xea9(%rip),%r8
cmove  %rax,%r8
lea    0xe8f(%rip),%rdx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r14,%rcx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1060 <sflap_send@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"toc_evil %s %s\00"
@.str.1 = [5 x i8] c"anon\00"
@.str.2 = [5 x i8] c"norm\00"
define void @serv_warn(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i8* @malloc(i32 256)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%13 = call i32 @snprintf(i8* %7, i32 255, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @sflap_send(i8* %14, i32 -1, i32 2)
%16 = load i8*, i8** %5
%17 = call i32 @free(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"toc_evil %s %s\00"
@.str.1 = [5 x i8] c"anon\00"
@.str.2 = [5 x i8] c"norm\00"
define void @serv_warn(i8* %0, i32 %1) {
%3 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @snprintf(i8* %3, i32 255, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
%7 = tail call i32 @sflap_send(i8* %3, i32 -1, i32 2)
%8 = tail call i32 @free(i8* %3)
ret void
}