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

/* Variables and functions */
int AF_INET;
int AF_LOCAL;
int AF_UNIX;
int SOCK_DGRAM;
int SOCK_RAW;
int SOCK_RDM;
int SOCK_SEQPACKET;
int SOCK_STREAM;
int /*<<< orphan*/ socketpair(int, int, int, int *);
ssize_t test(void) {
  int domain;
  int type;
  int protocol = 1;
  int sv[2] = {2, 3};
  domain = AF_UNIX;
  domain = AF_LOCAL;
  domain = AF_INET;
  type = SOCK_STREAM;
  type = SOCK_DGRAM;
  type = SOCK_SEQPACKET;
  type = SOCK_RAW;
  type = SOCK_RDM;
  return socketpair(domain, type, protocol, sv);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0xc(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x14(%rbp),%rcx
call   1030 <socketpair@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
movabs $0x300000002,%rax
mov    %rax,(%rsp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rcx
mov    $0x1,%edx
call   1030 <socketpair@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.test.sv = [2 x i32] [i32 2, i32 3]
@AF_UNIX = global i32 0
@AF_LOCAL = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_SEQPACKET = global i32 0
@SOCK_RAW = global i32 0
@SOCK_RDM = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x i32]
store i32 1, i32* %3
%5 = bitcast [2 x i32]* %4 to i8*
%6 = load i32, i32* @AF_UNIX
store i32 %6, i32* %1
%7 = load i32, i32* @AF_LOCAL
store i32 %7, i32* %1
%8 = load i32, i32* @AF_INET
store i32 %8, i32* %1
%9 = load i32, i32* @SOCK_STREAM
store i32 %9, i32* %2
%10 = load i32, i32* @SOCK_DGRAM
store i32 %10, i32* %2
%11 = load i32, i32* @SOCK_SEQPACKET
store i32 %11, i32* %2
%12 = load i32, i32* @SOCK_RAW
store i32 %12, i32* %2
%13 = load i32, i32* @SOCK_RDM
store i32 %13, i32* %2
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%18 = call i32 @socketpair(i32 %14, i32 %15, i32 %16, i32* %17)
ret i32 %18
}

LLVM IR (-O2):
@AF_UNIX = global i32 0
@AF_LOCAL = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_SEQPACKET = global i32 0
@SOCK_RAW = global i32 0
@SOCK_RDM = global i32 0
define i32 @test() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 12884901890, i64* %1
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_RDM
%5 = bitcast i64* %1 to i32*
%6 = call i32 @socketpair(i32 %3, i32 %4, i32 1, i32* %5)
ret i32 %6
}