#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 */

/* Variables and functions */
unsigned long gmtime2bjtime(unsigned long);
int /*<<< orphan*/ gmtime2str(unsigned long, char *);
int /*<<< orphan*/ printf(char *, ...);
unsigned long str2gmtime(char const *);
int main(void) {
  const char *s = "2020-03-04 05:06:07";
  unsigned long ts;
  char buf[20];
  ts = str2gmtime(s);
  printf("%s -> %lu\n", s, ts);
  gmtime2str(ts, buf);
  printf("%lu -> %s\n", ts, buf);
  unsigned long bjts = gmtime2bjtime(ts);
  gmtime2str(bjts, buf);
  printf("bj time = %lu %s\n", bjts, buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <str2gmtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <gmtime2str@plt>
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <gmtime2bjtime@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <gmtime2str@plt>
mov    -0x38(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
call   1030 <str2gmtime@plt>
mov    %rax,%rbx
lea    0xeb4(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <gmtime2str@plt>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <gmtime2bjtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <gmtime2str@plt>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"2020-03-04 05:06:07\00"
@.str.1 = [11 x i8] c"%s -> %lu\0A\00"
@.str.2 = [11 x i8] c"%lu -> %s\0A\00"
@.str.3 = [18 x i8] c"bj time = %lu %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca [20 x i8]
%5 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @str2gmtime(i8* %6)
store i64 %7, i64* %3
%8 = load i8*, i8** %2
%9 = load i64, i64* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8, i64 %9)
%11 = load i64, i64* %3
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%13 = call i32 @gmtime2str(i64 %11, i8* %12)
%14 = load i64, i64* %3
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %14, i8* %15)
%17 = load i64, i64* %3
%18 = call i64 @gmtime2bjtime(i64 %17)
store i64 %18, i64* %5
%19 = load i64, i64* %5
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%21 = call i32 @gmtime2str(i64 %19, i8* %20)
%22 = load i64, i64* %5
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 %22, i8* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"2020-03-04 05:06:07\00"
@.str.1 = [11 x i8] c"%s -> %lu\0A\00"
@.str.2 = [11 x i8] c"%lu -> %s\0A\00"
@.str.3 = [18 x i8] c"bj time = %lu %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i64 @str2gmtime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = call i32 @gmtime2str(i64 %3, i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %3, i8* %2)
%7 = call i64 @gmtime2bjtime(i64 %3)
%8 = call i32 @gmtime2str(i64 %7, i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 %7, i8* %2)
ret i32 0
}