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

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           char *);
int setsockopt(int, int, int, void const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int Setsockopt(int fd, int level, int optname, const void *opt_val,
               socklen_t optlen) {
  int ret_code;
  ret_code = setsockopt(fd, level, optname, opt_val, optlen);
  if (ret_code < 0)
    do {
      fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/"
              "master/ipmipower/src/wrappers.c",
              147, "setsockopt", strerror(errno));
    } while (0);
  return ret_code;
}


x86 assembly (clang, -O0):
<Setsockopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11b5 <Setsockopt+0x85>
jmp    1171 <Setsockopt+0x41>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%r9
lea    0xe68(%rip),%rsi
lea    0xe78(%rip),%rdx
mov    $0x93,%ecx
lea    0xf06(%rip),%r8
call   1040 <fprintf@plt>
jmp    11b5 <Setsockopt+0x85>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Setsockopt>:
push   %rbp
push   %rbx
push   %rax
call   1030 <setsockopt@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1179 <Setsockopt+0x49>
mov    0x2e9b(%rip),%rax
mov    (%rax),%ebp
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea4(%rip),%rsi
lea    0xeb4(%rip),%rdx
lea    0xf47(%rip),%r8
mov    %ebp,%edi
mov    $0x93,%ecx
mov    %rax,%r9
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"ERROR: [%s:%d] %s: %s\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/master/ipmipower/src/wrappers.c\00"
@.str.2 = [11 x i8] c"setsockopt\00"
@errno = global i32 0
define i32 @Setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = call i32 @setsockopt(i32 %12, i32 %13, i32 %14, i8* %15, i32 %16)
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %5
br label %21
21: ; preds = %20
%22 = load i32, i32* @stderr
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 147, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %21
br label %27
27: ; preds = %26, %5
%28 = load i32, i32* %11
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"ERROR: [%s:%d] %s: %s\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/master/ipmipower/src/wrappers.c\00"
@.str.2 = [11 x i8] c"setsockopt\00"
@errno = global i32 0
define i32 @Setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = tail call i8* @strerror(i32 %10)
%12 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 147, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %8, %5
ret i32 %6
}