#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*/ time_t;
struct tm {
  int tm_hour;
  int /*<<< orphan*/ tm_mday;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_year;
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t timer;
  struct tm y2k = {0}, *info;
  double seconds;
  time(&timer);
  info = gmtime(&timer);
  y2k.tm_hour = 18;
  y2k.tm_min = 0;
  y2k.tm_sec = 0;
  y2k.tm_year = info->tm_year;
  y2k.tm_mon = info->tm_mon;
  y2k.tm_mday = info->tm_mday;
  seconds = difftime(mktime(&y2k), timer);
  if (seconds < 0)
    seconds += 3600 * 24;
  int h = (int)seconds / 3600;
  int m = (int)((seconds - h * 3600) / 60);
  int s = (int)seconds % 60;
  printf("还剩%d小时%d分钟%d秒下班了!\n", h, m, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
lea    -0x8(%rbp),%rdi
call   1080 <gmtime@plt>
mov    %rax,-0x38(%rbp)
movl   $0x12,-0x30(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1040 <difftime@plt>
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1202 <main+0xa2>
movsd  0xe08(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
movsd  -0x40(%rbp),%xmm0
imul   $0xe10,-0x44(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xdda(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x48(%rbp)
cvttsd2si -0x40(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4c(%rbp)
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xdb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movq   $0x0,0x28(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1070 <gmtime@plt>
movl   $0x12,0x8(%rsp)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x18(%rsp)
mov    0xc(%rax),%ecx
mov    %ecx,0x14(%rsp)
mov    0x8(%rax),%ecx
mov    %ecx,0x10(%rsp)
mov    0x4(%rax),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1060 <mktime@plt>
mov    0x4(%rsp),%esi
mov    %eax,%edi
call   1040 <difftime@plt>
movsd  0xe49(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
cvttsd2si %xmm3,%eax
movslq %eax,%rcx
imul   $0xffffffff91a2b3c5,%rcx,%rsi
shr    $0x20,%rsi
add    %ecx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0xb,%esi
add    %eax,%esi
imul   $0xe10,%esi,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  %xmm0,%xmm3
divsd  0xdfd(%rip),%xmm3
cvttsd2si %xmm3,%edx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x5,%eax
add    %edi,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%ecx
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i32 }
@.str = [39 x i8] c"\E8\BF\98\E5\89\A9%d\E5\B0\8F\E6\97\B6%d\E5\88\86\E9\92\9F%d\E7\A7\92\E4\B8\8B\E7\8F\AD\E4\BA\86!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm
%4 = alloca %struct.tm*
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast %struct.tm* %3 to i8*
%10 = call i32 @time(i32* %2)
%11 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %11, %struct.tm** %4
%12 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
store i32 18, i32* %12
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
store i64 0, i64* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
store i64 0, i64* %14
%15 = load %struct.tm*, %struct.tm** %4
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
store i32 %17, i32* %18
%19 = load %struct.tm*, %struct.tm** %4
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
store i32 %21, i32* %22
%23 = load %struct.tm*, %struct.tm** %4
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 1
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
store i32 %25, i32* %26
%27 = call i32 @mktime(%struct.tm* %3)
%28 = load i32, i32* %2
%29 = call double @difftime(i32 %27, i32 %28)
store double %29, double* %5
%30 = load double, double* %5
%31 = fcmp olt double %30, 0.000000e+00
br i1 %31, label %32, label %35
32: ; preds = %0
%33 = load double, double* %5
%34 = fadd double %33, 8.640000e+04
store double %34, double* %5
br label %35
35: ; preds = %32, %0
%36 = load double, double* %5
%37 = fptosi double %36 to i32
%38 = sdiv i32 %37, 3600
store i32 %38, i32* %6
%39 = load double, double* %5
%40 = load i32, i32* %6
%41 = mul nsw i32 %40, 3600
%42 = sitofp i32 %41 to double
%43 = fsub double %39, %42
%44 = fdiv double %43, 6.000000e+01
%45 = fptosi double %44 to i32
store i32 %45, i32* %7
%46 = load double, double* %5
%47 = fptosi double %46 to i32
%48 = srem i32 %47, 60
store i32 %48, i32* %8
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i32 }
@.str = [39 x i8] c"\E8\BF\98\E5\89\A9%d\E5\B0\8F\E6\97\B6%d\E5\88\86\E9\92\9F%d\E7\A7\92\E4\B8\8B\E7\8F\AD\E4\BA\86!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 6
%6 = bitcast i32* %5 to i64*
store i64 0, i64* %6
%7 = call i32 @time(i32* %1)
%8 = call %struct.tm* @gmtime(i32* %1)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
store i32 18, i32* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 3
%12 = bitcast i64* %10 to i8*
%13 = load i32, i32* %11
%14 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
store i32 %13, i32* %14
%15 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
store i32 %16, i32* %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
store i32 %19, i32* %20
%21 = call i32 @mktime(%struct.tm* %2)
%22 = load i32, i32* %1
%23 = call double @difftime(i32 %21, i32 %22)
%24 = fcmp olt double %23, 0.000000e+00
%25 = fadd double %23, 8.640000e+04
%26 = select i1 %24, double %25, double %23
%27 = fptosi double %26 to i32
%28 = sdiv i32 %27, 3600
%29 = mul nsw i32 %28, 3600
%30 = sitofp i32 %29 to double
%31 = fsub double %26, %30
%32 = fdiv double %31, 6.000000e+01
%33 = fptosi double %32 to i32
%34 = srem i32 %27, 60
%35 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %33, i32 %34)
ret i32 0
}