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

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ TFD_TIMER_ABSTIME;
void *atoi(char *);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_elapsed_time();
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, int);
int /*<<< orphan*/ stderr;
int timerfd_create(int /*<<< orphan*/, int /*<<< orphan*/);
int timerfd_settime(int, int /*<<< orphan*/, struct itimerspec *,
                    int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  struct itimerspec new_value;
  int max_exp, fd;
  struct timespec now;
  uint64_t exp, tot_exp;
  ssize_t s;
  if ((argc != 2) && (argc != 4)) {
    fprintf(stderr, "%s init-secs [interval-secs max-exp]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (clock_gettime(CLOCK_REALTIME, &now) == -1)
    do {
      perror("clock_gettime");
      exit(EXIT_FAILURE);
    } while (0);
  new_value.it_value.tv_sec = now.tv_sec + atoi(argv[1]);
  new_value.it_value.tv_nsec = now.tv_nsec;
  if (argc == 2) {
    new_value.it_interval.tv_sec = 0;
    max_exp = 1;
  } else {
    new_value.it_interval.tv_sec = atoi(argv[2]);
    max_exp = atoi(argv[3]);
  }
  new_value.it_interval.tv_nsec = 0;
  fd = timerfd_create(CLOCK_REALTIME, 0);
  if (fd == -1)
    do {
      perror("timerfd_create");
      exit(EXIT_FAILURE);
    } while (0);
  if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &new_value, NULL) == -1)
    do {
      perror("timerfd_settime");
      exit(EXIT_FAILURE);
    } while (0);
  print_elapsed_time();
  printf("timer started\n");
  for (tot_exp = 0; tot_exp < max_exp;) {
    printf("%s\n", "11");
    s = read(fd, &exp, sizeof(uint64_t));
    printf("%s\n", "22");
    if (s != sizeof(uint64_t))
      do {
        perror("read");
        exit(EXIT_FAILURE);
      } while (0);
    tot_exp += exp;
    print_elapsed_time();
    printf("read: %llu; total=%llu\n", (unsigned long long)exp,
           (unsigned long long)tot_exp);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11f4 <main+0x54>
cmpl   $0x4,-0x8(%rbp)
je     11f4 <main+0x54>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe1f(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    122e <main+0x8e>
jmp    1214 <main+0x74>
lea    0xe0b(%rip),%rdi
call   1090 <perror@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    -0x60(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1272 <main+0xd2>
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    1293 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x30(%rbp)
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1080 <timerfd_create@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    12d7 <main+0x137>
jmp    12bd <main+0x11d>
lea    0xd70(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x38(%rbp),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   10a0 <timerfd_settime@plt>
cmp    $0xffffffff,%eax
jne    1318 <main+0x178>
jmp    12fe <main+0x15e>
lea    0xd3e(%rip),%rdi
call   1090 <perror@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    $0x0,%al
call   1040 <print_elapsed_time@plt>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    13d6 <main+0x236>
lea    0xd1b(%rip),%rdi
lea    0xd18(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%edi
lea    -0x4c(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %eax,-0x54(%rbp)
lea    0xcf2(%rip),%rdi
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x54(%rbp),%rax
cmp    $0x4,%rax
je     13ab <main+0x20b>
jmp    1391 <main+0x1f1>
lea    0xcd4(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x4c(%rbp),%eax
add    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    $0x0,%al
call   1040 <print_elapsed_time@plt>
movslq -0x4c(%rbp),%rsi
movslq -0x50(%rbp),%rdx
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1334 <main+0x194>
mov    0x2be3(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x2,%edi
je     11cd <main+0x1d>
cmp    $0x4,%ebp
jne    11f2 <main+0x42>
mov    0x2df4(%rip),%r14
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    120f <main+0x5f>
lea    0xe39(%rip),%rdi
jmp    133e <main+0x18e>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdfb(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1343 <main+0x193>
mov    0x10(%rsp),%r15
mov    0x8(%rbx),%rdi
call   10c0 <atoi@plt>
add    %r15,%rax
mov    %rax,0x30(%rsp)
mov    0x8(%rsp),%eax
mov    %eax,0x28(%rsp)
cmp    $0x2,%ebp
jne    1243 <main+0x93>
movq   $0x0,0x20(%rsp)
mov    $0x1,%r12d
jmp    125d <main+0xad>
mov    0x10(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %rax,0x20(%rsp)
mov    0x18(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %rax,%r12
movq   $0x0,0x18(%rsp)
mov    (%r14),%edi
xor    %esi,%esi
call   1090 <timerfd_create@plt>
cmp    $0xffffffff,%eax
jne    1281 <main+0xd1>
lea    0xdb8(%rip),%rdi
jmp    133e <main+0x18e>
mov    %eax,%ebp
mov    0x2d66(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%rdx
mov    %ebp,%edi
xor    %ecx,%ecx
call   10b0 <timerfd_settime@plt>
cmp    $0xffffffff,%eax
jne    12ab <main+0xfb>
lea    0xd9d(%rip),%rdi
jmp    133e <main+0x18e>
xor    %eax,%eax
call   1050 <print_elapsed_time@plt>
lea    0xdbd(%rip),%rdi
call   1030 <puts@plt>
test   %r12d,%r12d
jle    1329 <main+0x179>
lea    0xd94(%rip),%r13
xor    %r14d,%r14d
nopl   (%rax)
lea    0xd7c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1070 <read@plt>
mov    %eax,%r15d
lea    0xd5f(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x4,%r15d
jne    1337 <main+0x187>
movslq 0x4(%rsp),%rbx
movslq %r14d,%r14
add    %rbx,%r14
xor    %eax,%eax
call   1050 <print_elapsed_time@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %r12d,%r14d
jl     12d0 <main+0x120>
mov    0x2c90(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
lea    0xd1b(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i8* }
%struct.TYPE_3__ = type { i32, i64 }
%struct.timespec = type { i32, i64 }
@stderr = global i32 0
@.str = [38 x i8] c"%s init-secs [interval-secs max-exp]\0A\00"
@EXIT_FAILURE = global i32 0
@CLOCK_REALTIME = global i32 0
@.str.1 = [14 x i8] c"clock_gettime\00"
@.str.2 = [15 x i8] c"timerfd_create\00"
@TFD_TIMER_ABSTIME = global i32 0
@.str.3 = [16 x i8] c"timerfd_settime\00"
@.str.4 = [15 x i8] c"timer started\0A\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [3 x i8] c"11\00"
@.str.7 = [3 x i8] c"22\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [24 x i8] c"read: %llu; total=%llu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.itimerspec
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.timespec
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %26
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 4
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %15, %2
%27 = load i32, i32* @CLOCK_REALTIME
%28 = call i32 @clock_gettime(i32 %27, %struct.timespec* %9)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %36
30: ; preds = %26
br label %31
31: ; preds = %30
%32 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; No predecessors!
br label %36
36: ; preds = %35, %26
%37 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
%38 = load i64, i64* %37
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i8* @atoi(i8* %41)
%43 = getelementptr i8, i8* %42, i64 %38
%44 = ptrtoint i8* %43 to i64
%45 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %6, i32 0, i32 1
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %45, i32 0, i32 1
store i64 %44, i64* %46
%47 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %6, i32 0, i32 1
%50 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %49, i32 0, i32 0
store i32 %48, i32* %50
%51 = load i32, i32* %4
%52 = icmp eq i32 %51, 2
br i1 %52, label %53, label %56
53: ; preds = %36
%54 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %6, i32 0, i32 0
%55 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %54, i32 0, i32 1
store i8* null, i8** %55
store i32 1, i32* %7
br label %68
56: ; preds = %36
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = call i8* @atoi(i8* %59)
%61 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %6, i32 0, i32 0
%62 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %61, i32 0, i32 1
store i8* %60, i8** %62
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 3
%65 = load i8*, i8** %64
%66 = call i8* @atoi(i8* %65)
%67 = ptrtoint i8* %66 to i32
store i32 %67, i32* %7
br label %68
68: ; preds = %56, %53
%69 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %6, i32 0, i32 0
%70 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %69, i32 0, i32 0
store i64 0, i64* %70
%71 = load i32, i32* @CLOCK_REALTIME
%72 = call i32 @timerfd_create(i32 %71, i32 0)
store i32 %72, i32* %8
%73 = load i32, i32* %8
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %81
75: ; preds = %68
br label %76
76: ; preds = %75
%77 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%78 = load i32, i32* @EXIT_FAILURE
%79 = call i32 @exit(i32 %78)
unreachable
80: ; No predecessors!
br label %81
81: ; preds = %80, %68
%82 = load i32, i32* %8
%83 = load i32, i32* @TFD_TIMER_ABSTIME
%84 = call i32 @timerfd_settime(i32 %82, i32 %83, %struct.itimerspec* %6, i32* null)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %92
86: ; preds = %81
br label %87
87: ; preds = %86
%88 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%89 = load i32, i32* @EXIT_FAILURE
%90 = call i32 @exit(i32 %89)
unreachable
91: ; No predecessors!
br label %92
92: ; preds = %91, %81
%93 = call i32 (...) @print_elapsed_time()
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %11
br label %95
95: ; preds = %113, %92
%96 = load i32, i32* %11
%97 = load i32, i32* %7
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %123
99: ; preds = %95
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%101 = load i32, i32* %8
%102 = call i32 @read(i32 %101, i32* %10, i32 4)
store i32 %102, i32* %12
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%104 = load i32, i32* %12
%105 = sext i32 %104 to i64
%106 = icmp ne i64 %105, 4
br i1 %106, label %107, label %113
107: ; preds = %99
br label %108
108: ; preds = %107
%109 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%110 = load i32, i32* @EXIT_FAILURE
%111 = call i32 @exit(i32 %110)
unreachable
112: ; No predecessors!
br label %113
113: ; preds = %112, %99
%114 = load i32, i32* %10
%115 = load i32, i32* %11
%116 = add nsw i32 %115, %114
store i32 %116, i32* %11
%117 = call i32 (...) @print_elapsed_time()
%118 = load i32, i32* %10
%119 = sext i32 %118 to i64
%120 = load i32, i32* %11
%121 = sext i32 %120 to i64
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i64 %119, i64 %121)
br label %95
123: ; preds = %95
%124 = load i32, i32* @EXIT_SUCCESS
%125 = call i32 @exit(i32 %124)
unreachable
}

LLVM IR (-O2):
%struct.itimerspec = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i8* }
%struct.TYPE_3__ = type { i32, i64 }
%struct.timespec = type { i32, i64 }
@stderr = global i32 0
@.str = [38 x i8] c"%s init-secs [interval-secs max-exp]\0A\00"
@EXIT_FAILURE = global i32 0
@CLOCK_REALTIME = global i32 0
@.str.1 = [14 x i8] c"clock_gettime\00"
@.str.2 = [15 x i8] c"timerfd_create\00"
@TFD_TIMER_ABSTIME = global i32 0
@.str.3 = [16 x i8] c"timerfd_settime\00"
@.str.6 = [3 x i8] c"11\00"
@.str.7 = [3 x i8] c"22\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [24 x i8] c"read: %llu; total=%llu\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"timer started\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.itimerspec
%4 = alloca %struct.timespec
%5 = alloca i32
%6 = bitcast %struct.itimerspec* %3 to i8*
%7 = bitcast %struct.timespec* %4 to i8*
%8 = bitcast i32* %5 to i8*
switch i32 %0, label %9 [
i32 4, label %15
i32 2, label %15
]
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %2, %2
%16 = load i32, i32* @CLOCK_REALTIME
%17 = call i32 @clock_gettime(i32 %16, %struct.timespec* %4)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %15
%24 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
%25 = load i64, i64* %24
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = call i8* @atoi(i8* %27)
%29 = getelementptr i8, i8* %28, i64 %25
%30 = ptrtoint i8* %29 to i64
%31 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 1, i32 1
store i64 %30, i64* %31
%32 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 1, i32 0
store i32 %33, i32* %34
%35 = icmp eq i32 %0, 2
br i1 %35, label %36, label %38
36: ; preds = %23
%37 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 0, i32 1
store i8* null, i8** %37
br label %48
38: ; preds = %23
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
%41 = call i8* @atoi(i8* %40)
%42 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 0, i32 1
store i8* %41, i8** %42
%43 = getelementptr inbounds i8*, i8** %1, i64 3
%44 = load i8*, i8** %43
%45 = call i8* @atoi(i8* %44)
%46 = ptrtoint i8* %45 to i64
%47 = trunc i64 %46 to i32
br label %48
48: ; preds = %38, %36
%49 = phi i32 [ 1, %36 ], [ %47, %38 ]
%50 = getelementptr inbounds %struct.itimerspec, %struct.itimerspec* %3, i64 0, i32 0, i32 0
store i64 0, i64* %50
%51 = load i32, i32* @CLOCK_REALTIME
%52 = call i32 @timerfd_create(i32 %51, i32 0)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %58
54: ; preds = %48
%55 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%56 = load i32, i32* @EXIT_FAILURE
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %48
%59 = load i32, i32* @TFD_TIMER_ABSTIME
%60 = call i32 @timerfd_settime(i32 %52, i32 %59, %struct.itimerspec* %3, i32* null)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %58
%63 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %58
%67 = call i32 (...) @print_elapsed_time()
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%69 = icmp sgt i32 %49, 0
br i1 %69, label %70, label %88
70: ; preds = %66, %80
%71 = phi i32 [ %82, %80 ], [ 0, %66 ]
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%73 = call i32 @read(i32 %52, i32* %5, i32 4)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%75 = icmp eq i32 %73, 4
br i1 %75, label %80, label %76
76: ; preds = %70
%77 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%78 = load i32, i32* @EXIT_FAILURE
%79 = call i32 @exit(i32 %78)
unreachable
80: ; preds = %70
%81 = load i32, i32* %5
%82 = add nsw i32 %81, %71
%83 = call i32 (...) @print_elapsed_time()
%84 = sext i32 %81 to i64
%85 = sext i32 %82 to i64
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i64 %84, i64 %85)
%87 = icmp slt i32 %82, %49
br i1 %87, label %70, label %88
88: ; preds = %80, %66
%89 = load i32, i32* @EXIT_SUCCESS
%90 = call i32 @exit(i32 %89)
unreachable
}