#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 */
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ result_s;
typedef int /*<<< orphan*/ exp_result_s;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int /*<<< orphan*/ test_getnameinfo_err(int, unsigned long, unsigned short,
                                        int /*<<< orphan*/, int /*<<< orphan*/,
                                        int, char *, char *);
void test_getnameinfo_err_nr(int n, unsigned long ipaddr, unsigned short port,
                             socklen_t nodelen, socklen_t servicelen, int flags,
                             int exp_result, int result) {
  char exp_result_s[23], result_s[23];
  snprintf(exp_result_s, sizeof(exp_result_s), "%d/0x%x", exp_result,
           exp_result);
  snprintf(result_s, sizeof(result_s), "%d/0x%x", result, result);
  test_getnameinfo_err(n, ipaddr, port, nodelen, servicelen, flags,
                       exp_result_s, result_s);
}


x86 assembly (clang, -O0):
<test_getnameinfo_err_nr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %dx,%ax
mov    0x18(%rbp),%edx
mov    0x10(%rbp),%edx
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    0x10(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    $0x17,%esi
lea    0xea2(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x18(%rbp),%ecx
mov    0x18(%rbp),%r8d
mov    $0x17,%esi
lea    0xe86(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x12(%rbp),%dx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
lea    -0x40(%rbp),%r10
lea    -0x60(%rbp),%rax
movzwl %dx,%edx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <test_getnameinfo_err@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getnameinfo_err_nr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8d,0x8(%rsp)
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x80(%rsp),%ecx
lea    0xeaf(%rip),%r14
lea    0x10(%rsp),%rdi
mov    $0x17,%esi
mov    %r14,%rdx
mov    %ecx,%r8d
call   1040 <snprintf@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x17,%esi
mov    %r14,%rdx
mov    0x88(%rsp),%ecx
mov    %ecx,%r8d
call   1040 <snprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    0x8(%rsp),%r8d
mov    0xc(%rsp),%r9d
push   %r15
lea    0x18(%rsp),%rax
push   %rax
call   1030 <test_getnameinfo_err@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d/0x%x\00"
define void @test_getnameinfo_err_nr(i32 %0, i64 %1, i16 zeroext %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i64
%11 = alloca i16
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [23 x i8]
%18 = alloca [23 x i8]
store i32 %0, i32* %9
store i64 %1, i64* %10
store i16 %2, i16* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%19 = getelementptr inbounds [23 x i8], [23 x i8]* %17, i64 0, i64 0
%20 = load i32, i32* %15
%21 = load i32, i32* %15
%22 = call i32 @snprintf(i8* %19, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
%23 = getelementptr inbounds [23 x i8], [23 x i8]* %18, i64 0, i64 0
%24 = load i32, i32* %16
%25 = load i32, i32* %16
%26 = call i32 @snprintf(i8* %23, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32, i32* %9
%28 = load i64, i64* %10
%29 = load i16, i16* %11
%30 = load i32, i32* %12
%31 = load i32, i32* %13
%32 = load i32, i32* %14
%33 = getelementptr inbounds [23 x i8], [23 x i8]* %17, i64 0, i64 0
%34 = getelementptr inbounds [23 x i8], [23 x i8]* %18, i64 0, i64 0
%35 = call i32 @test_getnameinfo_err(i32 %27, i64 %28, i16 zeroext %29, i32 %30, i32 %31, i32 %32, i8* %33, i8* %34)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d/0x%x\00"
define void @test_getnameinfo_err_nr(i32 %0, i64 %1, i16 zeroext %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca [23 x i8]
%10 = alloca [23 x i8]
%11 = getelementptr inbounds [23 x i8], [23 x i8]* %9, i64 0, i64 0
%12 = getelementptr inbounds [23 x i8], [23 x i8]* %10, i64 0, i64 0
%13 = call i32 @snprintf(i8* %11, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %6)
%14 = call i32 @snprintf(i8* %12, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %7)
%15 = call i32 @test_getnameinfo_err(i32 %0, i64 %1, i16 zeroext %2, i32 %3, i32 %4, i32 %5, i8* %11, i8* %12)
ret void
}