#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__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct itimerval {
  TYPE_2__ it_value;
  TYPE_1__ it_interval;
};

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
int /*<<< orphan*/ perror(char *);
scalar_t__ setitimer(int /*<<< orphan*/, struct itimerval *,
                     struct itimerval *);
void tick() {
  struct itimerval it, oit;
  it.it_interval.tv_sec = 0;
  it.it_interval.tv_usec = 0;
  it.it_value.tv_sec = 0;
  it.it_value.tv_usec = 16665;
  if (setitimer(ITIMER_REAL, &it, &oit) < 0)
    perror("tick");
}


x86 assembly (clang, -O0):
<tick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x4119,-0x20(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <setitimer@plt>
cmp    $0x0,%rax
jge    1173 <tick+0x53>
lea    0xe92(%rip),%rdi
call   1040 <perror@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tick>:
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movl   $0x4119,0x8(%rsp)
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
lea    0x28(%rsp),%rdx
call   1030 <setitimer@plt>
test   %rax,%rax
js     115f <tick+0x3f>
add    $0x48,%rsp
ret
lea    0xe9a(%rip),%rdi
add    $0x48,%rsp
jmp    1040 <perror@plt>

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@ITIMER_REAL = global i32 0
@.str = [5 x i8] c"tick\00"
define void @tick() {
%1 = alloca %struct.itimerval
%2 = alloca %struct.itimerval
%3 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 1
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 1
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 0
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 1
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 0
store i32 16665, i32* %10
%11 = load i32, i32* @ITIMER_REAL
%12 = call i64 @setitimer(i32 %11, %struct.itimerval* %1, %struct.itimerval* %2)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
ret void
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@ITIMER_REAL = global i32 0
@.str = [5 x i8] c"tick\00"
define void @tick() {
%1 = alloca %struct.itimerval
%2 = alloca %struct.itimerval
%3 = bitcast %struct.itimerval* %1 to i8*
%4 = bitcast %struct.itimerval* %2 to i8*
%5 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i64 0, i32 0, i32 1
%6 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i64 0, i32 0, i32 0
%7 = bitcast i64* %5 to i8*
store i32 16665, i32* %6
%8 = load i32, i32* @ITIMER_REAL
%9 = call i64 @setitimer(i32 %8, %struct.itimerval* %1, %struct.itimerval* %2)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %0
ret void
}