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

/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
int /*<<< orphan*/ __recvfrom(int, void *, size_t, int, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
ssize_t __recvfrom_chk(int fd, void *buf, size_t n, size_t buflen, int flags,
                       __SOCKADDR_ARG addr, socklen_t *addr_len) {
  if (n > buflen)
    __chk_fail();
  return __recvfrom(fd, buf, n, flags, addr, addr_len);
}


x86 assembly (clang, -O0):
<__recvfrom_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    1158 <__recvfrom_chk+0x38>
mov    $0x0,%al
call   1030 <__chk_fail@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9
call   1040 <__recvfrom@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__recvfrom_chk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %edi,%ebp
mov    0x40(%rsp),%r12
cmp    %rcx,%rdx
jbe    114a <__recvfrom_chk+0x2a>
xor    %eax,%eax
call   1030 <__chk_fail@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
mov    %r12,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <__recvfrom@plt>

LLVM IR (-O0):
define i32 @__recvfrom_chk(i32 %0, i8* %1, i64 %2, i64 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i32 %0, i32* %8
store i8* %1, i8** %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32* %6, i32** %14
%15 = load i64, i64* %10
%16 = load i64, i64* %11
%17 = icmp ugt i64 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %7
%19 = call i32 (...) @__chk_fail()
br label %20
20: ; preds = %18, %7
%21 = load i32, i32* %8
%22 = load i8*, i8** %9
%23 = load i64, i64* %10
%24 = load i32, i32* %12
%25 = load i32, i32* %13
%26 = load i32*, i32** %14
%27 = call i32 @__recvfrom(i32 %21, i8* %22, i64 %23, i32 %24, i32 %25, i32* %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @__recvfrom_chk(i32 %0, i8* %1, i64 %2, i64 %3, i32 %4, i32 %5, i32* %6) {
%8 = icmp ugt i64 %2, %3
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (...) @__chk_fail()
br label %11
11: ; preds = %9, %7
%12 = tail call i32 @__recvfrom(i32 %0, i8* %1, i64 %2, i32 %4, i32 %5, i32* %6)
ret i32 %12
}