#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 time_t;

/* Variables and functions */
int time(int /*<<< orphan*/ *);
int tic_checktime(time_t epochtime) {
  int i;
  time_t curr_time = time(NULL);
  if ((curr_time >= -120) || (epochtime >= -120)) {
    i = (int)(((int)curr_time) + (120 * 2)) - (((int)epochtime) + (120 * 2));
  } else
    i = ((int)curr_time) - ((int)epochtime);
  if (i < 0)
    i = -i;
  if (i > 120) {
    return i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tic_checktime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffff88,-0x10(%rbp)
jge    113b <tic_checktime+0x2b>
cmpl   $0xffffff88,-0x8(%rbp)
jl     1156 <tic_checktime+0x46>
mov    -0x10(%rbp),%eax
add    $0xf0,%eax
mov    -0x8(%rbp),%ecx
add    $0xf0,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <tic_checktime+0x4f>
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1171 <tic_checktime+0x61>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x78,-0xc(%rbp)
jle    1186 <tic_checktime+0x76>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <tic_checktime+0x7d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tic_checktime>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
xor    %edi,%edi
call   1030 <time@plt>
sub    %ebx,%eax
mov    %eax,%ecx
neg    %ecx
cmovns %ecx,%eax
cmp    $0x79,%eax
cmovb  %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @tic_checktime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = call i32 @time(i32* null)
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp sge i32 %7, -120
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, -120
br i1 %11, label %12, label %18
12: ; preds = %9, %1
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 240
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 240
%17 = sub nsw i32 %14, %16
store i32 %17, i32* %4
br label %22
18: ; preds = %9
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %4
br label %22
22: ; preds = %18, %12
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %4
%27 = sub nsw i32 0, %26
store i32 %27, i32* %4
br label %28
28: ; preds = %25, %22
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 120
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* %4
store i32 %32, i32* %2
br label %34
33: ; preds = %28
store i32 0, i32* %2
br label %34
34: ; preds = %33, %31
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @tic_checktime(i32 %0) {
%2 = tail call i32 @time(i32* null)
%3 = sub i32 %2, %0
%4 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%5 = icmp ugt i32 %4, 120
%6 = select i1 %5, i32 %4, i32 0
ret i32 %6
}