#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 */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
char *inet_ntoa(int /*<<< orphan*/);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void narrate(char *msg1, char *msg2, struct sockaddr_in *clip) {
  fprintf(stderr, "SERVER: %s %s ", msg1, msg2);
  fprintf(stderr, "(%s:%d)", inet_ntoa(clip->sin_addr), ntohs(clip->sin_port));
  putc('\n', stderr);
}


x86 assembly (clang, -O0):
<narrate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1060 <ntohs@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<narrate>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2e89(%rip),%r15
mov    (%r15),%edi
lea    0xe9f(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r15),%r14d
mov    0x4(%rbx),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rbp
mov    (%rbx),%edi
call   1060 <ntohs@plt>
lea    0xe8b(%rip),%rsi
mov    %r14d,%edi
mov    %rbp,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r15),%esi
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putc@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
@stderr = global i32 0
@.str = [15 x i8] c"SERVER: %s %s \00"
@.str.1 = [8 x i8] c"(%s:%d)\00"
define void @narrate(i8* %0, i8* %1, %struct.sockaddr_in* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.sockaddr_in*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = load i32, i32* @stderr
%12 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = call i8* @inet_ntoa(i32 %14)
%16 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @ntohs(i32 %18)
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %19)
%21 = load i32, i32* @stderr
%22 = call i32 @putc(i8 signext 10, i32 %21)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
@stderr = global i32 0
@.str = [15 x i8] c"SERVER: %s %s \00"
@.str.1 = [8 x i8] c"(%s:%d)\00"
define void @narrate(i8* %0, i8* %1, %struct.sockaddr_in* nocapture %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = load i32, i32* @stderr
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%8 = load i32, i32* %7
%9 = tail call i8* @inet_ntoa(i32 %8)
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @ntohs(i32 %11)
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %12)
%14 = load i32, i32* @stderr
%15 = tail call i32 @putc(i8 signext 10, i32 %14)
ret void
}