#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 */
struct timespec {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ sendTimeReset();
int main(void) {
  struct timespec start, end;
  clock_gettime(CLOCK_REALTIME, &start);
  int timer;
  while (1) {
    clock_gettime(CLOCK_REALTIME, &end);
    timer = end.tv_sec - start.tv_sec;
    if (timer >= 15) {
      sendTimeReset();
      clock_gettime(CLOCK_REALTIME, &start);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jl     117f <main+0x5f>
mov    $0x0,%al
call   1040 <sendTimeReset@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
jmp    1141 <main+0x21>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2eb0(%rip),%rbx
mov    (%rbx),%edi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1030 <clock_gettime@plt>
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%edi
mov    %r15,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%eax
sub    0x8(%rsp),%eax
cmp    $0xf,%eax
jl     1150 <main+0x30>
xor    %eax,%eax
call   1040 <sendTimeReset@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
call   1030 <clock_gettime@plt>
jmp    1150 <main+0x30>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @CLOCK_REALTIME
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %2)
br label %7
7: ; preds = %0, %21
%8 = load i32, i32* @CLOCK_REALTIME
%9 = call i32 @clock_gettime(i32 %8, %struct.timespec* %3)
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%13 = load i32, i32* %12
%14 = sub nsw i32 %11, %13
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp sge i32 %15, 15
br i1 %16, label %17, label %21
17: ; preds = %7
%18 = call i32 (...) @sendTimeReset()
%19 = load i32, i32* @CLOCK_REALTIME
%20 = call i32 @clock_gettime(i32 %19, %struct.timespec* %2)
br label %21
21: ; preds = %17, %7
br label %7
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %1 to i8*
%4 = bitcast %struct.timespec* %2 to i8*
%5 = load i32, i32* @CLOCK_REALTIME
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %1)
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* @CLOCK_REALTIME
%11 = call i32 @clock_gettime(i32 %10, %struct.timespec* %2)
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = sub nsw i32 %12, %13
%15 = icmp sgt i32 %14, 14
br i1 %15, label %16, label %20
16: ; preds = %9
%17 = call i32 (...) @sendTimeReset()
%18 = load i32, i32* @CLOCK_REALTIME
%19 = call i32 @clock_gettime(i32 %18, %struct.timespec* %1)
br label %20
20: ; preds = %16, %9
br label %9
}