#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 */
int /*<<< orphan*/ LC_ALL;
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t t;
  struct tm *bdtime;
  char buf[1000];
  setlocale(LC_ALL, "");
  t = time(NULL);
  bdtime = localtime(&t);
  strftime(buf, 1000, "It is %H:%M on %A %d %B %Y", bdtime);
  puts(buf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1060 <setlocale@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x3e8,%esi
lea    0xe60(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x400(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1060 <setlocale@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe77(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c"It is %H:%M on %A %d %B %Y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca [1000 x i8]
%4 = load i32, i32* @LC_ALL
%5 = call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @time(i32* null)
store i32 %6, i32* %1
%7 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %7, %struct.tm** %2
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%9 = load %struct.tm*, %struct.tm** %2
%10 = call i32 @strftime(i8* %8, i32 1000, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %9)
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c"It is %H:%M on %A %d %B %Y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %1
%8 = call %struct.tm* @localtime(i32* %1)
%9 = call i32 @strftime(i8* %4, i32 1000, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
%10 = call i32 @puts(i8* %4)
ret i32 0
}