#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 timeval {
  int member_0;
  int /*<<< orphan*/ member_1;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
scalar_t__ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, struct timeval *);
int recibido_en_plazo(int descriptor, int segundos) {
  struct timeval plazo = {segundos, 0};
  fd_set readfds;
  FD_ZERO(&readfds);
  FD_SET(descriptor, &readfds);
  return select(descriptor + 1, &readfds, (fd_set *)NULL, (fd_set *)NULL,
                &plazo) != 0;
}


x86 assembly (clang, -O0):
<recibido_en_plazo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <FD_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1050 <FD_SET@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rdx
call   1040 <select@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recibido_en_plazo>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
mov    %esi,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x14(%rsp),%r14
mov    %r14,%rdi
call   1030 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <FD_SET@plt>
add    $0x1,%ebx
lea    0x8(%rsp),%r8
mov    %ebx,%edi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @recibido_en_plazo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.timeval
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%8 = load i32, i32* %4
store i32 %8, i32* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i32 0, i32* %9
%10 = call i32 @FD_ZERO(i32* %6)
%11 = load i32, i32* %3
%12 = call i32 @FD_SET(i32 %11, i32* %6)
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = call i64 @select(i32 %14, i32* %6, i32* null, i32* null, %struct.timeval* %5)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @recibido_en_plazo(i32 %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = alloca i32
%5 = bitcast %struct.timeval* %3 to i8*
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %1, i32* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i32 0, i32* %7
%8 = bitcast i32* %4 to i8*
%9 = call i32 @FD_ZERO(i32* %4)
%10 = call i32 @FD_SET(i32 %0, i32* %4)
%11 = add nsw i32 %0, 1
%12 = call i64 @select(i32 %11, i32* %4, i32* null, i32* null, %struct.timeval* %3)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}