#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 */
typedef int /*<<< orphan*/ timer_t;
struct TYPE_4__ {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
struct itimerspec {
  TYPE_2__ it_interval;
  TYPE_1__ it_value;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ __NR_timer_create;
int /*<<< orphan*/ __NR_timer_delete;
int /*<<< orphan*/ __NR_timer_getoverrun;
int /*<<< orphan*/ __NR_timer_gettime;
int /*<<< orphan*/ __NR_timer_settime;
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int, ...);
int /*<<< orphan*/ timer_create(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *);
int /*<<< orphan*/ timer_delete(int /*<<< orphan*/);
int /*<<< orphan*/ timer_getoverrun(int /*<<< orphan*/);
int /*<<< orphan*/ timer_gettime(int /*<<< orphan*/, struct itimerspec *);
int /*<<< orphan*/ timer_settime(int /*<<< orphan*/, int, struct itimerspec *,
                                 struct itimerspec *);
int main() {
  timer_t tid = 0;
  struct itimerspec val, oval;
  syscall(__NR_timer_create, -1, NULL, &tid);
  syscall(__NR_timer_create, CLOCK_REALTIME, -1, &tid);
  syscall(__NR_timer_create, CLOCK_REALTIME, NULL, -1);
  timer_create(CLOCK_REALTIME, NULL, &tid);
  syscall(__NR_timer_gettime, -1, &val);
  syscall(__NR_timer_gettime, tid, -1);
  timer_gettime(tid, &val);
  val.it_value.tv_sec = 0;
  val.it_value.tv_nsec = 0;
  val.it_interval.tv_sec = 0;
  val.it_interval.tv_nsec = 0;
  syscall(__NR_timer_settime, -1, 0, &val, &oval);
  syscall(__NR_timer_settime, 0, -1, &val, &oval);
  syscall(__NR_timer_settime, tid, 0, -1, &oval);
  syscall(__NR_timer_settime, tid, 0, &val, -1);
  timer_settime(tid, -1, &val, &oval);
  syscall(__NR_timer_getoverrun, -1);
  timer_getoverrun(tid);
  syscall(__NR_timer_delete, -1);
  timer_delete(tid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x8(%rbp),%rcx
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    0x2e25(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
lea    -0x8(%rbp),%rcx
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
lea    -0x8(%rbp),%rdx
call   1040 <timer_create@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    $0xffffffff,%edx
mov    $0x0,%al
call   1070 <syscall@plt>
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1050 <timer_gettime@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
lea    -0x28(%rbp),%rcx
lea    -0x48(%rbp),%r8
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
lea    -0x28(%rbp),%rcx
lea    -0x48(%rbp),%r8
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
lea    -0x48(%rbp),%r8
mov    $0x0,%al
call   1070 <syscall@plt>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
lea    -0x28(%rbp),%rcx
mov    $0xffffffff,%r8d
mov    $0x0,%al
call   1070 <syscall@plt>
mov    -0x8(%rbp),%edi
mov    $0xffffffff,%esi
lea    -0x28(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1030 <timer_settime@plt>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1070 <syscall@plt>
mov    -0x8(%rbp),%edi
call   1080 <timer_getoverrun@plt>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1070 <syscall@plt>
mov    -0x8(%rbp),%edi
call   1060 <timer_delete@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movl   $0x0,0xc(%rsp)
mov    0x2e70(%rip),%r15
mov    (%r15),%edi
lea    0xc(%rsp),%r14
mov    $0xffffffff,%esi
xor    %edx,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%r15),%edi
mov    0x2e2d(%rip),%rbx
mov    (%rbx),%esi
mov    $0xffffffff,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%r15),%edi
mov    (%rbx),%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%rbx),%edi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <timer_create@plt>
mov    0x2dee(%rip),%rbx
mov    (%rbx),%edi
lea    0x10(%rsp),%r15
mov    $0xffffffff,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%rbx),%edi
mov    0xc(%rsp),%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
call   1070 <syscall@plt>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
call   1050 <timer_gettime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
mov    0x2db6(%rip),%rbx
mov    (%rbx),%edi
lea    0x30(%rsp),%r14
mov    $0xffffffff,%esi
xor    %edx,%edx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%rbx),%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%rbx),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   1070 <syscall@plt>
mov    (%rbx),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
mov    %r15,%rcx
mov    $0xffffffff,%r8d
xor    %eax,%eax
call   1070 <syscall@plt>
mov    0xc(%rsp),%edi
mov    $0xffffffff,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <timer_settime@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1070 <syscall@plt>
mov    0xc(%rsp),%edi
call   1080 <timer_getoverrun@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1070 <syscall@plt>
mov    0xc(%rsp),%edi
call   1060 <timer_delete@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@__NR_timer_create = global i32 0
@CLOCK_REALTIME = global i32 0
@__NR_timer_gettime = global i32 0
@__NR_timer_settime = global i32 0
@__NR_timer_getoverrun = global i32 0
@__NR_timer_delete = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.itimerspec
%4 = alloca %struct.itimerspec
store i32 0, i32* %1
store i32 0, i32* %2
%5 = load i32, i32* @__NR_timer_create
%6 = call i32 (i32, i32, ...) @syscall(i32 %5, i32 -1, i8* null, i32* %2)
%7 = load i32, i32* @__NR_timer_create
%8 = load i32, i32* @CLOCK_REALTIME
%9 = call i32 (i32, i32, ...) @syscall(i32 %7, i32 %8, i32 -1, i32* %2)
%10 = load i32, i32* @__NR_timer_create
%11 = load i32, i32* @CLOCK_REALTIME
%12 = call i32 (i32, i32, ...) @syscall(i32 %10, i32 %11, i8* null, i32 -1)
%13 = load i32, i32* @CLOCK_REALTIME
%14 = call i32 @timer_create(i32 %13, i32* null, i32* %2)
%15 = load i32, i32* @__NR_timer_gettime
%16 = call i32 (i32, i32, ...) @syscall(i32 %15, i32 -1, %struct.itimerspec* %3)
%17 = load i32, i32* @__NR_timer_gettime
%18 = load i32, i32* %2
%19 = call i32 (i32, i32, ...) @syscall(i32 %17, i32 %18, i32 -1)
%20 = load i32, i32* %2
%21 = call i32 @timer_gettime(i32 %20, %struct.itimerspec* %3)
%22 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i32 0, i32 1
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %22, i32 0, i32 1
store i64 0, i64* %23
%24 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i32 0, i32 1
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i32 0, i32 0
store i64 0, i64* %25
%26 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %26, i32 0, i32 1
store i64 0, i64* %27
%28 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i32 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
store i64 0, i64* %29
%30 = load i32, i32* @__NR_timer_settime
%31 = call i32 (i32, i32, ...) @syscall(i32 %30, i32 -1, i32 0, %struct.itimerspec* %3, %struct.itimerspec* %4)
%32 = load i32, i32* @__NR_timer_settime
%33 = call i32 (i32, i32, ...) @syscall(i32 %32, i32 0, i32 -1, %struct.itimerspec* %3, %struct.itimerspec* %4)
%34 = load i32, i32* @__NR_timer_settime
%35 = load i32, i32* %2
%36 = call i32 (i32, i32, ...) @syscall(i32 %34, i32 %35, i32 0, i32 -1, %struct.itimerspec* %4)
%37 = load i32, i32* @__NR_timer_settime
%38 = load i32, i32* %2
%39 = call i32 (i32, i32, ...) @syscall(i32 %37, i32 %38, i32 0, %struct.itimerspec* %3, i32 -1)
%40 = load i32, i32* %2
%41 = call i32 @timer_settime(i32 %40, i32 -1, %struct.itimerspec* %3, %struct.itimerspec* %4)
%42 = load i32, i32* @__NR_timer_getoverrun
%43 = call i32 (i32, i32, ...) @syscall(i32 %42, i32 -1)
%44 = load i32, i32* %2
%45 = call i32 @timer_getoverrun(i32 %44)
%46 = load i32, i32* @__NR_timer_delete
%47 = call i32 (i32, i32, ...) @syscall(i32 %46, i32 -1)
%48 = load i32, i32* %2
%49 = call i32 @timer_delete(i32 %48)
ret i32 0
}

