#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 */

/* Variables and functions */
int AF_INET;
int AF_INET6;
int /*<<< orphan*/ build_rcv_fd(int, int, int *, int, char const *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test(int *, int, int, int, int);
void run_one_test(int fam_send, int fam_rcv, int proto, const char *addr_str) {
  int rcv_fds[10], i;
  build_rcv_fd(AF_INET, proto, rcv_fds, 2, NULL);
  build_rcv_fd(AF_INET6, proto, rcv_fds + 2, 2, NULL);
  build_rcv_fd(fam_rcv, proto, rcv_fds + 4, 1, addr_str);
  build_rcv_fd(AF_INET, proto, rcv_fds + 5, 2, NULL);
  build_rcv_fd(AF_INET6, proto, rcv_fds + 7, 2, NULL);
  test(rcv_fds, 9, fam_send, proto, rcv_fds[4]);
  for (i = 0; i < 9; ++i)
    close(rcv_fds[i]);
  fprintf(stderr, "pass\n");
}


x86 assembly (clang, -O0):
<run_one_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    $0x2,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <build_rcv_fd@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
add    $0x8,%rdx
mov    $0x2,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <build_rcv_fd@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
add    $0x10,%rdx
mov    -0x18(%rbp),%r8
mov    $0x1,%ecx
call   1030 <build_rcv_fd@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
add    $0x14,%rdx
mov    $0x2,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <build_rcv_fd@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
add    $0x1c,%rdx
mov    $0x2,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <build_rcv_fd@plt>
lea    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    $0x9,%esi
call   1060 <test@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x9,-0x44(%rbp)
jge    123d <run_one_test+0xfd>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1040 <close@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1218 <run_one_test+0xd8>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
lea    0xdb3(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_one_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r12
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r15d
mov    0x2e89(%rip),%r13
mov    0x0(%r13),%edi
mov    %rsp,%rdx
mov    %ebx,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <build_rcv_fd@plt>
mov    0x2e64(%rip),%r14
mov    (%r14),%edi
lea    0x8(%rsp),%rdx
mov    %ebx,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <build_rcv_fd@plt>
lea    0x10(%rsp),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1,%ecx
mov    %r12,%r8
call   1030 <build_rcv_fd@plt>
mov    0x0(%r13),%edi
lea    0x14(%rsp),%rdx
mov    %ebx,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <build_rcv_fd@plt>
mov    (%r14),%edi
lea    0x1c(%rsp),%rdx
mov    %ebx,%esi
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <build_rcv_fd@plt>
mov    0x10(%rsp),%r8d
mov    %rsp,%rdi
mov    $0x9,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1060 <test@plt>
mov    (%rsp),%edi
call   1040 <close@plt>
mov    0x4(%rsp),%edi
call   1040 <close@plt>
mov    0x8(%rsp),%edi
call   1040 <close@plt>
mov    0xc(%rsp),%edi
call   1040 <close@plt>
mov    0x10(%rsp),%edi
call   1040 <close@plt>
mov    0x14(%rsp),%edi
call   1040 <close@plt>
mov    0x18(%rsp),%edi
call   1040 <close@plt>
mov    0x1c(%rsp),%edi
call   1040 <close@plt>
mov    0x20(%rsp),%edi
call   1040 <close@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
lea    0xdb1(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@stderr = global i32 0
@.str = [6 x i8] c"pass\0A\00"
define void @run_one_test(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [10 x i32]
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* %7
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%14 = call i32 @build_rcv_fd(i32 %11, i32 %12, i32* %13, i32 2, i8* null)
%15 = load i32, i32* @AF_INET6
%16 = load i32, i32* %7
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = call i32 @build_rcv_fd(i32 %15, i32 %16, i32* %18, i32 2, i8* null)
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%23 = getelementptr inbounds i32, i32* %22, i64 4
%24 = load i8*, i8** %8
%25 = call i32 @build_rcv_fd(i32 %20, i32 %21, i32* %23, i32 1, i8* %24)
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* %7
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%29 = getelementptr inbounds i32, i32* %28, i64 5
%30 = call i32 @build_rcv_fd(i32 %26, i32 %27, i32* %29, i32 2, i8* null)
%31 = load i32, i32* @AF_INET6
%32 = load i32, i32* %7
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%34 = getelementptr inbounds i32, i32* %33, i64 7
%35 = call i32 @build_rcv_fd(i32 %31, i32 %32, i32* %34, i32 2, i8* null)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 0
%37 = load i32, i32* %5
%38 = load i32, i32* %7
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 4
%40 = load i32, i32* %39
%41 = call i32 @test(i32* %36, i32 9, i32 %37, i32 %38, i32 %40)
store i32 0, i32* %10
br label %42
42: ; preds = %51, %4
%43 = load i32, i32* %10
%44 = icmp slt i32 %43, 9
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
br label %51
51: ; preds = %45
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %42
54: ; preds = %42
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@stderr = global i32 0
@.str = [6 x i8] c"pass\0A\00"
define void @run_one_test(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca [10 x i32]
%6 = bitcast [10 x i32]* %5 to i8*
%7 = load i32, i32* @AF_INET
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%9 = call i32 @build_rcv_fd(i32 %7, i32 %2, i32* %8, i32 2, i8* null)
%10 = load i32, i32* @AF_INET6
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 2
%12 = call i32 @build_rcv_fd(i32 %10, i32 %2, i32* %11, i32 2, i8* null)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 4
%14 = call i32 @build_rcv_fd(i32 %1, i32 %2, i32* %13, i32 1, i8* %3)
%15 = load i32, i32* @AF_INET
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 5
%17 = call i32 @build_rcv_fd(i32 %15, i32 %2, i32* %16, i32 2, i8* null)
%18 = load i32, i32* @AF_INET6
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 7
%20 = call i32 @build_rcv_fd(i32 %18, i32 %2, i32* %19, i32 2, i8* null)
%21 = load i32, i32* %13
%22 = call i32 @test(i32* %8, i32 9, i32 %0, i32 %2, i32 %21)
%23 = load i32, i32* %8
%24 = call i32 @close(i32 %23)
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 1
%26 = load i32, i32* %25
%27 = call i32 @close(i32 %26)
%28 = load i32, i32* %11
%29 = call i32 @close(i32 %28)
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 3
%31 = load i32, i32* %30
%32 = call i32 @close(i32 %31)
%33 = load i32, i32* %13
%34 = call i32 @close(i32 %33)
%35 = load i32, i32* %16
%36 = call i32 @close(i32 %35)
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 6
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
%40 = load i32, i32* %19
%41 = call i32 @close(i32 %40)
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 8
%43 = load i32, i32* %42
%44 = call i32 @close(i32 %43)
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}