#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t rawtime;
  struct tm *timeinfo;
  char *buffer = NULL;
  buffer = (char *)calloc(80, sizeof(char));
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(buffer, 80, "Today is %B %d %Y.", timeinfo);
  puts(buffer);
  strftime(buffer, 80, "Now it's %H:%M.", timeinfo);
  puts(buffer);
  if (buffer) {
    free(buffer);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x50,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
call   1070 <time@plt>
lea    -0x8(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe4c(%rip),%rdx
call   1080 <strftime@plt>
mov    -0x18(%rbp),%rdi
call   1050 <puts@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe3d(%rip),%rdx
call   1080 <strftime@plt>
mov    -0x18(%rbp),%rdi
call   1050 <puts@plt>
cmpq   $0x0,-0x18(%rbp)
je     11f8 <main+0x98>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x50,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1070 <time@plt>
mov    %r14,%rdi
call   1040 <localtime@plt>
mov    %rax,%r14
lea    0xe6b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
lea    0xe5f(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rcx
call   1080 <strftime@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
test   %rbx,%rbx
je     11d9 <main+0x79>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [19 x i8] c"Today is %B %d %Y.\00"
@.str.1 = [16 x i8] c"Now it's %H:%M.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %4
%5 = call i64 @calloc(i32 80, i32 1)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %4
%7 = call i32 @time(i32* %2)
%8 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %8, %struct.tm** %3
%9 = load i8*, i8** %4
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @strftime(i8* %9, i32 80, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = load i8*, i8** %4
%13 = call i32 @puts(i8* %12)
%14 = load i8*, i8** %4
%15 = load %struct.tm*, %struct.tm** %3
%16 = call i32 @strftime(i8* %14, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %15)
%17 = load i8*, i8** %4
%18 = call i32 @puts(i8* %17)
%19 = load i8*, i8** %4
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = load i8*, i8** %4
%23 = call i32 @free(i8* %22)
br label %24
24: ; preds = %21, %0
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [19 x i8] c"Today is %B %d %Y.\00"
@.str.1 = [16 x i8] c"Now it's %H:%M.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @calloc(i32 80, i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = call i32 @time(i32* %1)
%6 = call %struct.tm* @localtime(i32* %1)
%7 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%8 = call i32 @puts(i8* dereferenceable(1) %4)
%9 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%10 = call i32 @puts(i8* dereferenceable(1) %4)
%11 = icmp eq i64 %3, 0
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 @free(i8* %4)
br label %14
14: ; preds = %12, %0
ret i32 0
}