#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 scalar_t__ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double difftime(scalar_t__, scalar_t__);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ *fopen(char const *, char *);
scalar_t__ passed_date(struct tm, char *);
int /*<<< orphan*/ print_level(long);
scalar_t__ read_line(char *, int /*<<< orphan*/ *);
scalar_t__ time(int /*<<< orphan*/ *);
void show_diff(const char *name) {
  char str[100] = {0};
  FILE *reader = NULL;
  if ((reader = fopen(name, "r")) == NULL) {
    error("file cannot open\n");
  }
  if ((read_line(str, reader)) <= 0) {
    error("can not read the data from file");
  }
  struct tm rec;
  time_t pass = passed_date(rec, str);
  time_t curr = time(NULL);
  if (curr < pass)
    error("compared wrong value\n");
  double diff = difftime(curr, pass);
  long diff_sec = diff;
  print_level(diff_sec);
}


x86 assembly (clang, -O0):
<show_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movq   $0x0,-0x78(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmp    $0x0,%rax
jne    11d1 <show_diff+0x51>
lea    0xe36(%rip),%rdi
call   1090 <error@plt>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rsi
call   1080 <read_line@plt>
cmp    $0x0,%rax
jg     11f4 <show_diff+0x74>
lea    0xe25(%rip),%rdi
call   1090 <error@plt>
lea    -0x70(%rbp),%rsi
mov    -0x80(%rbp),%edi
call   1060 <passed_date@plt>
mov    %rax,-0x88(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x88(%rbp),%rax
jge    1237 <show_diff+0xb7>
lea    0xe02(%rip),%rdi
call   1090 <error@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
call   1040 <difftime@plt>
movsd  %xmm0,-0x98(%rbp)
ff
cvttsd2si -0x98(%rbp),%rax
ff ff
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rdi
call   1030 <print_level@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_diff>:
push   %r14
push   %rbx
sub    $0x68,%rsp
xorpd  %xmm0,%xmm0
movapd %xmm0,0x50(%rsp)
movapd %xmm0,0x40(%rsp)
movapd %xmm0,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
movapd %xmm0,0x10(%rsp)
movapd %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe53(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c6 <show_diff+0x56>
lea    0xe41(%rip),%rdi
call   1080 <error@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1070 <read_line@plt>
test   %rax,%rax
jg     11e2 <show_diff+0x72>
lea    0xe37(%rip),%rdi
call   1080 <error@plt>
mov    %rsp,%rsi
call   1050 <passed_date@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1060 <time@plt>
mov    %rax,%rbx
cmp    %r14,%rax
jge    1208 <show_diff+0x98>
lea    0xe31(%rip),%rdi
call   1080 <error@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <difftime@plt>
cvttsd2si %xmm0,%rdi
call   1030 <print_level@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"file cannot open\0A\00"
@.str.2 = [32 x i8] c"can not read the data from file\00"
@.str.3 = [22 x i8] c"compared wrong value\0A\00"
define void @show_diff(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
%4 = alloca i32*
%5 = alloca %struct.tm
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
%9 = alloca i64
store i8* %0, i8** %2
%10 = bitcast [100 x i8]* %3 to i8*
store i32* null, i32** %4
%11 = load i8*, i8** %2
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %4
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %1
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = load i32*, i32** %4
%19 = call i64 @read_line(i8* %17, i32* %18)
%20 = icmp sle i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%25 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i64 @passed_date(i32 %26, i8* %24)
store i64 %27, i64* %6
%28 = call i64 @time(i32* null)
store i64 %28, i64* %7
%29 = load i64, i64* %7
%30 = load i64, i64* %6
%31 = icmp slt i64 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %23
%33 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %23
%35 = load i64, i64* %7
%36 = load i64, i64* %6
%37 = call double @difftime(i64 %35, i64 %36)
store double %37, double* %8
%38 = load double, double* %8
%39 = fptosi double %38 to i64
store i64 %39, i64* %9
%40 = load i64, i64* %9
%41 = call i32 @print_level(i64 %40)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"file cannot open\0A\00"
@.str.2 = [32 x i8] c"can not read the data from file\00"
@.str.3 = [22 x i8] c"compared wrong value\0A\00"
define void @show_diff(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = call i64 @read_line(i8* %3, i32* %4)
%10 = icmp slt i64 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = call i64 @passed_date(i32 undef, i8* %3)
%15 = call i64 @time(i32* null)
%16 = icmp slt i64 %15, %14
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = call double @difftime(i64 %15, i64 %14)
%21 = fptosi double %20 to i64
%22 = call i32 @print_level(i64 %21)
ret void
}