#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 addrinfo {
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ addrfam(int /*<<< orphan*/);
int /*<<< orphan*/ addrip(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ addrlen(int /*<<< orphan*/);
int /*<<< orphan*/ warnx(char *, char const *const, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/,
                         char const *const);
void ai_pmsg(const char *const prefix, const struct addrinfo *const ai,
             const char *const port) {
  warnx("%s: %s %.*s on port %s", prefix, addrfam(ai->ai_family),
        addrlen(ai->ai_family), addrip(ai->ai_family, ai->ai_addr), port);
}


x86 assembly (clang, -O0):
<ai_pmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1060 <addrfam@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <addrlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1040 <addrip@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    %eax,%r8d
mov    -0x18(%rbp),%r9
lea    0xe5c(%rip),%rdi
call   1050 <warnx@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ai_pmsg>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    0x4(%rsi),%edi
call   1060 <addrfam@plt>
mov    %eax,%r12d
mov    0x4(%rbx),%edi
call   1030 <addrlen@plt>
mov    %eax,%ebp
mov    (%rbx),%esi
mov    0x4(%rbx),%edi
call   1040 <addrip@plt>
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
mov    %r14,%r9
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <warnx@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32 }
@.str = [23 x i8] c"%s: %s %.*s on port %s\00"
define void @ai_pmsg(i8* %0, %struct.addrinfo* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.addrinfo*
%6 = alloca i8*
store i8* %0, i8** %4
store %struct.addrinfo* %1, %struct.addrinfo** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load %struct.addrinfo*, %struct.addrinfo** %5
%9 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 @addrfam(i32 %10)
%12 = load %struct.addrinfo*, %struct.addrinfo** %5
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = call i32 @addrlen(i32 %14)
%16 = load %struct.addrinfo*, %struct.addrinfo** %5
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = load %struct.addrinfo*, %struct.addrinfo** %5
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = call i32 @addrip(i32 %18, i32 %21)
%23 = load i8*, i8** %6
%24 = call i32 @warnx(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %11, i32 %15, i32 %22, i8* %23)
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32 }
@.str = [23 x i8] c"%s: %s %.*s on port %s\00"
define void @ai_pmsg(i8* %0, %struct.addrinfo* nocapture %1, i8* %2) {
%4 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 1
%5 = load i32, i32* %4
%6 = tail call i32 @addrfam(i32 %5)
%7 = load i32, i32* %4
%8 = tail call i32 @addrlen(i32 %7)
%9 = load i32, i32* %4
%10 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @addrip(i32 %9, i32 %11)
%13 = tail call i32 @warnx(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6, i32 %8, i32 %12, i8* %2)
ret void
}