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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int /*<<< orphan*/ test_getaddrinfo_err(int, char const *, char const *, int,
                                        int, int, int, char *, char *);
void test_getaddrinfo_err_nr(int n, const char *nodename, const char *servname,
                             int passhints, int flags, int family, int socktype,
                             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_getaddrinfo_err(n, nodename, servname, passhints, flags, family,
                       socktype, exp_result_s, result_s);
}


x86 assembly (clang, -O0):
<test_getaddrinfo_err_nr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
mov    0x18(%rbp),%ecx
mov    0x18(%rbp),%r8d
mov    $0x17,%esi
lea    0xe9f(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x20(%rbp),%ecx
mov    0x20(%rbp),%r8d
mov    $0x17,%esi
lea    0xe83(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%r11d
lea    -0x40(%rbp),%r10
lea    -0x60(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <test_getaddrinfo_err@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getaddrinfo_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    %rdx,%r13
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x88(%rsp),%ecx
lea    0xeaf(%rip),%r14
lea    0x10(%rsp),%rdi
mov    $0x17,%esi
mov    %r14,%rdx
mov    %ecx,%r8d
call   1030 <snprintf@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x17,%esi
mov    %r14,%rdx
mov    0x90(%rsp),%ecx
mov    %ecx,%r8d
call   1030 <snprintf@plt>
sub    $0x8,%rsp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    0x10(%rsp),%r8d
mov    0x14(%rsp),%r9d
push   %r15
lea    0x20(%rsp),%rax
push   %rax
mov    0x98(%rsp),%eax
push   %rax
call   1040 <test_getaddrinfo_err@plt>
add    $0x68,%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_getaddrinfo_err_nr(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [23 x i8]
%20 = alloca [23 x i8]
store i32 %0, i32* %10
store i8* %1, i8** %11
store i8* %2, i8** %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%21 = getelementptr inbounds [23 x i8], [23 x i8]* %19, i64 0, i64 0
%22 = load i32, i32* %17
%23 = load i32, i32* %17
%24 = call i32 @snprintf(i8* %21, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23)
%25 = getelementptr inbounds [23 x i8], [23 x i8]* %20, i64 0, i64 0
%26 = load i32, i32* %18
%27 = load i32, i32* %18
%28 = call i32 @snprintf(i8* %25, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* %10
%30 = load i8*, i8** %11
%31 = load i8*, i8** %12
%32 = load i32, i32* %13
%33 = load i32, i32* %14
%34 = load i32, i32* %15
%35 = load i32, i32* %16
%36 = getelementptr inbounds [23 x i8], [23 x i8]* %19, i64 0, i64 0
%37 = getelementptr inbounds [23 x i8], [23 x i8]* %20, i64 0, i64 0
%38 = call i32 @test_getaddrinfo_err(i32 %29, i8* %30, i8* %31, i32 %32, i32 %33, i32 %34, i32 %35, i8* %36, i8* %37)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d/0x%x\00"
define void @test_getaddrinfo_err_nr(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca [23 x i8]
%11 = alloca [23 x i8]
%12 = getelementptr inbounds [23 x i8], [23 x i8]* %10, i64 0, i64 0
%13 = getelementptr inbounds [23 x i8], [23 x i8]* %11, i64 0, i64 0
%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 @snprintf(i8* %13, i32 23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %8)
%16 = call i32 @test_getaddrinfo_err(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6, i8* %12, i8* %13)
ret void
}