#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 {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int convert_getnameinfo_flags(int);
int getnameinfo(struct sockaddr const *, int /*<<< orphan*/, char *,
                int /*<<< orphan*/, char *, int /*<<< orphan*/, int);
int my_getnameinfo(const struct sockaddr *__restrict sa, socklen_t salen,
                   char *__restrict host, socklen_t hostlen,
                   char *__restrict serv, socklen_t servlen, int flags) {
  int glibc_flags = convert_getnameinfo_flags(flags);
  return getnameinfo(sa, salen, host, hostlen, serv, servlen, glibc_flags);
}


x86 assembly (clang, -O0):
<my_getnameinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0x10(%rbp),%edi
call   1030 <convert_getnameinfo_flags@plt>
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <getnameinfo@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getnameinfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r15
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x40(%rsp),%edi
call   1030 <convert_getnameinfo_flags@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %r15,%r8
mov    %r14d,%r9d
call   1040 <getnameinfo@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @my_getnameinfo(%struct.sockaddr* noalias %0, i32 %1, i8* noalias %2, i32 %3, i8* noalias %4, i32 %5, i32 %6) {
%8 = alloca %struct.sockaddr*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.sockaddr* %0, %struct.sockaddr** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load i32, i32* %14
%17 = call i32 @convert_getnameinfo_flags(i32 %16)
store i32 %17, i32* %15
%18 = load %struct.sockaddr*, %struct.sockaddr** %8
%19 = load i32, i32* %9
%20 = load i8*, i8** %10
%21 = load i32, i32* %11
%22 = load i8*, i8** %12
%23 = load i32, i32* %13
%24 = load i32, i32* %15
%25 = call i32 @getnameinfo(%struct.sockaddr* %18, i32 %19, i8* %20, i32 %21, i8* %22, i32 %23, i32 %24)
ret i32 %25
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @my_getnameinfo(%struct.sockaddr* noalias %0, i32 %1, i8* noalias %2, i32 %3, i8* noalias %4, i32 %5, i32 %6) {
%8 = tail call i32 @convert_getnameinfo_flags(i32 %6)
%9 = tail call i32 @getnameinfo(%struct.sockaddr* %0, i32 %1, i8* %2, i32 %3, i8* %4, i32 %5, i32 %8)
ret i32 %9
}