#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 */
typedef int /*<<< orphan*/ timer_t;
struct itimerspec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ SYS_timer_create;
int /*<<< orphan*/ SYS_timer_delete;
int /*<<< orphan*/ SYS_timer_getoverrun;
int /*<<< orphan*/ SYS_timer_gettime;
int /*<<< orphan*/ SYS_timer_settime;
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int /*<<< orphan*/, ...);
int main() {
  timer_t tid = 0;
  struct itimerspec val, oval;
  syscall(SYS_timer_create, CLOCK_REALTIME, NULL, &tid);
  syscall(SYS_timer_gettime, tid, &val);
  syscall(SYS_timer_settime, 0, tid, &val, &oval);
  syscall(SYS_timer_getoverrun, tid);
  syscall(SYS_timer_delete, tid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x8(%rbp),%rcx
mov    $0x0,%al
call   1030 <syscall@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <syscall@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
lea    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%r8
mov    $0x0,%al
call   1030 <syscall@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <syscall@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <syscall@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0xc(%rsp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rcx
xor    %edx,%edx
xor    %eax,%eax
call   1030 <syscall@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%esi
lea    0x18(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <syscall@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%r8
xor    %esi,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <syscall@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1030 <syscall@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1030 <syscall@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.itimerspec = type { i32 }
@SYS_timer_create = global i32 0
@CLOCK_REALTIME = global i32 0
@SYS_timer_gettime = global i32 0
@SYS_timer_settime = global i32 0
@SYS_timer_getoverrun = global i32 0
@SYS_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* @SYS_timer_create
%6 = load i32, i32* @CLOCK_REALTIME
%7 = call i32 (i32, i32, ...) @syscall(i32 %5, i32 %6, i8* null, i32* %2)
%8 = load i32, i32* @SYS_timer_gettime
%9 = load i32, i32* %2
%10 = call i32 (i32, i32, ...) @syscall(i32 %8, i32 %9, %struct.itimerspec* %3)
%11 = load i32, i32* @SYS_timer_settime
%12 = load i32, i32* %2
%13 = call i32 (i32, i32, ...) @syscall(i32 %11, i32 0, i32 %12, %struct.itimerspec* %3, %struct.itimerspec* %4)
%14 = load i32, i32* @SYS_timer_getoverrun
%15 = load i32, i32* %2
%16 = call i32 (i32, i32, ...) @syscall(i32 %14, i32 %15)
%17 = load i32, i32* @SYS_timer_delete
%18 = load i32, i32* %2
%19 = call i32 (i32, i32, ...) @syscall(i32 %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
%struct.itimerspec = type { i32 }
@SYS_timer_create = global i32 0
@CLOCK_REALTIME = global i32 0
@SYS_timer_gettime = global i32 0
@SYS_timer_settime = global i32 0
@SYS_timer_getoverrun = global i32 0
@SYS_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* @SYS_timer_create
%8 = load i32, i32* @CLOCK_REALTIME
%9 = call i32 (i32, i32, ...) @syscall(i32 %7, i32 %8, i8* null, i32* %1)
%10 = load i32, i32* @SYS_timer_gettime
%11 = load i32, i32* %1
%12 = call i32 (i32, i32, ...) @syscall(i32 %10, i32 %11, %struct.itimerspec* %2)
%13 = load i32, i32* @SYS_timer_settime
%14 = load i32, i32* %1
%15 = call i32 (i32, i32, ...) @syscall(i32 %13, i32 0, i32 %14, %struct.itimerspec* %2, %struct.itimerspec* %3)
%16 = load i32, i32* @SYS_timer_getoverrun
%17 = load i32, i32* %1
%18 = call i32 (i32, i32, ...) @syscall(i32 %16, i32 %17)
%19 = load i32, i32* @SYS_timer_delete
%20 = load i32, i32* %1
%21 = call i32 (i32, i32, ...) @syscall(i32 %19, i32 %20)
ret i32 0
}