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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, long, char *);
scalar_t__ time(int /*<<< orphan*/ *);
char *ytht_Difftime_s(time_t compared_time, char *buf, size_t buf_len) {
  time_t now = time(NULL);
  long diff = now - compared_time;
  if (diff < 0)
    diff = -diff;
  if (diff < 60) {
    snprintf(buf, buf_len, "%ld\xC3\xEB\xD6\xD3%s", diff,
             (now > compared_time) ? "\xC7\xB0" : "\xBA\xF3");
  } else if (diff < 3600) {
    snprintf(buf, buf_len, "%ld\xB7\xD6\xD6\xD3%s", diff / 60,
             (now > compared_time) ? "\xC7\xB0" : "\xBA\xF3");
  } else if (diff < 86400) {
    snprintf(buf, buf_len, "%ld\xD0\xA1\xCA\xB1%s", diff / 3600,
             (now > compared_time) ? "\xC7\xB0" : "\xBA\xF3");
  } else {
    snprintf(buf, buf_len, "%ld\xCC\xEC%s", diff / 86400,
             (now > compared_time) ? "\xC7\xB0" : "\xBA\xF3");
  }
  return buf;
}


x86 assembly (clang, -O0):
<ytht_Difftime_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    1162 <ytht_Difftime_s+0x42>
xor    %eax,%eax
sub    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x3c,-0x28(%rbp)
jge    11a7 <ytht_Difftime_s+0x87>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%r9
lea    0xe85(%rip),%r8
lea    0xe7b(%rip),%rax
cmp    %r9,%rdx
cmovg  %rax,%r8
lea    0xe63(%rip),%rdx
call   1030 <snprintf@plt>
jmp    129d <ytht_Difftime_s+0x17d>
cmpq   $0xe10,-0x28(%rbp)
jge    11fc <ytht_Difftime_s+0xdc>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%r9
lea    0xe30(%rip),%r8
lea    0xe26(%rip),%rax
cmp    %r9,%rdx
cmovg  %rax,%r8
lea    0xe1e(%rip),%rdx
call   1030 <snprintf@plt>
jmp    1298 <ytht_Difftime_s+0x178>
cmpq   $0x15180,-0x28(%rbp)
jge    1251 <ytht_Difftime_s+0x131>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%r9
lea    0xddb(%rip),%r8
lea    0xdd1(%rip),%rax
cmp    %r9,%rdx
cmovg  %rax,%r8
lea    0xdd3(%rip),%rdx
call   1030 <snprintf@plt>
jmp    1293 <ytht_Difftime_s+0x173>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%r9
lea    0xd94(%rip),%r8
lea    0xd8a(%rip),%rax
cmp    %r9,%rdx
cmovg  %rax,%r8
lea    0xd96(%rip),%rdx
call   1030 <snprintf@plt>
jmp    1298 <ytht_Difftime_s+0x178>
jmp    129d <ytht_Difftime_s+0x17d>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ytht_Difftime_s>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%rsi
mov    %rax,%rcx
sub    %rbx,%rcx
mov    %rcx,%rax
neg    %rax
cmovs  %rcx,%rax
cmp    $0x3b,%rax
ja     1178 <ytht_Difftime_s+0x58>
cmp    %rbx,%rsi
lea    0xeb2(%rip),%rcx
lea    0xeae(%rip),%r8
cmovg  %rcx,%r8
lea    0xe96(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
jmp    1215 <ytht_Difftime_s+0xf5>
cmp    $0xe0f,%rax
ja     11aa <ytht_Difftime_s+0x8a>
movzwl %ax,%eax
imul   $0x8889,%eax,%ecx
shr    $0x15,%ecx
cmp    %rbx,%rsi
lea    0xe74(%rip),%rax
lea    0xe70(%rip),%r8
cmovg  %rax,%r8
lea    0xe68(%rip),%rdx
jmp    120f <ytht_Difftime_s+0xef>
cmp    $0x1517f,%rax
ja     11df <ytht_Difftime_s+0xbf>
mov    %eax,%eax
mov    $0x91a2b3c5,%ecx
imul   %rax,%rcx
shr    $0x2b,%rcx
cmp    %rbx,%rsi
lea    0xe3f(%rip),%rax
lea    0xe3b(%rip),%r8
cmovg  %rax,%r8
lea    0xe3d(%rip),%rdx
jmp    120f <ytht_Difftime_s+0xef>
movabs $0xc22e450672894ab7,%rcx
45 2e c2
mul    %rcx
mov    %rdx,%rcx
shr    $0x10,%rcx
cmp    %rbx,%rsi
lea    0xe0d(%rip),%rax
lea    0xe09(%rip),%r8
cmovg  %rax,%r8
lea    0xe15(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <snprintf@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%ld\C3\EB\D6\D3%s\00"
@.str.1 = [3 x i8] c"\C7\B0\00"
@.str.2 = [3 x i8] c"\BA\F3\00"
@.str.3 = [10 x i8] c"%ld\B7\D6\D6\D3%s\00"
@.str.4 = [10 x i8] c"%ld\D0\A1\CA\B1%s\00"
@.str.5 = [8 x i8] c"%ld\CC\EC%s\00"
define i8* @ytht_Difftime_s(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = call i64 @time(i32* null)
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = load i64, i64* %4
%12 = sub nsw i64 %10, %11
store i64 %12, i64* %8
%13 = load i64, i64* %8
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i64, i64* %8
%17 = sub nsw i64 0, %16
store i64 %17, i64* %8
br label %18
18: ; preds = %15, %3
%19 = load i64, i64* %8
%20 = icmp slt i64 %19, 60
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i8*, i8** %5
%23 = load i64, i64* %6
%24 = load i64, i64* %8
%25 = load i64, i64* %7
%26 = load i64, i64* %4
%27 = icmp sgt i64 %25, %26
%28 = zext i1 %27 to i64
%29 = select i1 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%30 = call i32 @snprintf(i8* %22, i64 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %24, i8* %29)
br label %72
31: ; preds = %18
%32 = load i64, i64* %8
%33 = icmp slt i64 %32, 3600
br i1 %33, label %34, label %45
34: ; preds = %31
%35 = load i8*, i8** %5
%36 = load i64, i64* %6
%37 = load i64, i64* %8
%38 = sdiv i64 %37, 60
%39 = load i64, i64* %7
%40 = load i64, i64* %4
%41 = icmp sgt i64 %39, %40
%42 = zext i1 %41 to i64
%43 = select i1 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%44 = call i32 @snprintf(i8* %35, i64 %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 %38, i8* %43)
br label %71
45: ; preds = %31
%46 = load i64, i64* %8
%47 = icmp slt i64 %46, 86400
br i1 %47, label %48, label %59
48: ; preds = %45
%49 = load i8*, i8** %5
%50 = load i64, i64* %6
%51 = load i64, i64* %8
%52 = sdiv i64 %51, 3600
%53 = load i64, i64* %7
%54 = load i64, i64* %4
%55 = icmp sgt i64 %53, %54
%56 = zext i1 %55 to i64
%57 = select i1 %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%58 = call i32 @snprintf(i8* %49, i64 %50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i64 %52, i8* %57)
br label %70
59: ; preds = %45
%60 = load i8*, i8** %5
%61 = load i64, i64* %6
%62 = load i64, i64* %8
%63 = sdiv i64 %62, 86400
%64 = load i64, i64* %7
%65 = load i64, i64* %4
%66 = icmp sgt i64 %64, %65
%67 = zext i1 %66 to i64
%68 = select i1 %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%69 = call i32 @snprintf(i8* %60, i64 %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 %63, i8* %68)
br label %70
70: ; preds = %59, %48
br label %71
71: ; preds = %70, %34
br label %72
72: ; preds = %71, %21
%73 = load i8*, i8** %5
ret i8* %73
}

LLVM IR (-O2):
@.str = [10 x i8] c"%ld\C3\EB\D6\D3%s\00"
@.str.1 = [3 x i8] c"\C7\B0\00"
@.str.2 = [3 x i8] c"\BA\F3\00"
@.str.3 = [10 x i8] c"%ld\B7\D6\D6\D3%s\00"
@.str.4 = [10 x i8] c"%ld\D0\A1\CA\B1%s\00"
@.str.5 = [8 x i8] c"%ld\CC\EC%s\00"
define i8* @ytht_Difftime_s(i64 %0, i8* returned %1, i64 %2) {
%4 = tail call i64 @time(i32* null)
%5 = sub nsw i64 %4, %0
%6 = tail call i64 @llvm.abs.i64(i64 %5, i1 true)
%7 = icmp ult i64 %6, 60
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = icmp sgt i64 %4, %0
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %6, i8* %10)
br label %35
12: ; preds = %3
%13 = icmp ult i64 %6, 3600
br i1 %13, label %14, label %21
14: ; preds = %12
%15 = trunc i64 %6 to i16
%16 = udiv i16 %15, 60
%17 = zext i16 %16 to i64
%18 = icmp sgt i64 %4, %0
%19 = select i1 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%20 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 %17, i8* %19)
br label %35
21: ; preds = %12
%22 = icmp ult i64 %6, 86400
br i1 %22, label %23, label %30
23: ; preds = %21
%24 = trunc i64 %6 to i32
%25 = udiv i32 %24, 3600
%26 = zext i32 %25 to i64
%27 = icmp sgt i64 %4, %0
%28 = select i1 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%29 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i64 %26, i8* %28)
br label %35
30: ; preds = %21
%31 = udiv i64 %6, 86400
%32 = icmp sgt i64 %4, %0
%33 = select i1 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%34 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 %31, i8* %33)
br label %35
35: ; preds = %14, %30, %23, %8
ret i8* %1
}