#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;
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  char buf[100];
  time_t now;
  struct tm *curtime;
  setlocale(LC_ALL, "");
  time(&now);
  curtime = localtime(&now);
  (void)strftime(buf, sizeof buf, "It is now %A, %B %d, %Y, %I:%M %p", curtime);
  printf("%s\n", buf);
  printf("ctime() says: %s", ctime(&now));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1070 <setlocale@plt>
lea    -0x74(%rbp),%rdi
call   1060 <time@plt>
lea    -0x74(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x80(%rbp),%rcx
mov    $0x64,%esi
lea    0xe3f(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x70(%rbp),%rsi
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    -0x74(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xe3d(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1070 <setlocale@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1060 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
lea    0xe58(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <ctime@plt>
lea    0xe4b(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [34 x i8] c"It is now %A, %B %d, %Y, %I:%M %p\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [17 x i8] c"ctime() says: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 0, i32* %1
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @time(i32* %3)
%8 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %8, %struct.tm** %4
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %4
%11 = call i32 @strftime(i8* %9, i32 100, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i8* @ctime(i32* %3)
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [34 x i8] c"It is now %A, %B %d, %Y, %I:%M %p\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [17 x i8] c"ctime() says: %s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%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 = call i32 @time(i32* %2)
%8 = call %struct.tm* @localtime(i32* %2)
%9 = call i32 @strftime(i8* %3, i32 100, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = call i8* @ctime(i32* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 0)
unreachable
}