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

/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ recvfromn(int, void *, size_t, int, struct sockaddr *,
                             int /*<<< orphan*/ *);
ssize_t Recvfromn(int sockfd, void *buf, size_t len, int flags,
                  struct sockaddr *src_addr, socklen_t *addrlen) {
  ssize_t n;
  if ((n = recvfromn(sockfd, buf, len, flags, src_addr, addrlen)) < 0)
    err_sys("recvfromn error");
  return (n);
}


x86 assembly (clang, -O0):
<Recvfromn>:
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 <recvfromn@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    1171 <Recvfromn+0x51>
lea    0xe94(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Recvfromn>:
push   %rbx
call   1040 <recvfromn@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Recvfromn+0x18>
lea    0xecd(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"recvfromn error\00"
define i32 @Recvfromn(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 i32
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 i32 @recvfromn(i32 %14, i8* %15, i64 %16, i32 %17, %struct.sockaddr* %18, i32* %19)
store i32 %20, i32* %13
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %6
%23 = call i32 @err_sys(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %6
%25 = load i32, i32* %13
ret i32 %25
}

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