#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;
};
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t tm;
  struct tm *ptr;
  char str[60];
  setlocale(LC_ALL, "C");
  tm = time(NULL);
  ptr = localtime(&tm);
  strftime(str, sizeof(str), "%x\n", ptr);
  printf(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1060 <setlocale@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x3c,%esi
lea    0xe61(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x50(%rbp),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%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    0xe7c(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3c,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [2 x i8] c"C\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [60 x i8]
store i32 0, i32* %1
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @time(i32* null)
store i32 %7, i32* %2
%8 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %8, %struct.tm** %3
%9 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @strftime(i8* %9, i32 60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%13 = call i32 @printf(i8* %12)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@LC_ALL = global i32 0
@.str = [2 x i8] c"C\00"
@.str.1 = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [60 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 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 60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
%10 = call i32 @printf(i8* %4)
ret i32 0
}