#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 */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
struct timezone {
  int dummy;
};
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int);
extern void sysUsecTime() {
  struct timeval tv;
  struct timezone tz;
  struct tm *p;
  gettimeofday(&tv, &tz);
  p = localtime(&tv.tv_sec);
  printf("%d年%d月%d日%d点%d分%d秒.%ld毫秒\n", 1900 + p->tm_year, 1 + p->tm_mon,
         p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec, tv.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<sysUsecTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <gettimeofday@plt>
lea    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x8(%rbp),%eax
mov    $0x3e8,%edi
cltd
idiv   %edi
mov    -0x1c(%rbp),%edx
lea    0xe5d(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysUsecTime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <gettimeofday@plt>
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    $0x76c,%esi
add    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%r10d
movslq 0x8(%rsp),%rdi
imul   $0x10624dd3,%rdi,%rax
mov    %rax,%rdi
shr    $0x3f,%rdi
sar    $0x26,%rax
add    %edi,%eax
lea    0xe77(%rip),%rdi
push   %rax
push   %r10
call   1040 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [42 x i8] c"%d\E5\B9\B4%d\E6\9C\88%d\E6\97\A5%d\E7\82\B9%d\E5\88\86%d\E7\A7\92.%ld\E6\AF\AB\E7\A7\92\0A\00"
define void @sysUsecTime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = alloca %struct.tm*
%4 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %6, %struct.tm** %3
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 1900, %9
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = add nsw i32 1, %13
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 2
%17 = load i32, i32* %16
%18 = load %struct.tm*, %struct.tm** %3
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 3
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 4
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %3
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 5
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%28 = load i32, i32* %27
%29 = sdiv i32 %28, 1000
%30 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %14, i32 %17, i32 %20, i32 %23, i32 %26, i32 %29)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [42 x i8] c"%d\E5\B9\B4%d\E6\9C\88%d\E6\97\A5%d\E7\82\B9%d\E5\88\86%d\E7\A7\92.%ld\E6\AF\AB\E7\A7\92\0A\00"
define void @sysUsecTime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = call %struct.tm* @localtime(i32* %6)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%23 = load i32, i32* %22
%24 = sdiv i32 %23, 1000
%25 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21, i32 %24)
ret void
}