#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *);
int check_time(void) {
  FILE *ps;
  char buf[8] = {0};
  if ((ps = popen("date +%Y", "r")) == NULL)
    return 1;
  fgets(buf, sizeof(buf), ps);
  if (atoi(buf) < 2015) {
    printf("Your date not tune!\n");
    return 1;
  }
  pclose(ps);
  return 0;
}


x86 assembly (clang, -O0):
<check_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    0xe81(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1070 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11a5 <check_time+0x45>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <check_time+0x93>
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x8,%esi
call   1060 <fgets@plt>
lea    -0x18(%rbp),%rdi
call   1080 <atoi@plt>
cmp    $0x7df,%eax
jge    11e3 <check_time+0x83>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <check_time+0x93>
mov    -0x10(%rbp),%rdi
call   1040 <pclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_time>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xe98(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1060 <popen@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     11bd <check_time+0x6d>
mov    %rax,%rbx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x8,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1070 <atoi@plt>
cmp    $0x7de,%eax
jg     11b3 <check_time+0x63>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
jmp    11bd <check_time+0x6d>
mov    %rbx,%rdi
call   1040 <pclose@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"date +%Y\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Your date not tune!\0A\00"
define i32 @check_time() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [8 x i8]
%4 = bitcast [8 x i8]* %3 to i8*
%5 = call i32* @popen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %1
br label %20
8: ; preds = %0
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%10 = load i32*, i32** %2
%11 = call i32 @fgets(i8* %9, i32 8, i32* %10)
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%13 = call i32 @atoi(i8* %12)
%14 = icmp slt i32 %13, 2015
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %20
17: ; preds = %8
%18 = load i32*, i32** %2
%19 = call i32 @pclose(i32* %18)
store i32 0, i32* %1
br label %20
20: ; preds = %17, %15, %7
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [9 x i8] c"date +%Y\00"
@.str.1 = [2 x i8] c"r\00"
@str = [20 x i8] c"Your date not tune!\00"
define i32 @check_time() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%3 = tail call i32* @popen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %13, label %5
5: ; preds = %0
%6 = call i32 @fgets(i8* %2, i32 8, i32* %3)
%7 = call i32 @atoi(i8* %2)
%8 = icmp slt i32 %7, 2015
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %13
11: ; preds = %5
%12 = call i32 @pclose(i32* %3)
br label %13
13: ; preds = %0, %11, %9
%14 = phi i32 [ 1, %9 ], [ 0, %11 ], [ 1, %0 ]
ret i32 %14
}