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

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_CORK;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int reset_tcp_cork(int fd) {
  int off = 0;
  do {
    if ((setsockopt(fd, IPPROTO_TCP, TCP_CORK, &off, sizeof(off)) == -1)) {
      fprintf(stderr, "[ERROR in %s:%d]: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/zhaolei1023/muse/refs/heads/master/"
              "src/net.c",
              34, (strerror(errno)));
      return ((-1));
    }
  } while (0);
  return (0);
}


x86 assembly (clang, -O0):
<reset_tcp_cork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    11b3 <reset_tcp_cork+0x83>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x10(%rbp),%edi
mov    %rax,%r8
lea    0xe6a(%rip),%rsi
lea    0xe79(%rip),%rdx
mov    $0x22,%ecx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bf <reset_tcp_cork+0x8f>
jmp    11b8 <reset_tcp_cork+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_tcp_cork>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    11a1 <reset_tcp_cork+0x71>
mov    0x2e61(%rip),%rax
mov    (%rax),%ebx
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe7a(%rip),%rsi
lea    0xe89(%rip),%rdx
mov    %ebx,%edi
mov    $0x22,%ecx
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
@stderr = global i32 0
@.str = [22 x i8] c"[ERROR in %s:%d]: %s\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zhaolei1023/muse/refs/heads/master/src/net.c\00"
@errno = global i32 0
define i32 @reset_tcp_cork(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %1
%6 = load i32, i32* %3
%7 = load i32, i32* @IPPROTO_TCP
%8 = load i32, i32* @TCP_CORK
%9 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i32* %4, i32 4)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 34, i8* %14)
store i32 -1, i32* %2
br label %18
16: ; preds = %5
br label %17
17: ; preds = %16
store i32 0, i32* %2
br label %18
18: ; preds = %17, %11
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
@stderr = global i32 0
@.str = [22 x i8] c"[ERROR in %s:%d]: %s\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zhaolei1023/muse/refs/heads/master/src/net.c\00"
@errno = global i32 0
define i32 @reset_tcp_cork(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_CORK
%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 %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 34, i8* %11)
br label %13
13: ; preds = %1, %8
%14 = phi i32 [ -1, %8 ], [ 0, %1 ]
ret i32 %14
}