#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_GB"));
  strftime(buffer, 80, "%c\n", timer);
  printf("Date is: %s\n", buffer);
  printf("Locale is: %s\n", setlocale(LC_ALL, "de_DE"));
  strftime(buffer, 80, "%c\n", timer);
  printf("Date is: %s\n", buffer);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1060 <setlocale@plt>
mov    %rax,%rsi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe6f(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
call   1060 <setlocale@plt>
mov    %rax,%rsi
lea    0xe26(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe22(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe16(%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    0xe55(%rip),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
lea    0xe4d(%rip),%rsi
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_GB\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
@.str.4 = [6 x i8] c"de_DE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca [80 x i8]
%4 = call i32 @time(i32* %1)
%5 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %5, %struct.tm** %2
%6 = load i32, i32* @LC_ALL
%7 = call i8* @setlocale(i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %2
%11 = call i32 @strftime(i8* %9, i32 80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @LC_ALL
%15 = call i8* @setlocale(i32 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%18 = load %struct.tm*, %struct.tm** %2
%19 = call i32 @strftime(i8* %17, i32 80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %18)
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %20)
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_GB\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
@.str.4 = [6 x i8] c"de_DE\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 ([4 x i8], [4 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* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%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 ([4 x i8], [4 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
}