#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*/ printf(char *, char *);
char *setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t currtime;
  struct tm *timer;
  char buffer[80];
  time(&currtime);
  timer = localtime(&currtime);
  printf("Locale is: %s\n", setlocale(LC_ALL, "en_US"));
  strftime(buffer, 80, "%c", timer);
  printf("Date is: %s\n", buffer);
  printf("Locale is: %s\n", setlocale(LC_ALL, NULL));
  strftime(buffer, 80, "%c", timer);
  printf("Date is: %s\n", buffer);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1060 <setlocale@plt>
mov    %rax,%rsi
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe68(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setlocale@plt>
mov    %rax,%rsi
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe1e(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%r14
mov    0x2e63(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe88(%rip),%rsi
call   1060 <setlocale@plt>
lea    0xe6d(%rip),%r12
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xe70(%rip),%r15
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1070 <strftime@plt>
lea    0xe54(%rip),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
xor    %esi,%esi
call   1060 <setlocale@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1070 <strftime@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [15 x i8] c"Locale is: %s\0A\00"
@LC_ALL = global i32 0
@.str.1 = [6 x i8] c"en_US\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [80 x i8]
store i32 0, i32* %1
%5 = call i32 @time(i32* %2)
%6 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %6, %struct.tm** %3
%7 = load i32, i32* @LC_ALL
%8 = call i8* @setlocale(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%11 = load %struct.tm*, %struct.tm** %3
%12 = call i32 @strftime(i8* %10, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @LC_ALL
%16 = call i8* @setlocale(i32 %15, i8* null)
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%19 = load %struct.tm*, %struct.tm** %3
%20 = call i32 @strftime(i8* %18, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [15 x i8] c"Locale is: %s\0A\00"
@LC_ALL = global i32 0
@.str.1 = [6 x i8] c"en_US\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @time(i32* %1)
%6 = call %struct.tm* @localtime(i32* %1)
%7 = load i32, i32* @LC_ALL
%8 = call i8* @setlocale(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %6)
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%12 = load i32, i32* @LC_ALL
%13 = call i8* @setlocale(i32 %12, i8* null)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %6)
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret i32 0
}