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

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ setenv(char *, char *, int /*<<< orphan*/);
void pager_preexec(void) {
  fd_set in;
  fd_set exception;
  FD_ZERO(&in);
  FD_ZERO(&exception);
  FD_SET(0, &in);
  FD_SET(0, &exception);
  select(1, &in, NULL, &exception, NULL);
  setenv("LESS", "FRSX", 0);
}


x86 assembly (clang, -O0):
<pager_preexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <FD_ZERO@plt>
lea    -0x8(%rbp),%rdi
call   1040 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x4(%rbp),%rsi
call   1060 <FD_SET@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1060 <FD_SET@plt>
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
lea    -0x8(%rbp),%rcx
mov    %r8,%rdx
call   1050 <select@plt>
lea    0xe6f(%rip),%rdi
lea    0xe6d(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pager_preexec>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <FD_ZERO@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <FD_ZERO@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1060 <FD_SET@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <FD_SET@plt>
mov    $0x1,%edi
mov    %r14,%rsi
xor    %edx,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1050 <select@plt>
lea    0xe74(%rip),%rdi
lea    0xe72(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"LESS\00"
@.str.1 = [5 x i8] c"FRSX\00"
define void @pager_preexec() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @FD_ZERO(i32* %1)
%4 = call i32 @FD_ZERO(i32* %2)
%5 = call i32 @FD_SET(i32 0, i32* %1)
%6 = call i32 @FD_SET(i32 0, i32* %2)
%7 = call i32 @select(i32 1, i32* %1, i32* null, i32* %2, i32* null)
%8 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"LESS\00"
@.str.1 = [5 x i8] c"FRSX\00"
define void @pager_preexec() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @FD_ZERO(i32* %1)
%6 = call i32 @FD_ZERO(i32* %2)
%7 = call i32 @FD_SET(i32 0, i32* %1)
%8 = call i32 @FD_SET(i32 0, i32* %2)
%9 = call i32 @select(i32 1, i32* %1, i32* null, i32* %2, i32* null)
%10 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}