#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 timespec {
  int /*<<< orphan*/ tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ timespec_get(struct timespec *, int /*<<< orphan*/);
int main(void) {
  struct timespec ts;
  timespec_get(&ts, 0);
  char buff[100];
  strftime(buff, sizeof buff, "%D %T", gmtime(&ts.tv_sec));
  printf("Current time: %s.%09ld UTC\n", buff, ts.tv_nsec);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <timespec_get@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1060 <gmtime@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%ecx
mov    $0x64,%esi
lea    0xe83(%rip),%rdx
call   1050 <strftime@plt>
lea    -0x70(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <timespec_get@plt>
lea    0xc(%rsp),%rdi
call   1060 <gmtime@plt>
lea    0xe9b(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%ecx
call   1050 <strftime@plt>
mov    0x8(%rsp),%edx
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@.str = [6 x i8] c"%D %T\00"
@.str.1 = [28 x i8] c"Current time: %s.%09ld UTC\0A\00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca [100 x i8]
%3 = call i32 @timespec_get(%struct.timespec* %1, i32 0)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%6 = call i32 @gmtime(i32* %5)
%7 = call i32 @strftime(i8* %4, i32 100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %10)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@.str = [6 x i8] c"%D %T\00"
@.str.1 = [28 x i8] c"Current time: %s.%09ld UTC\0A\00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca [100 x i8]
%3 = bitcast %struct.timespec* %1 to i8*
%4 = call i32 @timespec_get(%struct.timespec* %1, i32 0)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%7 = call i32 @gmtime(i32* %6)
%8 = call i32 @strftime(i8* %5, i32 100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %10)
ret i32 0
}