int MSN_conversation_call(sd, csc, addr)
int sd;
int *csc;
char *addr;
{
  char buf[512];
  if (MSN_is_valid_address(addr) != 0)
    return -1;
  *csc += 1;
  snprintf(buf, sizeof(buf) - 1, "CAL %d %s\r\n", *csc, addr);
  if (send(sd, buf, strlen(buf), 0) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<MSN_conversation_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <MSN_is_valid_address@plt>
cmp    $0x0,%eax
je     1176 <MSN_conversation_call+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fd <MSN_conversation_call+0xbd>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8
mov    $0x1ff,%esi
lea    0xe62(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x22c(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x22c(%rbp),%edi
mov    -0x228(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
cmp    $0x0,%eax
jge    11f6 <MSN_conversation_call+0xb6>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fd <MSN_conversation_call+0xbd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSN_conversation_call>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%r14d
mov    %rdx,%rdi
xor    %eax,%eax
call   1030 <MSN_is_valid_address@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    11ab <MSN_conversation_call+0x6b>
mov    0x0(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,0x0(%rbp)
lea    0xe87(%rip),%rdx
mov    %rsp,%rbp
mov    $0x1ff,%esi
mov    %rbp,%rdi
mov    %rbx,%r8
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <send@plt>
sar    $0x1f,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"CAL %d %s\0D\0A\00"
define i32 @MSN_conversation_call(i32 %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca [512 x i8]
store i32 %0, i32* %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %7
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @MSN_is_valid_address to i32 (i8*, ...)*)(i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 -1, i32* %4
br label %30
13: ; preds = %3
%14 = load i32*, i32** %6
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = load i8*, i8** %7
%21 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %17, i64 511, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %19, i8* %20)
%22 = load i32, i32* %5
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%25 = call i64 @strlen(i8* %24)
%26 = call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %22, i8* %23, i64 %25, i32 0)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %13
store i32 -1, i32* %4
br label %30
29: ; preds = %13
store i32 0, i32* %4
br label %30
30: ; preds = %29, %28, %12
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [12 x i8] c"CAL %d %s\0D\0A\00"
define i32 @MSN_conversation_call(i32 %0, i32* nocapture %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @MSN_is_valid_address to i32 (i8*, ...)*)(i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %5, i64 511, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %2)
%12 = call i64 @strlen(i8* %5)
%13 = call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %0, i8* %5, i64 %12, i32 0)
%14 = ashr i32 %13, 31
br label %15
15: ; preds = %8, %3
%16 = phi i32 [ -1, %3 ], [ %14, %8 ]
ret i32 %16
}