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

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGEV_SIGNAL;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sleep(int);
scalar_t__ timer_create(int /*<<< orphan*/, struct sigevent *,
                        int /*<<< orphan*/ *);
scalar_t__ timer_gettime(int /*<<< orphan*/, struct itimerspec *);
scalar_t__ timer_settime(int /*<<< orphan*/, int /*<<< orphan*/,
                         struct itimerspec *, int /*<<< orphan*/ *);
int main(void) {
  struct sigevent ev;
  timer_t tid;
  struct itimerspec itsset, itsget;
  int delta;
  int expectedleft;
  ev.sigev_notify = SIGEV_SIGNAL;
  ev.sigev_signo = SIGCONT;
  itsset.it_interval.tv_sec = 8;
  itsset.it_interval.tv_nsec = 2 * 1000000;
  itsset.it_value.tv_sec = 2;
  itsset.it_value.tv_nsec = 0;
  if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
    perror("timer_create() did not return success\n");
    return 2;
  }
  if (timer_settime(tid, 0, &itsset, NULL) != 0) {
    perror("timer_settime() did not return success\n");
    return 2;
  }
  if (sleep(3) != 0) {
    perror("sleep() did not return 0\n");
    return 2;
  }
  if (timer_gettime(tid, &itsget) != 0) {
    perror("timer_gettime() did not return success\n");
    return 2;
  }
  if ((itsget.it_interval.tv_sec != itsset.it_interval.tv_sec) ||
      (itsget.it_interval.tv_nsec / 1000000 !=
       itsset.it_interval.tv_nsec / 1000000)) {
    printf("FAIL:  it_interval not correctly set\n");
    printf("%d != (expected) %d or %d != (expected) %d\n",
           (int)itsget.it_interval.tv_sec, (int)itsset.it_interval.tv_sec,
           (int)itsget.it_interval.tv_nsec, (int)itsset.it_interval.tv_nsec);
    return 2;
  }
  expectedleft = itsset.it_interval.tv_sec - (3 - itsset.it_value.tv_sec);
  delta = expectedleft - itsget.it_value.tv_sec;
  if (delta < 0) {
    printf("FAIL:  timer_gettime() value > time expected left\n");
    printf("%d > %d\n", (int)itsget.it_value.tv_sec, expectedleft);
    return 1;
  }
  if (delta <= 1) {
    printf("Test PASSED\n");
    return 0;
  } else {
    printf("FAIL:  timer_gettime() value !~= time expected left\n");
    printf("%d !~= %d\n", (int)itsget.it_value.tv_sec,
           (int)itsset.it_value.tv_sec - 3);
    return 1;
  }
  printf("This code should not be executed\n");
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x8,-0x20(%rbp)
movl   $0x1e8480,-0x1c(%rbp)
movl   $0x2,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <timer_create@plt>
cmp    $0x0,%rax
je     11dc <main+0x7c>
lea    0xe35(%rip),%rdi
call   1070 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1372 <main+0x212>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
lea    -0x30(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <timer_settime@plt>
cmp    $0x0,%rax
je     1210 <main+0xb0>
lea    0xe28(%rip),%rdi
call   1070 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1372 <main+0x212>
mov    $0x3,%edi
call   1080 <sleep@plt>
cmp    $0x0,%rax
je     123c <main+0xdc>
lea    0xe24(%rip),%rdi
call   1070 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1372 <main+0x212>
mov    -0x14(%rbp),%edi
lea    -0x48(%rbp),%rsi
call   1060 <timer_gettime@plt>
cmp    $0x0,%rax
je     126a <main+0x10a>
lea    0xe10(%rip),%rdi
call   1070 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1372 <main+0x212>
mov    -0x38(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    129c <main+0x13c>
mov    -0x34(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x54(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
je     12d1 <main+0x171>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1372 <main+0x212>
mov    -0x20(%rbp),%eax
mov    $0x3,%ecx
sub    -0x30(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
sub    -0x48(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    1322 <main+0x1c2>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%esi
mov    -0x50(%rbp),%edx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1372 <main+0x212>
cmpl   $0x1,-0x4c(%rbp)
jg     1346 <main+0x1e6>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x212>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%esi
mov    -0x30(%rbp),%edx
sub    $0x3,%edx
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movabs $0x1e848000000008,%rax
mov    %rax,0x18(%rsp)
movl   $0x2,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0x20(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1050 <timer_create@plt>
test   %rax,%rax
jne    12f3 <main+0x183>
mov    0x4(%rsp),%edi
lea    0x8(%rsp),%rdx
xor    %esi,%esi
xor    %ecx,%ecx
call   1030 <timer_settime@plt>
test   %rax,%rax
jne    12fc <main+0x18c>
mov    $0x3,%edi
call   1090 <sleep@plt>
test   %rax,%rax
jne    1305 <main+0x195>
mov    0x4(%rsp),%edi
lea    0x28(%rsp),%rsi
call   1070 <timer_gettime@plt>
test   %rax,%rax
jne    130e <main+0x19e>
mov    0x38(%rsp),%eax
cmp    0x18(%rsp),%eax
jne    127f <main+0x10f>
movslq 0x3c(%rsp),%rcx
imul   $0x431bde83,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
movslq 0x1c(%rsp),%rdx
imul   $0x431bde83,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x32,%rdx
add    %esi,%edx
cmp    %edx,%ecx
jne    127f <main+0x10f>
mov    0x8(%rsp),%ecx
lea    (%rax,%rcx,1),%ebx
add    $0xfffffffd,%ebx
mov    %ebx,%eax
sub    0x28(%rsp),%eax
js     12ac <main+0x13c>
cmp    $0x1,%eax
ja     12c7 <main+0x157>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    131f <main+0x1af>
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
mov    0x38(%rsp),%esi
mov    0x3c(%rsp),%ecx
mov    0x18(%rsp),%edx
mov    0x1c(%rsp),%r8d
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    131a <main+0x1aa>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
mov    0x28(%rsp),%esi
lea    0xdfa(%rip),%rdi
mov    %ebx,%edx
jmp    12e5 <main+0x175>
lea    0xe03(%rip),%rdi
call   1040 <puts@plt>
mov    0x28(%rsp),%esi
mov    0x8(%rsp),%edx
add    $0xfffffffd,%edx
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    131f <main+0x1af>
lea    0xd06(%rip),%rdi
jmp    1315 <main+0x1a5>
lea    0xd24(%rip),%rdi
jmp    1315 <main+0x1a5>
lea    0xd43(%rip),%rdi
jmp    1315 <main+0x1a5>
lea    0xd54(%rip),%rdi
call   1080 <perror@plt>
mov    $0x2,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigevent = type { i32, i32 }
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i32 }
@SIGEV_SIGNAL = global i32 0
@SIGCONT = global i32 0
@CLOCK_REALTIME = global i32 0
@.str = [39 x i8] c"timer_create() did not return success\0A\00"
@.str.1 = [40 x i8] c"timer_settime() did not return success\0A\00"
@.str.2 = [26 x i8] c"sleep() did not return 0\0A\00"
@.str.3 = [40 x i8] c"timer_gettime() did not return success\0A\00"
@.str.4 = [38 x i8] c"FAIL: it_interval not correctly set\0A\00"
@.str.5 = [44 x i8] c"%d != (expected) %d or %d != (expected) %d\0A\00"
@.str.6 = [51 x i8] c"FAIL: timer_gettime() value > time expected left\0A\00"
@.str.7 = [9 x i8] c"%d > %d\0A\00"
@.str.8 = [13 x i8] c"Test PASSED\0A\00"
@.str.9 = [53 x i8] c"FAIL: timer_gettime() value !~= time expected left\0A\00"
@.str.10 = [11 x i8] c"%d !~= %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sigevent
%3 = alloca i32
%4 = alloca %struct.itimerspec
%5 = alloca %struct.itimerspec
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32, i32* @SIGEV_SIGNAL
%9 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %2, i32 0, i32 1
store i32 %8, i32* %9
%10 = load i32, i32* @SIGCONT
%11 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %2, i32 0, i32 0
store i32 %10, i32* %11
%12 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %12, i32 0, i32 0
store i32 8, i32* %13
%14 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 1
store i32 2000000, i32* %15
%16 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %16, i32 0, i32 0
store i32 2, i32* %17
%18 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 1
store i64 0, i64* %19
%20 = load i32, i32* @CLOCK_REALTIME
%21 = call i64 @timer_create(i32 %20, %struct.sigevent* %2, i32* %3)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %0
%24 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %113
25: ; preds = %0
%26 = load i32, i32* %3
%27 = call i64 @timer_settime(i32 %26, i32 0, %struct.itimerspec* %4, i32* null)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %1
br label %113
31: ; preds = %25
%32 = call i64 @sleep(i32 3)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %1
br label %113
36: ; preds = %31
%37 = load i32, i32* %3
%38 = call i64 @timer_gettime(i32 %37, %struct.itimerspec* %5)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
store i32 2, i32* %1
br label %113
42: ; preds = %36
%43 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 1
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%47 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %46, i32 0, i32 0
%48 = load i32, i32* %47
%49 = icmp ne i32 %45, %48
br i1 %49, label %60, label %50
50: ; preds = %42
%51 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 1
%52 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = sdiv i32 %53, 1000000
%55 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%56 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %55, i32 0, i32 1
%57 = load i32, i32* %56
%58 = sdiv i32 %57, 1000000
%59 = icmp ne i32 %54, %58
br i1 %59, label %60, label %75
60: ; preds = %50, %42
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%62 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 1
%63 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %62, i32 0, i32 0
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%66 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %65, i32 0, i32 0
%67 = load i32, i32* %66
%68 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 1
%69 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %68, i32 0, i32 1
%70 = load i32, i32* %69
%71 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%72 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %71, i32 0, i32 1
%73 = load i32, i32* %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %64, i32 %67, i32 %70, i32 %73)
store i32 2, i32* %1
br label %113
75: ; preds = %50
%76 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 1
%77 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %76, i32 0, i32 0
%78 = load i32, i32* %77
%79 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%80 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %79, i32 0, i32 0
%81 = load i32, i32* %80
%82 = sub nsw i32 3, %81
%83 = sub nsw i32 %78, %82
store i32 %83, i32* %7
%84 = load i32, i32* %7
%85 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 0
%86 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = sub nsw i32 %84, %87
store i32 %88, i32* %6
%89 = load i32, i32* %6
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %98
91: ; preds = %75
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%93 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 0
%94 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %93, i32 0, i32 0
%95 = load i32, i32* %94
%96 = load i32, i32* %7
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %95, i32 %96)
store i32 1, i32* %1
br label %113
98: ; preds = %75
%99 = load i32, i32* %6
%100 = icmp sle i32 %99, 1
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %113
103: ; preds = %98
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
%105 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %5, i32 0, i32 0
%106 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %105, i32 0, i32 0
%107 = load i32, i32* %106
%108 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i32 0, i32 0
%109 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %108, i32 0, i32 0
%110 = load i32, i32* %109
%111 = sub nsw i32 %110, 3
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %107, i32 %111)
store i32 1, i32* %1
br label %113
113: ; preds = %103, %101, %91, %60, %40, %34, %29, %23
%114 = load i32, i32* %1
ret i32 %114
}

LLVM IR (-O2):
%struct.sigevent = type { i32, i32 }
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i32 }
@SIGEV_SIGNAL = global i32 0
@SIGCONT = global i32 0
@CLOCK_REALTIME = global i32 0
@.str = [39 x i8] c"timer_create() did not return success\0A\00"
@.str.1 = [40 x i8] c"timer_settime() did not return success\0A\00"
@.str.2 = [26 x i8] c"sleep() did not return 0\0A\00"
@.str.3 = [40 x i8] c"timer_gettime() did not return success\0A\00"
@.str.5 = [44 x i8] c"%d != (expected) %d or %d != (expected) %d\0A\00"
@.str.7 = [9 x i8] c"%d > %d\0A\00"
@.str.10 = [11 x i8] c"%d !~= %d\0A\00"
@str = [52 x i8] c"FAIL: timer_gettime() value !~= time expected left\00"
@str.11 = [12 x i8] c"Test PASSED\00"
@str.12 = [50 x i8] c"FAIL: timer_gettime() value > time expected left\00"
@str.13 = [37 x i8] c"FAIL: it_interval not correctly set\00"
define i32 @main() {
%1 = alloca %struct.sigevent
%2 = alloca i32
%3 = alloca %struct.itimerspec
%4 = alloca %struct.itimerspec
%5 = bitcast %struct.sigevent* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast %struct.itimerspec* %3 to i8*
%8 = bitcast %struct.itimerspec* %4 to i8*
%9 = load i32, i32* @SIGEV_SIGNAL
%10 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %1, i64 0, i32 1
store i32 %9, i32* %10
%11 = load i32, i32* @SIGCONT
%12 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %1, i64 0, i32 0
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 1, i32 0
store i32 8, i32* %13
%14 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 1, i32 1
store i32 2000000, i32* %14
%15 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 0, i32 0
store i32 2, i32* %15
%16 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 0, i32 1
store i64 0, i64* %16
%17 = load i32, i32* @CLOCK_REALTIME
%18 = call i64 @timer_create(i32 %17, %struct.sigevent* %1, i32* %2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %0
%21 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %81
22: ; preds = %0
%23 = load i32, i32* %2
%24 = call i64 @timer_settime(i32 %23, i32 0, %struct.itimerspec* %3, i32* null)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %81
28: ; preds = %22
%29 = call i64 @sleep(i32 3)
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %81
33: ; preds = %28
%34 = load i32, i32* %2
%35 = call i64 @timer_gettime(i32 %34, %struct.itimerspec* %4)
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %81
39: ; preds = %33
%40 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i64 0, i32 1, i32 0
%41 = load i32, i32* %40
%42 = load i32, i32* %13
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %51
44: ; preds = %39
%45 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i64 0, i32 1, i32 1
%46 = load i32, i32* %45
%47 = sdiv i32 %46, 1000000
%48 = load i32, i32* %14
%49 = sdiv i32 %48, 1000000
%50 = icmp eq i32 %47, %49
br i1 %50, label %59, label %51
51: ; preds = %44, %39
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.13, i64 0, i64 0))
%53 = load i32, i32* %40
%54 = load i32, i32* %13
%55 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i64 0, i32 1, i32 1
%56 = load i32, i32* %55
%57 = load i32, i32* %14
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %53, i32 %54, i32 %56, i32 %57)
br label %81
59: ; preds = %44
%60 = load i32, i32* %15
%61 = add i32 %41, -3
%62 = add i32 %61, %60
%63 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %4, i64 0, i32 0, i32 0
%64 = load i32, i32* %63
%65 = sub nsw i32 %62, %64
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %71
67: ; preds = %59
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.12, i64 0, i64 0))
%69 = load i32, i32* %63
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %69, i32 %62)
br label %81
71: ; preds = %59
%72 = icmp ult i32 %65, 2
br i1 %72, label %73, label %75
73: ; preds = %71
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
br label %81
75: ; preds = %71
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%77 = load i32, i32* %63
%78 = load i32, i32* %15
%79 = add nsw i32 %78, -3
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %77, i32 %79)
br label %81
81: ; preds = %75, %73, %67, %51, %37, %31, %26, %20
%82 = phi i32 [ 2, %20 ], [ 2, %26 ], [ 2, %31 ], [ 2, %37 ], [ 2, %51 ], [ 1, %67 ], [ 0, %73 ], [ 1, %75 ]
ret i32 %82
}