LLVM IR (-O2):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@__NR_timer_create = global i32 0
@CLOCK_REALTIME = global i32 0
@__NR_timer_gettime = global i32 0
@__NR_timer_settime = global i32 0
@__NR_timer_getoverrun = global i32 0
@__NR_timer_delete = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.itimerspec
%3 = alloca %struct.itimerspec
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast %struct.itimerspec* %2 to i8*
%6 = bitcast %struct.itimerspec* %3 to i8*
%7 = load i32, i32* @__NR_timer_create
%8 = call i32 (i32, i32, ...) @syscall(i32 %7, i32 -1, i8* null, i32* %1)
%9 = load i32, i32* @__NR_timer_create
%10 = load i32, i32* @CLOCK_REALTIME
%11 = call i32 (i32, i32, ...) @syscall(i32 %9, i32 %10, i32 -1, i32* %1)
%12 = load i32, i32* @__NR_timer_create
%13 = load i32, i32* @CLOCK_REALTIME
%14 = call i32 (i32, i32, ...) @syscall(i32 %12, i32 %13, i8* null, i32 -1)
%15 = load i32, i32* @CLOCK_REALTIME
%16 = call i32 @timer_create(i32 %15, i32* null, i32* %1)
%17 = load i32, i32* @__NR_timer_gettime
%18 = call i32 (i32, i32, ...) @syscall(i32 %17, i32 -1, %struct.itimerspec* %2)
%19 = load i32, i32* @__NR_timer_gettime
%20 = load i32, i32* %1
%21 = call i32 (i32, i32, ...) @syscall(i32 %19, i32 %20, i32 -1)
%22 = load i32, i32* %1
%23 = call i32 @timer_gettime(i32 %22, %struct.itimerspec* %2)
%24 = bitcast %struct.itimerspec* %2 to i8*
%25 = load i32, i32* @__NR_timer_settime
%26 = call i32 (i32, i32, ...) @syscall(i32 %25, i32 -1, i32 0, %struct.itimerspec* %2, %struct.itimerspec* %3)
%27 = load i32, i32* @__NR_timer_settime
%28 = call i32 (i32, i32, ...) @syscall(i32 %27, i32 0, i32 -1, %struct.itimerspec* %2, %struct.itimerspec* %3)
%29 = load i32, i32* @__NR_timer_settime
%30 = load i32, i32* %1
%31 = call i32 (i32, i32, ...) @syscall(i32 %29, i32 %30, i32 0, i32 -1, %struct.itimerspec* %3)
%32 = load i32, i32* @__NR_timer_settime
%33 = load i32, i32* %1
%34 = call i32 (i32, i32, ...) @syscall(i32 %32, i32 %33, i32 0, %struct.itimerspec* %2, i32 -1)
%35 = load i32, i32* %1
%36 = call i32 @timer_settime(i32 %35, i32 -1, %struct.itimerspec* %2, %struct.itimerspec* %3)
%37 = load i32, i32* @__NR_timer_getoverrun
%38 = call i32 (i32, i32, ...) @syscall(i32 %37, i32 -1)
%39 = load i32, i32* %1
%40 = call i32 @timer_getoverrun(i32 %39)
%41 = load i32, i32* @__NR_timer_delete
%42 = call i32 (i32, i32, ...) @syscall(i32 %41, i32 -1)
%43 = load i32, i32* %1
%44 = call i32 @timer_delete(i32 %43)
ret i32 0
}