#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 dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ asctime_r(struct tm *, char *);
int /*<<< orphan*/ ctime_r(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ gmtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void timeformats(void) {
  char buf[80];
  struct tm tm;
  time_t now;
  now = time(NULL);
  gmtime_r(&now, &tm);
  strftime(buf, sizeof(buf), "%FT%TZ", &tm);
  printf("iso8601        %s\n", buf);
  strftime(buf, sizeof(buf), "%Y%m%dT%H%M%SZ", &tm);
  printf("iso8601 (raw)  %s\n", buf);
  asctime_r(&tm, buf);
  printf("asctime        %s", buf);
  ctime_r(&now, buf);
  printf("ctime          %s\n", buf);
}


x86 assembly (clang, -O0):
<timeformats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x5c(%rbp)
lea    -0x5c(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <gmtime_r@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
lea    0xe6f(%rip),%rdx
lea    -0x58(%rbp),%rcx
call   1080 <strftime@plt>
lea    -0x50(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
lea    0xe60(%rip),%rdx
lea    -0x58(%rbp),%rcx
call   1080 <strftime@plt>
lea    -0x50(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdi
call   1070 <asctime_r@plt>
lea    -0x50(%rbp),%rsi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    -0x5c(%rbp),%rdi
call   1060 <ctime_r@plt>
lea    -0x50(%rbp),%rsi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeformats>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <gmtime_r@plt>
lea    0xe70(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r15,%rcx
call   1080 <strftime@plt>
lea    0xe5b(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xe5f(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r15,%rcx
call   1080 <strftime@plt>
lea    0xe57(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <asctime_r@plt>
lea    0xe50(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <ctime_r@plt>
lea    0xe48(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [7 x i8] c"%FT%TZ\00"
@.str.1 = [19 x i8] c"iso8601 %s\0A\00"
@.str.2 = [15 x i8] c"%Y%m%dT%H%M%SZ\00"
@.str.3 = [19 x i8] c"iso8601 (raw) %s\0A\00"
@.str.4 = [18 x i8] c"asctime %s\00"
@.str.5 = [19 x i8] c"ctime %s\0A\00"
define void @timeformats() {
%1 = alloca [80 x i8]
%2 = alloca %struct.tm
%3 = alloca i32
%4 = call i32 @time(i32* null)
store i32 %4, i32* %3
%5 = call i32 @gmtime_r(i32* %3, %struct.tm* %2)
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = call i32 @strftime(i8* %6, i32 80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%11 = call i32 @strftime(i8* %10, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %2)
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%15 = call i32 @asctime_r(%struct.tm* %2, i8* %14)
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%19 = call i32 @ctime_r(i32* %3, i8* %18)
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %20)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [7 x i8] c"%FT%TZ\00"
@.str.1 = [19 x i8] c"iso8601 %s\0A\00"
@.str.2 = [15 x i8] c"%Y%m%dT%H%M%SZ\00"
@.str.3 = [19 x i8] c"iso8601 (raw) %s\0A\00"
@.str.4 = [18 x i8] c"asctime %s\00"
@.str.5 = [19 x i8] c"ctime %s\0A\00"
define void @timeformats() {
%1 = alloca [80 x i8]
%2 = alloca %struct.tm
%3 = alloca i32
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = bitcast %struct.tm* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %3
%8 = call i32 @gmtime_r(i32* %3, %struct.tm* %2)
%9 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%13 = call i32 @asctime_r(%struct.tm* %2, i8* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%15 = call i32 @ctime_r(i32* %3, i8* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %4)
ret void
}