#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_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gmtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int);
const char *utl_time_fmt(char pStr[(20) + 1], time_t Time) {
  struct tm tmval;
  gmtime_r(&Time, &tmval);
  sprintf(pStr, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmval.tm_year + 1900,
          tmval.tm_mon + 1, tmval.tm_mday, tmval.tm_hour, tmval.tm_min,
          tmval.tm_sec);
  return pStr;
}


x86 assembly (clang, -O0):
<utl_time_fmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <gmtime_r@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
add    $0x76c,%edx
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%r10d
mov    -0x14(%rbp),%eax
lea    0xe9b(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_time_fmt>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <gmtime_r@plt>
mov    $0x76c,%edx
add    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
add    $0x1,%ecx
mov    0x1c(%rsp),%r9d
mov    0x20(%rsp),%eax
mov    0x24(%rsp),%ebx
lea    0xe9a(%rip),%rsi
mov    %r14,%rdi
push   %rbx
push   %rax
call   1040 <sprintf@plt>
add    $0x10,%rsp
mov    %r14,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [31 x i8] c"%04d-%02d-%02dT%02d:%02d:%02dZ\00"
define i8* @utl_time_fmt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 @gmtime_r(i32* %4, %struct.tm* %5)
%7 = load i8*, i8** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21)
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [31 x i8] c"%04d-%02d-%02dT%02d:%02d:%02dZ\00"
define i8* @utl_time_fmt(i8* returned writeonly %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.tm
store i32 %1, i32* %3
%5 = bitcast %struct.tm* %4 to i8*
%6 = call i32 @gmtime_r(i32* %3, %struct.tm* %4)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1900
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%20 = load i32, i32* %19
%21 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20)
ret i8* %0
}