#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*/ rbuf;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *, int, scalar_t__);
int recv(int, char *, int, int /*<<< orphan*/);
void do_recv_verify_empty(int fdr) {
  char rbuf[1];
  int ret;
  ret = recv(fdr, rbuf, sizeof(rbuf), 0);
  if (ret != -1 || errno != EAGAIN)
    error(1, 0, "recv: not empty as expected (%d, %d)", ret, errno);
}


x86 assembly (clang, -O0):
<do_recv_verify_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1165 <do_recv_verify_empty+0x45>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rax
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%rax
je     1185 <do_recv_verify_empty+0x65>
mov    -0xc(%rbp),%ecx
mov    0x2e71(%rip),%rax
mov    (%rax),%r8
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe80(%rip),%rdx
call   1040 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_recv_verify_empty>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    0x2ea7(%rip),%rcx
mov    (%rcx),%r8
cmp    $0xffffffff,%eax
jne    114f <do_recv_verify_empty+0x2f>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%r8
jne    114f <do_recv_verify_empty+0x2f>
pop    %rax
ret
lea    0xeaa(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
mov    %eax,%ecx
call   1040 <error@plt>
pop    %rax
ret

LLVM IR (-O0):
@errno = global i64 0
@EAGAIN = global i64 0
@.str = [37 x i8] c"recv: not empty as expected (%d, %d)\00"
define void @do_recv_verify_empty(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%7 = call i32 @recv(i32 %5, i8* %6, i32 1, i32 0)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, -1
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i64, i64* @errno
%12 = load i64, i64* @EAGAIN
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %10, %1
%15 = load i32, i32* %4
%16 = load i64, i64* @errno
%17 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %15, i64 %16)
br label %18
18: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
@.str = [37 x i8] c"recv: not empty as expected (%d, %d)\00"
define void @do_recv_verify_empty(i32 %0) {
%2 = alloca [1 x i8]
%3 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%4 = call i32 @recv(i32 %0, i8* %3, i32 1, i32 0)
%5 = icmp eq i32 %4, -1
%6 = load i64, i64* @errno
%7 = load i64, i64* @EAGAIN
%8 = icmp eq i64 %6, %7
%9 = select i1 %5, i1 %8, i1 false
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %4, i64 %6)
br label %12
12: ; preds = %1, %10
ret void
}