#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*/ perror(char *);
int sk_send(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int srv_ReplyToSudirribe(int sock, const char *to, int status, int ssl) {
  int rv;
  char *str = malloc(1024);
  if (status)
    sprintf(str, "<presence to='%s' type='sudirribed'/>", to);
  else
    sprintf(str, "<presence to='%s' type='unsudirribed'/>", to);
  if (!(rv = sk_send(sock, str, ssl))) {
    perror("senddata (server.c:199)");
  }
  free(str);
  return rv;
}


x86 assembly (clang, -O0):
<srv_ReplyToSudirribe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1196 <srv_ReplyToSudirribe+0x46>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe74(%rip),%rsi
call   1070 <sprintf@plt>
jmp    11aa <srv_ReplyToSudirribe+0x5a>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe81(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1050 <sk_send@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jne    11d1 <srv_ReplyToSudirribe+0x81>
lea    0xe82(%rip),%rdi
call   1060 <perror@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srv_ReplyToSudirribe>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
lea    0xead(%rip),%rax
lea    0xe80(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
call   1070 <sprintf@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <sk_send@plt>
mov    %eax,%ebp
test   %eax,%eax
je     11b6 <srv_ReplyToSudirribe+0x66>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe91(%rip),%rdi
call   1060 <perror@plt>
jmp    11a3 <srv_ReplyToSudirribe+0x53>

LLVM IR (-O0):
@.str = [38 x i8] c"<presence to='%s' type='sudirribed'/>\00"
@.str.1 = [40 x i8] c"<presence to='%s' type='unsudirribed'/>\00"
@.str.2 = [24 x i8] c"senddata (server.c:199)\00"
define i32 @srv_ReplyToSudirribe(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = call i8* @malloc(i32 1024)
store i8* %11, i8** %10
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load i8*, i8** %10
%16 = load i8*, i8** %6
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %22
18: ; preds = %4
%19 = load i8*, i8** %10
%20 = load i8*, i8** %6
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %5
%24 = load i8*, i8** %10
%25 = load i32, i32* %8
%26 = call i32 @sk_send(i32 %23, i8* %24, i32 %25)
store i32 %26, i32* %9
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %22
%29 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28, %22
%31 = load i8*, i8** %10
%32 = call i32 @free(i8* %31)
%33 = load i32, i32* %9
ret i32 %33
}

LLVM IR (-O2):
@.str = [38 x i8] c"<presence to='%s' type='sudirribed'/>\00"
@.str.1 = [40 x i8] c"<presence to='%s' type='unsudirribed'/>\00"
@.str.2 = [24 x i8] c"senddata (server.c:199)\00"
define i32 @srv_ReplyToSudirribe(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%6 = icmp eq i32 %2, 0
%7 = select i1 %6, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0)
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) %7, i8* %1)
%9 = tail call i32 @sk_send(i32 %0, i8* %5, i32 %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %4
%14 = tail call i32 @free(i8* %5)
ret i32 %9
}