#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 */
struct lconv {
  char *decimal_point;
  char *thousands_sep;
  scalar_t__ *grouping;
  char *int_curr_symbol;
  char *currency_symbol;
  char *mon_decimal_point;
  char *mon_thousands_sep;
  char *positive_sign;
  char *negative_sign;
};

/* Variables and functions */
scalar_t__ CHAR_MAX;
int /*<<< orphan*/ LC_ALL;
struct lconv *localeconv();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main(void) {
  struct lconv l;
  int i;
  setlocale(LC_ALL, "");
  l = *localeconv();
  printf("decimal_point = [%s]\n", l.decimal_point);
  printf("thousands_sep = [%s]\n", l.thousands_sep);
  for (i = 0; l.grouping[i] != 0 && l.grouping[i] != CHAR_MAX; i++)
    printf("grouping[%d] = [%d]\n", i, l.grouping[i]);
  printf("int_curr_symbol = [%s]\n", l.int_curr_symbol);
  printf("currency_symbol = [%s]\n", l.currency_symbol);
  printf("mon_decimal_point = [%s]\n", l.mon_decimal_point);
  printf("mon_thousands_sep = [%s]\n", l.mon_thousands_sep);
  printf("positive_sign = [%s]\n", l.positive_sign);
  printf("negative_sign = [%s]\n", l.negative_sign);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1060 <setlocale@plt>
mov    $0x0,%al
call   1030 <localeconv@plt>
mov    %rax,%rsi
lea    -0x50(%rbp),%rdi
mov    $0x48,%edx
call   1050 <memcpy@plt>
mov    -0x50(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x40(%rbp),%rcx
movslq -0x54(%rbp),%rdx
xor    %eax,%eax
cmpq   $0x0,(%rcx,%rdx,8)
mov    %al,-0x55(%rbp)
je     11db <main+0x9b>
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x2e16(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    11eb <main+0xab>
jmp    1216 <main+0xd6>
mov    -0x54(%rbp),%esi
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a7 <main+0x67>
mov    -0x38(%rbp),%rsi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%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    $0x28,%rsp
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1050 <setlocale@plt>
xor    %eax,%eax
call   1030 <localeconv@plt>
mov    (%rax),%rsi
mov    0x8(%rax),%rbx
mov    0x10(%rax),%r13
mov    0x18(%rax),%rbp
mov    0x20(%rax),%r12
mov    0x28(%rax),%rcx
mov    %rcx,0x8(%rsp)
mov    0x30(%rax),%rcx
mov    %rcx,0x10(%rsp)
mov    0x38(%rax),%rcx
mov    %rcx,0x18(%rsp)
mov    0x40(%rax),%rax
mov    %rax,0x20(%rsp)
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%rdx
test   %rdx,%rdx
je     11f0 <main+0xc0>
mov    0x2e28(%rip),%rbx
cmp    (%rbx),%rdx
je     11f0 <main+0xc0>
lea    0xe34(%rip),%r14
xor    %r15d,%r15d
nop
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r13,%r15,8),%rdx
test   %rdx,%rdx
je     11f0 <main+0xc0>
add    $0x1,%r15
cmp    (%rbx),%rdx
jne    11d0 <main+0xa0>
lea    0xe1e(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe25(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe33(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    0x20(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.lconv = type { i8*, i8*, i64*, i8*, i8*, i8*, i8*, i8*, i8* }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [22 x i8] c"decimal_point = [%s]\0A\00"
@.str.2 = [22 x i8] c"thousands_sep = [%s]\0A\00"
@CHAR_MAX = global i64 0
@.str.3 = [21 x i8] c"grouping[%d] = [%d]\0A\00"
@.str.4 = [24 x i8] c"int_curr_symbol = [%s]\0A\00"
@.str.5 = [24 x i8] c"currency_symbol = [%s]\0A\00"
@.str.6 = [26 x i8] c"mon_decimal_point = [%s]\0A\00"
@.str.7 = [26 x i8] c"mon_thousands_sep = [%s]\0A\00"
@.str.8 = [22 x i8] c"positive_sign = [%s]\0A\00"
@.str.9 = [22 x i8] c"negative_sign = [%s]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.lconv
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @LC_ALL
%5 = call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = call %struct.lconv* (...) @localeconv()
%7 = bitcast %struct.lconv* %2 to i8*
%8 = bitcast %struct.lconv* %6 to i8*
%9 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 0
%10 = load i8*, i8** %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 1
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i32 0, i32* %3
br label %15
15: ; preds = %43, %0
%16 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 2
%17 = load i64*, i64** %16
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i64, i64* %17, i64 %19
%21 = load i64, i64* %20
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %15
%24 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 2
%25 = load i64*, i64** %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i64, i64* %25, i64 %27
%29 = load i64, i64* %28
%30 = load i64, i64* @CHAR_MAX
%31 = icmp ne i64 %29, %30
br label %32
32: ; preds = %23, %15
%33 = phi i1 [ false, %15 ], [ %31, %23 ]
br i1 %33, label %34, label %46
34: ; preds = %32
%35 = load i32, i32* %3
%36 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 2
%37 = load i64*, i64** %36
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i64, i64* %37, i64 %39
%41 = load i64, i64* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %35, i64 %41)
br label %43
43: ; preds = %34
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %15
46: ; preds = %32
%47 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 3
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %48)
%50 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 4
%51 = load i8*, i8** %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 5
%54 = load i8*, i8** %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %54)
%56 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 6
%57 = load i8*, i8** %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %57)
%59 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 7
%60 = load i8*, i8** %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds %struct.lconv, %struct.lconv* %2, i32 0, i32 8
%63 = load i8*, i8** %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %63)
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
%struct.lconv = type { i8*, i8*, i64*, i8*, i8*, i8*, i8*, i8*, i8* }
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [22 x i8] c"decimal_point = [%s]\0A\00"
@.str.2 = [22 x i8] c"thousands_sep = [%s]\0A\00"
@CHAR_MAX = global i64 0
@.str.3 = [21 x i8] c"grouping[%d] = [%d]\0A\00"
@.str.4 = [24 x i8] c"int_curr_symbol = [%s]\0A\00"
@.str.5 = [24 x i8] c"currency_symbol = [%s]\0A\00"
@.str.6 = [26 x i8] c"mon_decimal_point = [%s]\0A\00"
@.str.7 = [26 x i8] c"mon_thousands_sep = [%s]\0A\00"
@.str.8 = [22 x i8] c"positive_sign = [%s]\0A\00"
@.str.9 = [22 x i8] c"negative_sign = [%s]\0A\00"
define i32 @main() {
%1 = load i32, i32* @LC_ALL
%2 = tail call i32 @setlocale(i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = tail call %struct.lconv* (...) @localeconv()
%4 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 0
%5 = load i8*, i8** %4
%6 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 1
%7 = load i8*, i8** %6
%8 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 2
%9 = load i64*, i64** %8
%10 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 3
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 4
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 5
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 6
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 7
%19 = load i8*, i8** %18
%20 = getelementptr inbounds %struct.lconv, %struct.lconv* %3, i64 0, i32 8
%21 = load i8*, i8** %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%24 = load i64, i64* %9
%25 = icmp eq i64 %24, 0
%26 = load i64, i64* @CHAR_MAX
%27 = icmp eq i64 %24, %26
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %41, label %29
29: ; preds = %0, %29
%30 = phi i64 [ %34, %29 ], [ 0, %0 ]
%31 = phi i64 [ %36, %29 ], [ %24, %0 ]
%32 = trunc i64 %30 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %32, i64 %31)
%34 = add nuw i64 %30, 1
%35 = getelementptr inbounds i64, i64* %9, i64 %34
%36 = load i64, i64* %35
%37 = icmp eq i64 %36, 0
%38 = load i64, i64* @CHAR_MAX
%39 = icmp eq i64 %36, %38
%40 = select i1 %37, i1 true, i1 %39
br i1 %40, label %41, label %29
41: ; preds = %29, %0
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %17)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %19)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %21)
ret i32 0
}