#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*/ warn(char *, char const *const, int /*<<< orphan*/,
                        int /*<<< orphan*/, int /*<<< orphan*/,
                        char const *const, char const *const);
void ai_perr(const char *const prefix, const struct addrinfo *const ai,
             const char *const port, const char *const msg) {
  warn("%s: %s %.*s on port %s: %s", prefix, addrfam(ai->ai_family),
       addrlen(ai->ai_family), addrip(ai->ai_family, ai->ai_addr), port, msg);
}


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

x86 assembly (clang, -O2):
<ai_perr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
mov    0x4(%rsi),%edi
call   1060 <addrfam@plt>
mov    %eax,%r13d
mov    0x4(%rbx),%edi
call   1030 <addrlen@plt>
mov    %eax,%ebp
mov    (%rbx),%esi
mov    0x4(%rbx),%edi
call   1050 <addrip@plt>
mov    %r15,(%rsp)
lea    0xe7f(%rip),%rdi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
mov    %r14,%r9
call   1040 <warn@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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