#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 {
  int dummy;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
scalar_t__ recvfrom(int, void *, size_t, int, struct sockaddr *,
                    int /*<<< orphan*/ *);
ssize_t Recvfrom(int fd, void *ptr, size_t nbytes, int flags,
                 struct sockaddr *sa, socklen_t *salenptr) {
  ssize_t n;
  n = recvfrom(fd, ptr, nbytes, flags, sa, salenptr);
  if (n < 0)
    err_sys("recvfrom error");
  return (n);
}


x86 assembly (clang, -O0):
<Recvfrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1040 <recvfrom@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jge    1174 <Recvfrom+0x54>
lea    0xe91(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Recvfrom>:
push   %rbx
call   1040 <recvfrom@plt>
mov    %rax,%rbx
test   %rax,%rax
jns    113a <Recvfrom+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <err_sys@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"recvfrom error\00"
define i64 @Recvfrom(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.sockaddr*
%12 = alloca i32*
%13 = alloca i64
store i32 %0, i32* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store %struct.sockaddr* %4, %struct.sockaddr** %11
store i32* %5, i32** %12
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = load i64, i64* %9
%17 = load i32, i32* %10
%18 = load %struct.sockaddr*, %struct.sockaddr** %11
%19 = load i32*, i32** %12
%20 = call i64 @recvfrom(i32 %14, i8* %15, i64 %16, i32 %17, %struct.sockaddr* %18, i32* %19)
store i64 %20, i64* %13
%21 = load i64, i64* %13
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %6
%24 = call i32 @err_sys(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %6
%26 = load i64, i64* %13
ret i64 %26
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"recvfrom error\00"
define i64 @Recvfrom(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = tail call i64 @recvfrom(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @err_sys(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
ret i64 %7
}