#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;
};
struct lconv {
  char *currency_symbol;
  char *int_curr_symbol;
  char *decimal_point;
};

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ LC_MONETARY;
struct lconv *localeconv();
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", timer);
  printf("Date is: %s\n", buffer);
  printf("Locale is: %s\n", setlocale(LC_ALL, "de_DE"));
  strftime(buffer, 80, "%c", timer);
  printf("Date is: %s\n", buffer);
  struct lconv *lc;
  setlocale(LC_MONETARY, "it_IT");
  lc = localeconv();
  printf("Local Currency Symbol: %s\n", lc->currency_symbol);
  printf("International Currency Symbol: %s\n", lc->int_curr_symbol);
  setlocale(LC_MONETARY, "en_US");
  lc = localeconv();
  printf("Local Currency Symbol: %s\n", lc->currency_symbol);
  printf("International Currency Symbol: %s\n", lc->int_curr_symbol);
  setlocale(LC_MONETARY, "en_GB");
  lc = localeconv();
  printf("Local Currency Symbol: %s\n", lc->currency_symbol);
  printf("International Currency Symbol: %s\n", lc->int_curr_symbol);
  printf("Decimal Point = %s\n", lc->decimal_point);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
call   1070 <setlocale@plt>
mov    %rax,%rsi
lea    0xe5c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe58(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1070 <setlocale@plt>
mov    %rax,%rsi
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe0b(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xdfe(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
lea    0xdfc(%rip),%rsi
call   1070 <setlocale@plt>
mov    $0x0,%al
call   1040 <localeconv@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
lea    0xde4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdeb(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xdf9(%rip),%rsi
call   1070 <setlocale@plt>
mov    $0x0,%al
call   1040 <localeconv@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
lea    0xd9d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xda4(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
lea    0xd52(%rip),%rsi
call   1070 <setlocale@plt>
mov    $0x0,%al
call   1040 <localeconv@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
lea    0xd56(%rip),%rdi
call   1050 <printf@plt>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd5d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x68(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd72(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x70,%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   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%r15
mov    0x2e4b(%rip),%r14
mov    (%r14),%edi
lea    0xe78(%rip),%rsi
call   1070 <setlocale@plt>
lea    0xe5d(%rip),%r13
mov    %r13,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xe60(%rip),%r12
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r12,%rdx
mov    %r15,%rcx
call   1080 <strftime@plt>
lea    0xe44(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    (%r14),%edi
lea    0xe3c(%rip),%rsi
call   1070 <setlocale@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r12,%rdx
mov    %r15,%rcx
call   1080 <strftime@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    0x2dc2(%rip),%r12
mov    (%r12),%edi
lea    0xe02(%rip),%rsi
call   1070 <setlocale@plt>
xor    %eax,%eax
call   1040 <localeconv@plt>
mov    %rax,%rbx
mov    (%rax),%rsi
lea    0xdef(%rip),%r15
mov    %r15,%rdi
call   1050 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xdf7(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    (%r12),%edi
lea    0xe07(%rip),%rsi
call   1070 <setlocale@plt>
xor    %eax,%eax
call   1040 <localeconv@plt>
mov    %rax,%rbp
mov    (%rax),%rsi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    0x8(%rbp),%rsi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    (%r12),%edi
lea    0xd76(%rip),%rsi
call   1070 <setlocale@plt>
xor    %eax,%eax
call   1040 <localeconv@plt>
mov    %rax,%rbp
mov    (%rax),%rsi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    0x8(%rbp),%rsi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x10(%rbp),%rsi
lea    0xdab(%rip),%rdi
call   1050 <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 }
%struct.lconv = type { i8*, i8*, i8* }
@.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 = [3 x i8] c"%c\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
@.str.4 = [6 x i8] c"de_DE\00"
@LC_MONETARY = global i32 0
@.str.5 = [6 x i8] c"it_IT\00"
@.str.6 = [27 x i8] c"Local Currency Symbol: %s\0A\00"
@.str.7 = [35 x i8] c"International Currency Symbol: %s\0A\00"
@.str.8 = [6 x i8] c"en_US\00"
@.str.9 = [20 x i8] c"Decimal Point = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [80 x i8]
%5 = alloca %struct.lconv*
store i32 0, i32* %1
%6 = call i32 @time(i32* %2)
%7 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %7, %struct.tm** %3
%8 = load i32, i32* @LC_ALL
%9 = call i8* @setlocale(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%12 = load %struct.tm*, %struct.tm** %3
%13 = call i32 @strftime(i8* %11, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @LC_ALL
%17 = call i8* @setlocale(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%20 = load %struct.tm*, %struct.tm** %3
%21 = call i32 @strftime(i8* %19, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %20)
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @LC_MONETARY
%25 = call i8* @setlocale(i32 %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%26 = call %struct.lconv* (...) @localeconv()
store %struct.lconv* %26, %struct.lconv** %5
%27 = load %struct.lconv*, %struct.lconv** %5
%28 = getelementptr inbounds %struct.lconv, %struct.lconv* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%31 = load %struct.lconv*, %struct.lconv** %5
%32 = getelementptr inbounds %struct.lconv, %struct.lconv* %31, i32 0, i32 1
%33 = load i8*, i8** %32
%34 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @LC_MONETARY
%36 = call i8* @setlocale(i32 %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%37 = call %struct.lconv* (...) @localeconv()
store %struct.lconv* %37, %struct.lconv** %5
%38 = load %struct.lconv*, %struct.lconv** %5
%39 = getelementptr inbounds %struct.lconv, %struct.lconv* %38, i32 0, i32 0
%40 = load i8*, i8** %39
%41 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %40)
%42 = load %struct.lconv*, %struct.lconv** %5
%43 = getelementptr inbounds %struct.lconv, %struct.lconv* %42, i32 0, i32 1
%44 = load i8*, i8** %43
%45 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @LC_MONETARY
%47 = call i8* @setlocale(i32 %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%48 = call %struct.lconv* (...) @localeconv()
store %struct.lconv* %48, %struct.lconv** %5
%49 = load %struct.lconv*, %struct.lconv** %5
%50 = getelementptr inbounds %struct.lconv, %struct.lconv* %49, i32 0, i32 0
%51 = load i8*, i8** %50
%52 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %51)
%53 = load %struct.lconv*, %struct.lconv** %5
%54 = getelementptr inbounds %struct.lconv, %struct.lconv* %53, i32 0, i32 1
%55 = load i8*, i8** %54
%56 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %55)
%57 = load %struct.lconv*, %struct.lconv** %5
%58 = getelementptr inbounds %struct.lconv, %struct.lconv* %57, i32 0, i32 2
%59 = load i8*, i8** %58
%60 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* %59)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
%struct.lconv = type { i8*, i8*, i8* }
@.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 = [3 x i8] c"%c\00"
@.str.3 = [13 x i8] c"Date is: %s\0A\00"
@.str.4 = [6 x i8] c"de_DE\00"
@LC_MONETARY = global i32 0
@.str.5 = [6 x i8] c"it_IT\00"
@.str.6 = [27 x i8] c"Local Currency Symbol: %s\0A\00"
@.str.7 = [35 x i8] c"International Currency Symbol: %s\0A\00"
@.str.8 = [6 x i8] c"en_US\00"
@.str.9 = [20 x i8] c"Decimal Point = %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* 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 ([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)
%17 = load i32, i32* @LC_MONETARY
%18 = call i8* @setlocale(i32 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%19 = call %struct.lconv* (...) @localeconv()
%20 = getelementptr inbounds %struct.lconv, %struct.lconv* %19, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds %struct.lconv, %struct.lconv* %19, i64 0, i32 1
%24 = load i8*, i8** %23
%25 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @LC_MONETARY
%27 = call i8* @setlocale(i32 %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%28 = call %struct.lconv* (...) @localeconv()
%29 = getelementptr inbounds %struct.lconv, %struct.lconv* %28, i64 0, i32 0
%30 = load i8*, i8** %29
%31 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds %struct.lconv, %struct.lconv* %28, i64 0, i32 1
%33 = load i8*, i8** %32
%34 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @LC_MONETARY
%36 = call i8* @setlocale(i32 %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%37 = call %struct.lconv* (...) @localeconv()
%38 = getelementptr inbounds %struct.lconv, %struct.lconv* %37, i64 0, i32 0
%39 = load i8*, i8** %38
%40 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds %struct.lconv, %struct.lconv* %37, i64 0, i32 1
%42 = load i8*, i8** %41
%43 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds %struct.lconv, %struct.lconv* %37, i64 0, i32 2
%45 = load i8*, i8** %44
%46 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* %45)
ret i32 0
}