#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 */

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ printf(char const *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  const char *fmt;
  if (argc == 1)
    fmt = "%'.2f";
  else
    fmt = argv[1];
  setlocale(LC_ALL, getenv("LC_ALL"));
  printf(fmt, 12456789.01);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1160 <main+0x30>
lea    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe8f(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <setlocale@plt>
mov    -0x18(%rbp),%rdi
movsd  0xe66(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1151 <main+0x11>
lea    0xeb9(%rip),%rbx
jmp    1155 <main+0x15>
mov    0x8(%rsi),%rbx
mov    0x2e84(%rip),%rax
mov    (%rax),%ebp
lea    0xea9(%rip),%rdi
call   1030 <getenv@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <setlocale@plt>
movsd  0xe85(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%'.2f\00"
@LC_ALL = global i32 0
@.str.1 = [7 x i8] c"LC_ALL\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %6
br label %14
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %6
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* @LC_ALL
%16 = call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @setlocale(i32 %15, i32 %16)
%18 = load i8*, i8** %6
%19 = call i32 (i8*, ...) @printf(i8* %18, double 0x4167C26AA051EB85)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%'.2f\00"
@LC_ALL = global i32 0
@.str.1 = [7 x i8] c"LC_ALL\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = load i32, i32* @LC_ALL
%10 = tail call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @setlocale(i32 %9, i32 %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %8, double 0x4167C26AA051EB85)
%13 = tail call i32 @putchar(i32 10)
ret i32 0
}