#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 tvec_base {
  int dummy;
};
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ run_timers(struct tvec_base *);
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void *runner(void *arg) {
  struct timeval tv = {
      0,
  };
  struct tvec_base *base = arg;
  while (1) {
    run_timers(base);
    tv.tv_sec = 1;
    tv.tv_usec = 0;
    (void)select(0, NULL, NULL, NULL, &tv);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <run_timers@plt>
movl   $0x1,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1040 <select@plt>
jmp    1154 <runner+0x24>

x86 assembly (clang, -O2):
<runner>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%r14
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <run_timers@plt>
movl   $0x1,(%rsp)
movq   $0x0,0x8(%rsp)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14,%r8
call   1030 <select@plt>
jmp    1140 <runner+0x20>

LLVM IR (-O0):
%struct.timeval = type { i32, i64, i32 }
%struct.tvec_base = type { i32 }
define i8* @runner(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.timeval
%4 = alloca %struct.tvec_base*
store i8* %0, i8** %2
%5 = bitcast %struct.timeval* %3 to i8*
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to %struct.tvec_base*
store %struct.tvec_base* %7, %struct.tvec_base** %4
br label %8
8: ; preds = %1, %8
%9 = load %struct.tvec_base*, %struct.tvec_base** %4
%10 = call i32 @run_timers(%struct.tvec_base* %9)
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 1, i32* %11
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 0, i64* %12
%13 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
br label %8
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64, i32 }
%struct.tvec_base = type { i32 }
define noalias i8* @runner(i8* %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = bitcast i8* %0 to %struct.tvec_base*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
br label %7
7: ; preds = %7, %1
%8 = call i32 @run_timers(%struct.tvec_base* %4)
store i32 1, i32* %5
store i64 0, i64* %6
%9 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
br label %7
}