#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 */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
scalar_t__ ECONNABORTED;
scalar_t__ EINTR;
scalar_t__ EWOULDBLOCK;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int Accept(int fd, struct sockaddr_in *addr, socklen_t *addrlen) {
  int new;
  new = accept(fd, (struct sockaddr *)addr, addrlen);
  if (new < 0) {
    if (!((errno == EWOULDBLOCK) || (errno == ECONNABORTED) ||
          (errno == EINTR)))
      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",
                387, "accept", strerror(errno));
      } while (0);
  }
  return new;
}


x86 assembly (clang, -O0):
<Accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <accept@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11fd <Accept+0xcd>
mov    0x2e71(%rip),%rax
mov    (%rax),%rax
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
je     11f8 <Accept+0xc8>
mov    0x2e57(%rip),%rax
mov    (%rax),%rax
mov    0x2e35(%rip),%rcx
cmp    (%rcx),%rax
je     11f8 <Accept+0xc8>
mov    0x2e3d(%rip),%rax
mov    (%rax),%rax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%rax
je     11f8 <Accept+0xc8>
jmp    11b3 <Accept+0x83>
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%rdi
call   1050 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%r9
lea    0xe25(%rip),%rsi
lea    0xe35(%rip),%rdx
mov    $0x183,%ecx
lea    0xec3(%rip),%r8
call   1030 <fprintf@plt>
jmp    11f8 <Accept+0xc8>
jmp    11fd <Accept+0xcd>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Accept>:
push   %rbp
push   %rbx
push   %rax
call   1040 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    119e <Accept+0x6e>
mov    0x2e93(%rip),%rax
mov    (%rax),%rdi
mov    0x2e81(%rip),%rax
cmp    (%rax),%rdi
je     119e <Accept+0x6e>
mov    0x2e65(%rip),%rax
cmp    (%rax),%rdi
je     119e <Accept+0x6e>
mov    0x2e61(%rip),%rax
cmp    (%rax),%rdi
je     119e <Accept+0x6e>
mov    0x2e6d(%rip),%rax
mov    (%rax),%ebp
call   1050 <strerror@plt>
lea    0xe7f(%rip),%rsi
lea    0xe8f(%rip),%rdx
lea    0xf22(%rip),%r8
mov    %ebp,%edi
mov    $0x183,%ecx
mov    %rax,%r9
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@errno = global i64 0
@EWOULDBLOCK = global i64 0
@ECONNABORTED = global i64 0
@EINTR = global i64 0
@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 = [7 x i8] c"accept\00"
define i32 @Accept(i32 %0, %struct.sockaddr_in* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr_in*
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%10 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%11 = load i32*, i32** %6
%12 = call i32 @accept(i32 %8, %struct.sockaddr* %10, i32* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %35
15: ; preds = %3
%16 = load i64, i64* @errno
%17 = load i64, i64* @EWOULDBLOCK
%18 = icmp eq i64 %16, %17
br i1 %18, label %34, label %19
19: ; preds = %15
%20 = load i64, i64* @errno
%21 = load i64, i64* @ECONNABORTED
%22 = icmp eq i64 %20, %21
br i1 %22, label %34, label %23
23: ; preds = %19
%24 = load i64, i64* @errno
%25 = load i64, i64* @EINTR
%26 = icmp eq i64 %24, %25
br i1 %26, label %34, label %27
27: ; preds = %23
br label %28
28: ; preds = %27
%29 = load i32, i32* @stderr
%30 = load i64, i64* @errno
%31 = call i8* @strerror(i64 %30)
%32 = call i32 @fprintf(i32 %29, 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 387, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %28
br label %34
34: ; preds = %33, %23, %19, %15
br label %35
35: ; preds = %34, %3
%36 = load i32, i32* %7
ret i32 %36
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@errno = global i64 0
@EWOULDBLOCK = global i64 0
@ECONNABORTED = global i64 0
@EINTR = global i64 0
@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 = [7 x i8] c"accept\00"
define i32 @Accept(i32 %0, %struct.sockaddr_in* %1, i32* %2) {
%4 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%5 = tail call i32 @accept(i32 %0, %struct.sockaddr* %4, i32* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %3
%8 = load i64, i64* @errno
%9 = load i64, i64* @EWOULDBLOCK
%10 = icmp eq i64 %8, %9
%11 = load i64, i64* @ECONNABORTED
%12 = icmp eq i64 %8, %11
%13 = select i1 %10, i1 true, i1 %12
%14 = load i64, i64* @EINTR
%15 = icmp eq i64 %8, %14
%16 = select i1 %13, i1 true, i1 %15
br i1 %16, label %21, label %17
17: ; preds = %7
%18 = load i32, i32* @stderr
%19 = tail call i8* @strerror(i64 %8)
%20 = tail call i32 @fprintf(i32 %18, 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 387, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %7, %17, %3
ret i32 %5
}