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

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_SNDBUF;
int /*<<< orphan*/ perror(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int adjust_bufsize(int fd) {
  int ret;
  int optval;
  optval = 33304 * 50;
  ret = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval));
  if (ret == -1) {
    perror("setsockopt(SO_SNDBUF)");
    return (ret);
  }
  return (ret);
}


x86 assembly (clang, -O0):
<adjust_bufsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1968b0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    117a <adjust_bufsize+0x5a>
lea    0xe96(%rip),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <adjust_bufsize+0x60>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_bufsize>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1968b0,0xc(%rsp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     115e <adjust_bufsize+0x3e>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
jmp    1156 <adjust_bufsize+0x36>

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
@.str = [22 x i8] c"setsockopt(SO_SNDBUF)\00"
define i32 @adjust_bufsize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 1665200, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_SNDBUF
%9 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i32* %5, i32 4)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %17
15: ; preds = %1
%16 = load i32, i32* %4
store i32 %16, i32* %2
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
@.str = [22 x i8] c"setsockopt(SO_SNDBUF)\00"
define i32 @adjust_bufsize(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1665200, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_SNDBUF
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %1, %8
ret i32 %6
}