#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 tm {
  int tm_hour;
  int tm_min;
};

/* Variables and functions */
int /*<<< orphan*/ localtime_r(long *, struct tm *);
int /*<<< orphan*/ printf(char *, int, ...);
long time(int /*<<< orphan*/);
int main() {
  long seconds_since_epoch;
  struct tm current_time, *time_ptr;
  int hour, minute, second;
  seconds_since_epoch = time(0);
  printf("time() - seconds since epoch: %ld\n", seconds_since_epoch);
  time_ptr = &current_time;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
  localtime_r(&seconds_since_epoch, time_ptr);
#pragma GCC diagnostic pop
  hour = current_time.tm_hour;
  minute = time_ptr->tm_min;
  second = *((int *)time_ptr);
  printf("Current time is: %02d:%02d:%02d\n", hour, minute, second);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <localtime_r@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,0x10(%rsp)
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%edx
lea    0xeb5(%rip),%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@.str = [35 x i8] c"time() - seconds since epoch: %ld\0A\00"
@.str.1 = [33 x i8] c"Current time is: %02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca %struct.tm
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i64 @time(i32 0)
store i64 %8, i64* %2
%9 = load i64, i64* %2
%10 = trunc i64 %9 to i32
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %10)
store %struct.tm* %3, %struct.tm** %4
%12 = load %struct.tm*, %struct.tm** %4
%13 = call i32 @localtime_r(i64* %2, %struct.tm* %12)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load %struct.tm*, %struct.tm** %4
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load %struct.tm*, %struct.tm** %4
%20 = bitcast %struct.tm* %19 to i32*
%21 = load i32, i32* %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@.str = [35 x i8] c"time() - seconds since epoch: %ld\0A\00"
@.str.1 = [33 x i8] c"Current time is: %02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca %struct.tm
%3 = bitcast i64* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = tail call i64 @time(i32 0)
store i64 %5, i64* %1
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @localtime_r(i64* %1, %struct.tm* %2)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12, i32 %10)
ret i32 0
}