#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;
};

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
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 rawtime;
  struct tm *timeinfo;
  char buffer[80];
  struct lconv *lc;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  int twice = 0;
  do {
    printf("Locale is: %s\n", setlocale(LC_ALL, NULL));
    strftime(buffer, 80, "%c", timeinfo);
    printf("Date is: %s\n", buffer);
    lc = localeconv();
    printf("Currency symbol is: %s\n-\n", lc->currency_symbol);
    setlocale(LC_ALL, "");
  } while (!twice++);
  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)
movl   $0x0,-0x6c(%rbp)
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <setlocale@plt>
mov    %rax,%rsi
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x50,%esi
lea    0xe4e(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x60(%rbp),%rsi
lea    0xe41(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <localeconv@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
lea    0xe30(%rip),%rdi
call   1050 <printf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
call   1070 <setlocale@plt>
mov    -0x6c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x6c(%rbp)
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118c <main+0x2c>
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,%rbx
mov    0x2e53(%rip),%r12
mov    (%r12),%edi
xor    %esi,%esi
call   1070 <setlocale@plt>
lea    0xe61(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xe61(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
mov    %rbx,%rcx
call   1080 <strftime@plt>
lea    0xe48(%rip),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <localeconv@plt>
mov    (%rax),%rsi
lea    0xe39(%rip),%rbp
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    (%r12),%edi
lea    0xe3f(%rip),%r15
mov    %r15,%rsi
call   1070 <setlocale@plt>
mov    (%r12),%edi
xor    %esi,%esi
call   1070 <setlocale@plt>
lea    0xded(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x50,%esi
lea    0xde5(%rip),%rdx
mov    %rbx,%rcx
call   1080 <strftime@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <localeconv@plt>
mov    (%rax),%rsi
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    (%r12),%edi
mov    %r15,%rsi
call   1070 <setlocale@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* }
@.str = [15 x i8] c"Locale is: %s\0A\00"
@LC_ALL = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"Date is: %s\0A\00"
@.str.3 = [26 x i8] c"Currency symbol is: %s\0A-\0A\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [80 x i8]
%5 = alloca %struct.lconv*
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @time(i32* %2)
%8 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %8, %struct.tm** %3
store i32 0, i32* %6
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* @LC_ALL
%11 = call i8* @setlocale(i32 %10, i8* null)
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%14 = load %struct.tm*, %struct.tm** %3
%15 = call i32 @strftime(i8* %13, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %14)
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = call %struct.lconv* (...) @localeconv()
store %struct.lconv* %18, %struct.lconv** %5
%19 = load %struct.lconv*, %struct.lconv** %5
%20 = getelementptr inbounds %struct.lconv, %struct.lconv* %19, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @LC_ALL
%24 = call i8* @setlocale(i32 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %9
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
%28 = icmp ne i32 %26, 0
%29 = xor i1 %28, true
br i1 %29, label %9, label %30
30: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
%struct.lconv = type { i8* }
@.str = [15 x i8] c"Locale is: %s\0A\00"
@LC_ALL = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"Date is: %s\0A\00"
@.str.3 = [26 x i8] c"Currency symbol is: %s\0A-\0A\00"
@.str.4 = [1 x i8] zeroinitializer
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* null)
%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.1, i64 0, i64 0), %struct.tm* %6)
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%12 = call %struct.lconv* (...) @localeconv()
%13 = getelementptr inbounds %struct.lconv, %struct.lconv* %12, i64 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 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 ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%18 = load i32, i32* @LC_ALL
%19 = call i8* @setlocale(i32 %18, i8* null)
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%23 = call %struct.lconv* (...) @localeconv()
%24 = getelementptr inbounds %struct.lconv, %struct.lconv* %23, i64 0, i32 0
%25 = load i8*, i8** %24
%26 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @LC_ALL
%28 = call i8* @setlocale(i32 %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}