#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 dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  char buffer[256];
  time_t curtime;
  struct tm *loctime;
  curtime = time(NULL);
  loctime = localtime(&curtime);
  fputs(asctime(loctime), stdout);
  strftime(buffer, 256, "Today is %A, %B %d.\n", loctime);
  fputs(buffer, stdout);
  strftime(buffer, 256, "The time is %I:%M %p.\n", loctime);
  fputs(buffer, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x114(%rbp)
lea    -0x114(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rcx
mov    $0x100,%esi
lea    0xe45(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rcx
mov    $0x100,%esi
lea    0xe26(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x110(%rbp),%rdi
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x110,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <asctime@plt>
mov    0x2e5d(%rip),%r15
mov    (%r15),%esi
mov    %rax,%rdi
call   1050 <fputs@plt>
lea    0xe6b(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1070 <strftime@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1050 <fputs@plt>
lea    0xe59(%rip),%rdx
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1070 <strftime@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1050 <fputs@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@stdout = global i32 0
@.str = [21 x i8] c"Today is %A, %B %d.\0A\00"
@.str.1 = [23 x i8] c"The time is %I:%M %p.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %6, %struct.tm** %4
%7 = load %struct.tm*, %struct.tm** %4
%8 = call i8* @asctime(%struct.tm* %7)
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* %8, i32 %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = load %struct.tm*, %struct.tm** %4
%13 = call i32 @strftime(i8* %11, i32 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* %14, i32 %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%18 = load %struct.tm*, %struct.tm** %4
%19 = call i32 @strftime(i8* %17, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%21 = load i32, i32* @stdout
%22 = call i32 @fputs(i8* %20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@stdout = global i32 0
@.str = [21 x i8] c"Today is %A, %B %d.\0A\00"
@.str.1 = [23 x i8] c"The time is %I:%M %p.\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call %struct.tm* @localtime(i32* %2)
%7 = call i8* @asctime(%struct.tm* %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fputs(i8* %7, i32 %8)
%10 = call i32 @strftime(i8* %3, i32 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* %3, i32 %11)
%13 = call i32 @strftime(i8* %3, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%14 = load i32, i32* @stdout
%15 = call i32 @fputs(i8* %3, i32 %14)
ret i32 0
}