#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 unsigned long socklen_t;

/* Variables and functions */
int __socketcall(int, unsigned long *);
int setsockopt(int fd, int level, int optname, const void *optval,
               socklen_t optlen) {
  unsigned long args[5];
  args[0] = fd;
  args[1] = level;
  args[2] = optname;
  args[3] = (unsigned long)optval;
  args[4] = optlen;
  return (__socketcall(14, args));
}


x86 assembly (clang, -O0):
<setsockopt>:
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    %r8,-0x20(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x50(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x50(%rbp),%rsi
mov    $0xe,%edi
call   1030 <__socketcall@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setsockopt>:
sub    $0x28,%rsp
movslq %edi,%rax
mov    %rax,(%rsp)
movslq %esi,%rax
mov    %rax,0x8(%rsp)
movslq %edx,%rax
mov    %rax,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %r8,0x20(%rsp)
mov    %rsp,%rsi
mov    $0xe,%edi
call   1030 <__socketcall@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca [5 x i64]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 0
store i64 %13, i64* %14
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 1
store i64 %16, i64* %17
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 2
store i64 %19, i64* %20
%21 = load i8*, i8** %9
%22 = ptrtoint i8* %21 to i64
%23 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 3
store i64 %22, i64* %23
%24 = load i64, i64* %10
%25 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 4
store i64 %24, i64* %25
%26 = getelementptr inbounds [5 x i64], [5 x i64]* %11, i64 0, i64 0
%27 = call i32 @__socketcall(i32 14, i64* %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca [5 x i64]
%7 = bitcast [5 x i64]* %6 to i8*
%8 = sext i32 %0 to i64
%9 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 0
store i64 %8, i64* %9
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 1
store i64 %10, i64* %11
%12 = sext i32 %2 to i64
%13 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 2
store i64 %12, i64* %13
%14 = ptrtoint i8* %3 to i64
%15 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 3
store i64 %14, i64* %15
%16 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 4
store i64 %4, i64* %16
%17 = call i32 @__socketcall(i32 14, i64* %9)
ret i32 %17
}