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

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_settime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ ctime_r(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void timet_h(struct timespec *ptp1) {
  clockid_t clk_id1, clk_id2, clk_id3;
  struct timespec *ptp;
  clock_settime(CLOCK_REALTIME, ptp);
  clock_settime(clk_id1, ptp);
  clock_settime(clk_id2, ptp1);
  struct timespec tp;
  clock_settime(CLOCK_REALTIME, &tp);
  clock_settime(clk_id3, &tp);
  time_t clock = time(0);
  char buf[26];
  ctime_r(&clock, buf);
}


x86 assembly (clang, -O0):
<timet_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
call   1050 <clock_settime@plt>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <clock_settime@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <clock_settime@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1050 <clock_settime@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1050 <clock_settime@plt>
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x50(%rbp),%rsi
lea    -0x2c(%rbp),%rdi
call   1040 <ctime_r@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timet_h>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
mov    0x2e9f(%rip),%r14
mov    (%r14),%edi
call   1050 <clock_settime@plt>
call   1050 <clock_settime@plt>
mov    %rbx,%rsi
call   1050 <clock_settime@plt>
mov    (%r14),%edi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <clock_settime@plt>
mov    %rbx,%rsi
call   1050 <clock_settime@plt>
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <ctime_r@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define void @timet_h(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timespec*
%7 = alloca %struct.timespec
%8 = alloca i32
%9 = alloca [26 x i8]
store %struct.timespec* %0, %struct.timespec** %2
%10 = load i32, i32* @CLOCK_REALTIME
%11 = load %struct.timespec*, %struct.timespec** %6
%12 = call i32 @clock_settime(i32 %10, %struct.timespec* %11)
%13 = load i32, i32* %3
%14 = load %struct.timespec*, %struct.timespec** %6
%15 = call i32 @clock_settime(i32 %13, %struct.timespec* %14)
%16 = load i32, i32* %4
%17 = load %struct.timespec*, %struct.timespec** %2
%18 = call i32 @clock_settime(i32 %16, %struct.timespec* %17)
%19 = load i32, i32* @CLOCK_REALTIME
%20 = call i32 @clock_settime(i32 %19, %struct.timespec* %7)
%21 = load i32, i32* %5
%22 = call i32 @clock_settime(i32 %21, %struct.timespec* %7)
%23 = call i32 @time(i32 0)
store i32 %23, i32* %8
%24 = getelementptr inbounds [26 x i8], [26 x i8]* %9, i64 0, i64 0
%25 = call i32 @ctime_r(i32* %8, i8* %24)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define void @timet_h(%struct.timespec* %0) {
%2 = alloca %struct.timespec
%3 = alloca i32
%4 = alloca [26 x i8]
%5 = load i32, i32* @CLOCK_REALTIME
%6 = tail call i32 @clock_settime(i32 %5, %struct.timespec* undef)
%7 = tail call i32 @clock_settime(i32 undef, %struct.timespec* undef)
%8 = tail call i32 @clock_settime(i32 undef, %struct.timespec* %0)
%9 = bitcast %struct.timespec* %2 to i8*
%10 = load i32, i32* @CLOCK_REALTIME
%11 = call i32 @clock_settime(i32 %10, %struct.timespec* %2)
%12 = call i32 @clock_settime(i32 undef, %struct.timespec* %2)
%13 = bitcast i32* %3 to i8*
%14 = call i32 @time(i32 0)
store i32 %14, i32* %3
%15 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%16 = call i32 @ctime_r(i32* %3, i8* %15)
ret void
}