#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*/ exit(int /*<<< orphan*/);
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  struct tm *tm_ptr;
  time_t the_time;
  (void)time(&the_time);
  tm_ptr = gmtime(&the_time);
  printf("Raw time is %ld\n", the_time);
  printf("gmtime gives:\n");
  printf("date: %02d/%02d/%02d\n", tm_ptr->tm_year, tm_ptr->tm_mon + 1,
         tm_ptr->tm_mday);
  printf("time: %02d:%02d:%02d\n", tm_ptr->tm_hour, tm_ptr->tm_min,
         tm_ptr->tm_sec);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <time@plt>
lea    -0x14(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%ecx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1060 <gmtime@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
mov    0x4(%rbx),%edx
add    $0x1,%edx
mov    0x8(%rbx),%ecx
lea    0xe74(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%esi
mov    0x10(%rbx),%edx
mov    0x14(%rbx),%ecx
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [17 x i8] c"Raw time is %ld\0A\00"
@.str.1 = [15 x i8] c"gmtime gives:\0A\00"
@.str.2 = [22 x i8] c"date: %02d/%02d/%02d\0A\00"
@.str.3 = [22 x i8] c"time: %02d:%02d:%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* %3)
%5 = call %struct.tm* @gmtime(i32* %3)
store %struct.tm* %5, %struct.tm** %2
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load %struct.tm*, %struct.tm** %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 2
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %15, i32 %18)
%20 = load %struct.tm*, %struct.tm** %2
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 3
%22 = load i32, i32* %21
%23 = load %struct.tm*, %struct.tm** %2
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 4
%25 = load i32, i32* %24
%26 = load %struct.tm*, %struct.tm** %2
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 5
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %25, i32 %28)
%30 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [17 x i8] c"Raw time is %ld\0A\00"
@.str.2 = [22 x i8] c"date: %02d/%02d/%02d\0A\00"
@.str.3 = [22 x i8] c"time: %02d:%02d:%02d\0A\00"
@str = [14 x i8] c"gmtime gives:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @gmtime(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%9 = load i32, i32* %8
%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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %12, i32 %14)
%16 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %19, i32 %21)
%23 = call i32 @exit(i32 0)
unreachable
}