#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__ EINTR;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           char *);
int sendto(int, unsigned char *, int, int, struct sockaddr *,
           int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int Sendto(int fd, unsigned char *p, int len, int flags, struct sockaddr_in *to,
           socklen_t tolen) {
  int n;
  do {
    n = sendto(fd, p, len, flags, (struct sockaddr *)to, tolen);
  } while (n < 0 && errno == EINTR);
  if (n < 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",
              472, "write", strerror(errno));
    } while (0);
  return n;
}


x86 assembly (clang, -O0):
<Sendto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1030 <sendto@plt>
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x28(%rbp)
mov    %al,-0x29(%rbp)
jge    1193 <Sendto+0x63>
mov    0x2e58(%rip),%rax
mov    (%rax),%rax
mov    0x2e46(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    114d <Sendto+0x1d>
cmpl   $0x0,-0x28(%rbp)
jge    11f2 <Sendto+0xc2>
jmp    11ad <Sendto+0x7d>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%rdi
call   1050 <strerror@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%r9
lea    0xe2b(%rip),%rsi
lea    0xe3b(%rip),%rdx
mov    $0x1d8,%ecx
lea    0xec9(%rip),%r8
call   1040 <fprintf@plt>
jmp    11f2 <Sendto+0xc2>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sendto>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8,%r15
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %edi,%r14d
nop
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15,%r8
mov    0x4(%rsp),%r9d
call   1030 <sendto@plt>
mov    %eax,%ebx
mov    0x2e66(%rip),%rax
mov    (%rax),%rdi
test   %ebx,%ebx
jns    1185 <Sendto+0x55>
mov    0x2e50(%rip),%rax
cmp    (%rax),%rdi
je     1150 <Sendto+0x20>
test   %ebx,%ebx
jns    11bb <Sendto+0x8b>
mov    0x2e50(%rip),%rax
mov    (%rax),%ebp
call   1050 <strerror@plt>
lea    0xe62(%rip),%rsi
lea    0xe72(%rip),%rdx
lea    0xf05(%rip),%r8
mov    %ebp,%edi
mov    $0x1d8,%ecx
mov    %rax,%r9
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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