#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 tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ daemon(int, int);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  struct timeval timo;
  daemon(1, 1);
  for (;;) {
    timo.tv_sec = 1;
    timo.tv_usec = 0;
    select(1, NULL, NULL, NULL, &timo);
    system("/sbin/ledcontrol -n usb -c green -s on");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <daemon@plt>
movl   $0x1,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1040 <select@plt>
lea    0xe80(%rip),%rdi
call   1030 <system@plt>
jmp    1152 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <daemon@plt>
lea    0x8(%rsp),%r14
lea    0xeae(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x1,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14,%r8
call   1040 <select@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@.str = [39 x i8] c"/sbin/ledcontrol -n usb -c green -s on\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @daemon(i32 1, i32 1)
br label %8
8: ; preds = %8, %2
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i32 1, i32* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i64 0, i64* %10
%11 = call i32 @select(i32 1, i32* null, i32* null, i32* null, %struct.timeval* %6)
%12 = call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %8
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@.str = [39 x i8] c"/sbin/ledcontrol -n usb -c green -s on\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = tail call i32 @daemon(i32 1, i32 1)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
br label %8
8: ; preds = %8, %2
store i32 1, i32* %6
store i64 0, i64* %7
%9 = call i32 @select(i32 1, i32* null, i32* null, i32* null, %struct.timeval* %3)
%10 = call i32 @system(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %8
}