#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 {
  size_t tm_wday;
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, char const *, int, int, int, int, int, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i = 0;
  while (i++ < 100) {
    time_t rawtime;
    struct tm *timeinfo;
    const char *weekday[] = {"周日", "周一", "周二", "周三",
                             "周四", "周五", "周六"};
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    mktime(timeinfo);
    printf("%s %d-%02d-%02d %d:%02d:%02d\n", weekday[timeinfo->tm_wday],
           timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday,
           timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x64,%eax
jge    122a <main+0xca>
lea    -0x60(%rbp),%rdi
lea    0x2c44(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
lea    -0x18(%rbp),%rdi
call   1060 <time@plt>
lea    -0x18(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <mktime@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x60(%rbp,%rax,8),%rsi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%edx
add    $0x76c,%edx
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%r8d
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%r9d
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%r10d
mov    -0x20(%rbp),%rax
mov    0x1c(%rax),%eax
lea    0xe23(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
jmp    117d <main+0x1d>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x64,%ebp
lea    0x4(%rsp),%r15
lea    0xee4(%rip),%r12
mov    $0x76c,%r13d
lea    0xeb8(%rip),%r14
nopl   0x0(%rax)
mov    %r15,%rdi
call   1050 <time@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <mktime@plt>
mov    (%rbx),%rax
movslq (%r12,%rax,4),%rsi
add    %r12,%rsi
mov    0x8(%rbx),%edx
add    %r13d,%edx
mov    0xc(%rbx),%ecx
add    $0x1,%ecx
mov    0x10(%rbx),%r8d
mov    0x14(%rbx),%r9d
mov    0x18(%rbx),%eax
mov    0x1c(%rbx),%ebx
mov    %r14,%rdi
push   %rbx
push   %rax
call   1040 <printf@plt>
add    $0x10,%rsp
mov    $0x1,%edi
call   1070 <sleep@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i32, i32, i32, i32, i32, i32 }
@.str = [7 x i8] c"\E5\91\A8\E6\97\A5\00"
@.str.1 = [7 x i8] c"\E5\91\A8\E4\B8\80\00"
@.str.2 = [7 x i8] c"\E5\91\A8\E4\BA\8C\00"
@.str.3 = [7 x i8] c"\E5\91\A8\E4\B8\89\00"
@.str.4 = [7 x i8] c"\E5\91\A8\E5\9B\9B\00"
@.str.5 = [7 x i8] c"\E5\91\A8\E4\BA\94\00"
@.str.6 = [7 x i8] c"\E5\91\A8\E5\85\AD\00"
@__const.main.weekday = [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [30 x i8] c"%s %d-%02d-%02d %d:%02d:%02d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm*
%9 = alloca [7 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %10
10: ; preds = %14, %2
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
store i32 %12, i32* %6
%13 = icmp slt i32 %11, 100
br i1 %13, label %14, label %47
14: ; preds = %10
%15 = bitcast [7 x i8*]* %9 to i8*
%16 = call i32 @time(i32* %7)
%17 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %17, %struct.tm** %8
%18 = load %struct.tm*, %struct.tm** %8
%19 = call i32 @mktime(%struct.tm* %18)
%20 = load %struct.tm*, %struct.tm** %8
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = getelementptr inbounds [7 x i8*], [7 x i8*]* %9, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = load %struct.tm*, %struct.tm** %8
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1900
%29 = load %struct.tm*, %struct.tm** %8
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 2
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
%33 = load %struct.tm*, %struct.tm** %8
%34 = getelementptr inbounds %struct.tm, %struct.tm* %33, i32 0, i32 3
%35 = load i32, i32* %34
%36 = load %struct.tm*, %struct.tm** %8
%37 = getelementptr inbounds %struct.tm, %struct.tm* %36, i32 0, i32 4
%38 = load i32, i32* %37
%39 = load %struct.tm*, %struct.tm** %8
%40 = getelementptr inbounds %struct.tm, %struct.tm* %39, i32 0, i32 5
%41 = load i32, i32* %40
%42 = load %struct.tm*, %struct.tm** %8
%43 = getelementptr inbounds %struct.tm, %struct.tm* %42, i32 0, i32 6
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %24, i32 %28, i32 %32, i32 %35, i32 %38, i32 %41, i32 %44)
%46 = call i32 @sleep(i32 1)
br label %10
47: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i64, i32, i32, i32, i32, i32, i32 }
@.str = [7 x i8] c"\E5\91\A8\E6\97\A5\00"
@.str.1 = [7 x i8] c"\E5\91\A8\E4\B8\80\00"
@.str.2 = [7 x i8] c"\E5\91\A8\E4\BA\8C\00"
@.str.3 = [7 x i8] c"\E5\91\A8\E4\B8\89\00"
@.str.4 = [7 x i8] c"\E5\91\A8\E5\9B\9B\00"
@.str.5 = [7 x i8] c"\E5\91\A8\E4\BA\94\00"
@.str.6 = [7 x i8] c"\E5\91\A8\E5\85\AD\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
@.str.7 = [30 x i8] c"%s %d-%02d-%02d %d:%02d:%02d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %7, %5 ]
%7 = add nuw nsw i32 %6, 1
%8 = call i32 @time(i32* %3)
%9 = call %struct.tm* @localtime(i32* %3)
%10 = call i32 @mktime(%struct.tm* %9)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%12 = load i64, i64* %11
%13 = shl i64 %12, 2
%14 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %13)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 1
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1900
%18 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 2
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
%21 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 3
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 5
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 6
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %14, i32 %17, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28)
%30 = call i32 @sleep(i32 1)
%31 = icmp eq i32 %7, 100
br i1 %31, label %32, label %5
32: ; preds = %5
ret i32 0
}