#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 DBL_DIG;
double DBL_EPSILON;
int DBL_MANT_DIG;
double DBL_MAX;
int DBL_MAX_10_EXP;
int /*<<< orphan*/ LC_NUMERIC;
char *basename(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
char *setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  (void)argc;
  char *locale = setlocale(LC_NUMERIC, "en_US");
  if (locale == NULL) {
    fprintf(stderr, "%s: %s: %s\n", basename(argv[0]),
            "setlocale (LC_NUMERIC, \"en_US\")", "failed\n");
  } else {
    printf("Locale set to %s\n", locale);
  }
  printf("DBL_DIG = %d\n", DBL_DIG);
  printf("DBL_EPSILON = %.15g\n", DBL_EPSILON);
  printf("DBL_MANT_DIG = %d\n", DBL_MANT_DIG);
  printf("DBL_MAX_10_EXP = %d\n", DBL_MAX_10_EXP);
  printf("DBL_MAX = %.15g\n", DBL_MAX);
  double dollars = 1.00;
  while (dollars + 0.01 > dollars)
    dollars *= 2;
  printf("dollars = $%'22.2f = $%g\n", dollars, dollars);
  printf("US debt = $%'22.2f (Feb. 2013)\n", 16687289180215.00);
  printf("diameter of the universe = %g meters\n", 8.8e26);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1060 <setlocale@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b7 <main+0x77>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <basename@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe8f(%rip),%rsi
lea    0xe94(%rip),%rcx
lea    0xead(%rip),%r8
call   1040 <fprintf@plt>
jmp    11c9 <main+0x89>
mov    -0x18(%rbp),%rsi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2df1(%rip),%rax
movsd  (%rax),%xmm0
lea    0xe90(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d82(%rip),%rax
movsd  (%rax),%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdb8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdb3(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    127c <main+0x13c>
movsd  0xdb3(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    124d <main+0x10d>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe43(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
movsd  0xd75(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
movsd  0xd57(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1060 <setlocale@plt>
test   %rax,%rax
je     1173 <main+0x33>
lea    0xeeb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a3 <main+0x63>
mov    0x2e3e(%rip),%rax
mov    (%rax),%ebp
mov    (%rbx),%rdi
call   1050 <basename@plt>
lea    0xe93(%rip),%rsi
lea    0xe98(%rip),%rcx
lea    0xeb1(%rip),%r8
mov    %ebp,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e17(%rip),%rax
movsd  (%rax),%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%esi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2da8(%rip),%rax
movsd  (%rax),%xmm0
lea    0xe9c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
movsd  0xdd7(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
movsd  0xdc6(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
movsd  0xdb8(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@LC_NUMERIC = global i32 0
@.str = [6 x i8] c"en_US\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.2 = [32 x i8] c"setlocale (LC_NUMERIC, \22en_US\22)\00"
@.str.3 = [8 x i8] c"failed\0A\00"
@.str.4 = [18 x i8] c"Locale set to %s\0A\00"
@.str.5 = [14 x i8] c"DBL_DIG = %d\0A\00"
@DBL_DIG = global i32 0
@.str.6 = [21 x i8] c"DBL_EPSILON = %.15g\0A\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.7 = [19 x i8] c"DBL_MANT_DIG = %d\0A\00"
@DBL_MANT_DIG = global i32 0
@.str.8 = [21 x i8] c"DBL_MAX_10_EXP = %d\0A\00"
@DBL_MAX_10_EXP = global i32 0
@.str.9 = [17 x i8] c"DBL_MAX = %.15g\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.10 = [26 x i8] c"dollars = $%'22.2f = $%g\0A\00"
@.str.11 = [32 x i8] c"US debt = $%'22.2f (Feb. 2013)\0A\00"
@.str.12 = [38 x i8] c"diameter of the universe = %g meters\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i32, i32* @LC_NUMERIC
%10 = call i8* @setlocale(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i8* @basename(i8* %17)
%19 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %23
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %13
%24 = load i32, i32* @DBL_DIG
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %24)
%26 = load double, double* @DBL_EPSILON
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %26)
%28 = load i32, i32* @DBL_MANT_DIG
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @DBL_MAX_10_EXP
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%32 = load double, double* @DBL_MAX
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), double %32)
store double 1.000000e+00, double* %7
br label %34
34: ; preds = %39, %23
%35 = load double, double* %7
%36 = fadd double %35, 1.000000e-02
%37 = load double, double* %7
%38 = fcmp ogt double %36, %37
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = load double, double* %7
%41 = fmul double %40, 2.000000e+00
store double %41, double* %7
br label %34
42: ; preds = %34
%43 = load double, double* %7
%44 = load double, double* %7
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), double %43, double %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), double 0x42AE5A9FE3406E00)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), double 8.800000e+26)
ret i32 0
}

LLVM IR (-O2):
@LC_NUMERIC = global i32 0
@.str = [6 x i8] c"en_US\00"
@stderr = global i32 0
@.str.1 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.2 = [32 x i8] c"setlocale (LC_NUMERIC, \22en_US\22)\00"
@.str.3 = [8 x i8] c"failed\0A\00"
@.str.4 = [18 x i8] c"Locale set to %s\0A\00"
@.str.5 = [14 x i8] c"DBL_DIG = %d\0A\00"
@DBL_DIG = global i32 0
@.str.6 = [21 x i8] c"DBL_EPSILON = %.15g\0A\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.7 = [19 x i8] c"DBL_MANT_DIG = %d\0A\00"
@DBL_MANT_DIG = global i32 0
@.str.8 = [21 x i8] c"DBL_MAX_10_EXP = %d\0A\00"
@DBL_MAX_10_EXP = global i32 0
@.str.9 = [17 x i8] c"DBL_MAX = %.15g\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.10 = [26 x i8] c"dollars = $%'22.2f = $%g\0A\00"
@.str.11 = [32 x i8] c"US debt = $%'22.2f (Feb. 2013)\0A\00"
@.str.12 = [38 x i8] c"diameter of the universe = %g meters\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @LC_NUMERIC
%4 = tail call i8* @setlocale(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i8* @basename(i8* %8)
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %13
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %13
13: ; preds = %11, %6
%14 = load i32, i32* @DBL_DIG
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = load double, double* @DBL_EPSILON
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %16)
%18 = load i32, i32* @DBL_MANT_DIG
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @DBL_MAX_10_EXP
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %20)
%22 = load double, double* @DBL_MAX
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), double %22)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), double 0x42E0000000000000, double 0x42E0000000000000)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), double 0x42AE5A9FE3406E00)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), double 8.800000e+26)
ret i32 0
}