#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 IPPROTO_ICMP;
int IPPROTO_IP;
int IPPROTO_TCP;
int IPPROTO_UDP;
int PF_INET;
int PF_UNIX;
int SOCK_DGRAM;
int SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ socketpair(int, int, int, int *);
int main() {
  int fds[2], fl, i;
  socketpair(0, SOCK_STREAM, 0, fds);
  socketpair(PF_INET, 75, IPPROTO_IP, fds);
  socketpair(PF_UNIX, SOCK_STREAM, 0, 0);
  socketpair(PF_INET, SOCK_DGRAM, IPPROTO_UDP, fds);
  socketpair(PF_INET, SOCK_DGRAM, IPPROTO_TCP, fds);
  socketpair(PF_INET, SOCK_STREAM, IPPROTO_TCP, fds);
  socketpair(PF_INET, SOCK_STREAM, IPPROTO_ICMP, fds);
  socketpair(PF_UNIX, SOCK_DGRAM, 0, fds);
  close(fds[0]);
  close(fds[1]);
  socketpair(PF_UNIX, SOCK_STREAM, 0, fds);
  close(fds[0]);
  close(fds[1]);
  socketpair(-1, SOCK_STREAM, 0, fds);
  socketpair(PF_UNIX, -1, 0, fds);
  socketpair(PF_UNIX, SOCK_STREAM, -1, fds);
  socketpair(PF_UNIX, SOCK_STREAM, 0, (int *)-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
xor    %edx,%edx
mov    %edx,%edi
call   1040 <socketpair@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4b,%esi
call   1040 <socketpair@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <socketpair@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
mov    0x2e0c(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
call   1040 <socketpair@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
mov    0x2e20(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
call   1040 <socketpair@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
mov    0x2de5(%rip),%rax
mov    (%rax),%esi
mov    0x2dfc(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
call   1040 <socketpair@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
mov    0x2dc1(%rip),%rax
mov    (%rax),%esi
mov    0x2dc8(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
call   1040 <socketpair@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
xor    %edx,%edx
call   1040 <socketpair@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    0x2d70(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
xor    %edx,%edx
call   1040 <socketpair@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    0x2d4c(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
mov    $0xffffffff,%edi
xor    %edx,%edx
call   1040 <socketpair@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rcx
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1040 <socketpair@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
mov    0x2d11(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
mov    $0xffffffff,%edx
call   1040 <socketpair@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
mov    0x2cf1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    $0xffffffffffffffff,%rcx
call   1040 <socketpair@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e86(%rip),%r14
mov    (%r14),%esi
mov    %rsp,%rbx
xor    %edi,%edi
xor    %edx,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    0x2e65(%rip),%r12
mov    (%r12),%edi
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    $0x4b,%esi
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    0x2e8c(%rip),%r15
mov    (%r15),%edi
mov    (%r14),%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <socketpair@plt>
mov    (%r12),%edi
mov    0x2e4a(%rip),%r13
mov    0x0(%r13),%esi
mov    0x2e0f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r12),%edi
mov    0x0(%r13),%esi
mov    0x2e2e(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r12),%edi
mov    (%r14),%esi
mov    0x0(%rbp),%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r12),%edi
mov    (%r14),%esi
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r15),%edi
mov    0x0(%r13),%esi
xor    %edx,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%rsp),%edi
call   1030 <close@plt>
mov    0x4(%rsp),%edi
call   1030 <close@plt>
mov    (%r15),%edi
mov    (%r14),%esi
xor    %edx,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%rsp),%edi
call   1030 <close@plt>
mov    0x4(%rsp),%edi
call   1030 <close@plt>
mov    (%r14),%esi
mov    $0xffffffff,%edi
xor    %edx,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r15),%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r15),%edi
mov    (%r14),%esi
mov    $0xffffffff,%edx
mov    %rbx,%rcx
call   1040 <socketpair@plt>
mov    (%r15),%edi
mov    (%r14),%esi
xor    %edx,%edx
mov    $0xffffffffffffffff,%rcx
call   1040 <socketpair@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SOCK_STREAM = global i32 0
@PF_INET = global i32 0
@IPPROTO_IP = global i32 0
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@IPPROTO_TCP = global i32 0
@IPPROTO_ICMP = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* @SOCK_STREAM
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = call i32 @socketpair(i32 0, i32 %4, i32 0, i32* %5)
%7 = load i32, i32* @PF_INET
%8 = load i32, i32* @IPPROTO_IP
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%10 = call i32 @socketpair(i32 %7, i32 75, i32 %8, i32* %9)
%11 = load i32, i32* @PF_UNIX
%12 = load i32, i32* @SOCK_STREAM
%13 = call i32 @socketpair(i32 %11, i32 %12, i32 0, i32* null)
%14 = load i32, i32* @PF_INET
%15 = load i32, i32* @SOCK_DGRAM
%16 = load i32, i32* @IPPROTO_UDP
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%18 = call i32 @socketpair(i32 %14, i32 %15, i32 %16, i32* %17)
%19 = load i32, i32* @PF_INET
%20 = load i32, i32* @SOCK_DGRAM
%21 = load i32, i32* @IPPROTO_TCP
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%23 = call i32 @socketpair(i32 %19, i32 %20, i32 %21, i32* %22)
%24 = load i32, i32* @PF_INET
%25 = load i32, i32* @SOCK_STREAM
%26 = load i32, i32* @IPPROTO_TCP
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%28 = call i32 @socketpair(i32 %24, i32 %25, i32 %26, i32* %27)
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = load i32, i32* @IPPROTO_ICMP
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%33 = call i32 @socketpair(i32 %29, i32 %30, i32 %31, i32* %32)
%34 = load i32, i32* @PF_UNIX
%35 = load i32, i32* @SOCK_DGRAM
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%37 = call i32 @socketpair(i32 %34, i32 %35, i32 0, i32* %36)
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%39 = load i32, i32* %38
%40 = call i32 @close(i32 %39)
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%42 = load i32, i32* %41
%43 = call i32 @close(i32 %42)
%44 = load i32, i32* @PF_UNIX
%45 = load i32, i32* @SOCK_STREAM
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%47 = call i32 @socketpair(i32 %44, i32 %45, i32 0, i32* %46)
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%52 = load i32, i32* %51
%53 = call i32 @close(i32 %52)
%54 = load i32, i32* @SOCK_STREAM
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%56 = call i32 @socketpair(i32 -1, i32 %54, i32 0, i32* %55)
%57 = load i32, i32* @PF_UNIX
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%59 = call i32 @socketpair(i32 %57, i32 -1, i32 0, i32* %58)
%60 = load i32, i32* @PF_UNIX
%61 = load i32, i32* @SOCK_STREAM
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%63 = call i32 @socketpair(i32 %60, i32 %61, i32 -1, i32* %62)
%64 = load i32, i32* @PF_UNIX
%65 = load i32, i32* @SOCK_STREAM
%66 = call i32 @socketpair(i32 %64, i32 %65, i32 0, i32* inttoptr (i64 -1 to i32*))
ret i32 0
}

LLVM IR (-O2):
@SOCK_STREAM = global i32 0
@PF_INET = global i32 0
@IPPROTO_IP = global i32 0
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@IPPROTO_TCP = global i32 0
@IPPROTO_ICMP = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = load i32, i32* @SOCK_STREAM
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%5 = call i32 @socketpair(i32 0, i32 %3, i32 0, i32* %4)
%6 = load i32, i32* @PF_INET
%7 = load i32, i32* @IPPROTO_IP
%8 = call i32 @socketpair(i32 %6, i32 75, i32 %7, i32* %4)
%9 = load i32, i32* @PF_UNIX
%10 = load i32, i32* @SOCK_STREAM
%11 = call i32 @socketpair(i32 %9, i32 %10, i32 0, i32* null)
%12 = load i32, i32* @PF_INET
%13 = load i32, i32* @SOCK_DGRAM
%14 = load i32, i32* @IPPROTO_UDP
%15 = call i32 @socketpair(i32 %12, i32 %13, i32 %14, i32* %4)
%16 = load i32, i32* @PF_INET
%17 = load i32, i32* @SOCK_DGRAM
%18 = load i32, i32* @IPPROTO_TCP
%19 = call i32 @socketpair(i32 %16, i32 %17, i32 %18, i32* %4)
%20 = load i32, i32* @PF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = load i32, i32* @IPPROTO_TCP
%23 = call i32 @socketpair(i32 %20, i32 %21, i32 %22, i32* %4)
%24 = load i32, i32* @PF_INET
%25 = load i32, i32* @SOCK_STREAM
%26 = load i32, i32* @IPPROTO_ICMP
%27 = call i32 @socketpair(i32 %24, i32 %25, i32 %26, i32* %4)
%28 = load i32, i32* @PF_UNIX
%29 = load i32, i32* @SOCK_DGRAM
%30 = call i32 @socketpair(i32 %28, i32 %29, i32 0, i32* %4)
%31 = load i32, i32* %4
%32 = call i32 @close(i32 %31)
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%34 = load i32, i32* %33
%35 = call i32 @close(i32 %34)
%36 = load i32, i32* @PF_UNIX
%37 = load i32, i32* @SOCK_STREAM
%38 = call i32 @socketpair(i32 %36, i32 %37, i32 0, i32* %4)
%39 = load i32, i32* %4
%40 = call i32 @close(i32 %39)
%41 = load i32, i32* %33
%42 = call i32 @close(i32 %41)
%43 = load i32, i32* @SOCK_STREAM
%44 = call i32 @socketpair(i32 -1, i32 %43, i32 0, i32* %4)
%45 = load i32, i32* @PF_UNIX
%46 = call i32 @socketpair(i32 %45, i32 -1, i32 0, i32* %4)
%47 = load i32, i32* @PF_UNIX
%48 = load i32, i32* @SOCK_STREAM
%49 = call i32 @socketpair(i32 %47, i32 %48, i32 -1, i32* %4)
%50 = load i32, i32* @PF_UNIX
%51 = load i32, i32* @SOCK_STREAM
%52 = call i32 @socketpair(i32 %50, i32 %51, i32 0, i32* inttoptr (i64 -1 to i32*))
ret i32 0
}