#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  int tv_usec;
  scalar_t__ tv_sec;
};
struct itimerval {
  TYPE_2__ it_interval;
  TYPE_1__ it_value;
};

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
int /*<<< orphan*/ SIGALRM;
int setitimer(int /*<<< orphan*/, struct itimerval *, struct itimerval *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
int setTimer(int microsec, void((*sigroutine)(int))) {
  struct itimerval value, ovalue;
  signal(SIGALRM, sigroutine);
  value.it_value.tv_sec = 0;
  value.it_value.tv_usec = microsec;
  value.it_interval.tv_sec = 0;
  value.it_interval.tv_usec = microsec;
  return setitimer(ITIMER_REAL, &value, &ovalue);
}


x86 assembly (clang, -O0):
<setTimer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <signal@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1040 <setitimer@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setTimer>:
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
call   1030 <signal@plt>
movq   $0x0,0x18(%rsp)
mov    %ebx,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    %ebx,(%rsp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
lea    0x20(%rsp),%rdx
call   1040 <setitimer@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i64 }
@SIGALRM = global i32 0
@ITIMER_REAL = global i32 0
define i32 @setTimer(i32 %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca %struct.itimerval
%6 = alloca %struct.itimerval
store i32 %0, i32* %3
store void (i32)* %1, void (i32)** %4
%7 = load i32, i32* @SIGALRM
%8 = load void (i32)*, void (i32)** %4
%9 = call i32 @signal(i32 %7, void (i32)* %8)
%10 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %5, i32 0, i32 1
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 1
store i64 0, i64* %11
%12 = load i32, i32* %3
%13 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %5, i32 0, i32 1
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i32 0, i32 0
store i32 %12, i32* %14
%15 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %5, i32 0, i32 0
%16 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %15, i32 0, i32 1
store i64 0, i64* %16
%17 = load i32, i32* %3
%18 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %5, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 0
store i32 %17, i32* %19
%20 = load i32, i32* @ITIMER_REAL
%21 = call i32 @setitimer(i32 %20, %struct.itimerval* %5, %struct.itimerval* %6)
ret i32 %21
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i64 }
@SIGALRM = global i32 0
@ITIMER_REAL = global i32 0
define i32 @setTimer(i32 %0, void (i32)* %1) {
%3 = alloca %struct.itimerval
%4 = alloca %struct.itimerval
%5 = bitcast %struct.itimerval* %3 to i8*
%6 = bitcast %struct.itimerval* %4 to i8*
%7 = load i32, i32* @SIGALRM
%8 = tail call i32 @signal(i32 %7, void (i32)* %1)
%9 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i64 0, i32 1, i32 1
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i64 0, i32 1, i32 0
store i32 %0, i32* %10
%11 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i64 0, i32 0, i32 1
store i64 0, i64* %11
%12 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %3, i64 0, i32 0, i32 0
store i32 %0, i32* %12
%13 = load i32, i32* @ITIMER_REAL
%14 = call i32 @setitimer(i32 %13, %struct.itimerval* %3, %struct.itimerval* %4)
ret i32 %14
}