#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*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  double ff = 12.345;
  printf("%e, %f\n", ff, ff);
  printf("%E\n", ff);
  printf("%.3f\n", -0.0049);
  printf("%.30f\n", -0.0049);
  printf("%.3f\n", -0.00049);
  printf("%f\n", 1.0 / 0.0);
  printf("%f\n", -1.0 / 0.0);
  printf("%f\n", 0.0 / 0 / 0);
  float a, b, c;
  a = 1.34f;
  b = 1.22f;
  c = a + b;
  if (c == 2.56) {
    printf("a = b\n");
  } else {
    printf("a != b, c=%.10f 或 %f\n", c, c);
  }
  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)
movsd  0xf02(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xefc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xef1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
movsd  0xebb(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
movsd  0xea5(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
movsd  0xe87(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
movsd  0xe69(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
movsd  0xe4b(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
movsd  0xe2d(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe52(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe41(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    123f <main+0x12f>
jp     123f <main+0x12f>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125f <main+0x14f>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe08(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf20(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
movsd  0xec7(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rbx
movsd  0xeb9(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
movsd  0xea0(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe99(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rbx
movsd  0xe88(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe7e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe74(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
movsd  0xe63(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%e, %f\0A\00"
@.str.1 = [4 x i8] c"%E\0A\00"
@.str.2 = [6 x i8] c"%.3f\0A\00"
@.str.3 = [7 x i8] c"%.30f\0A\00"
@.str.4 = [4 x i8] c"%f\0A\00"
@.str.5 = [7 x i8] c"a = b\0A\00"
@.str.6 = [24 x i8] c"a != b, c=%.10f \E6\88\96 %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca float
%8 = alloca float
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.234500e+01, double* %6
%10 = load double, double* %6
%11 = load double, double* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %10, double %11)
%13 = load double, double* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double -4.900000e-03)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double -4.900000e-03)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double -4.900000e-04)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0x7FF0000000000000)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0xFFF0000000000000)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0x7FF8000000000000)
store float 0x3FF570A3E0000000, float* %7
store float 0x3FF3851EC0000000, float* %8
%21 = load float, float* %7
%22 = load float, float* %8
%23 = fadd float %21, %22
store float %23, float* %9
%24 = load float, float* %9
%25 = fpext float %24 to double
%26 = fcmp oeq double %25, 2.560000e+00
br i1 %26, label %27, label %29
27: ; preds = %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %35
29: ; preds = %2
%30 = load float, float* %9
%31 = fpext float %30 to double
%32 = load float, float* %9
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %31, double %33)
br label %35
35: ; preds = %29, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%e, %f\0A\00"
@.str.1 = [4 x i8] c"%E\0A\00"
@.str.2 = [6 x i8] c"%.3f\0A\00"
@.str.3 = [7 x i8] c"%.30f\0A\00"
@.str.4 = [4 x i8] c"%f\0A\00"
@.str.6 = [24 x i8] c"a != b, c=%.10f \E6\88\96 %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double 1.234500e+01, double 1.234500e+01)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 1.234500e+01)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double -4.900000e-03)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double -4.900000e-03)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double -4.900000e-04)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0x7FF0000000000000)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0xFFF0000000000000)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 0x7FF8000000000000)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double 0x40047AE140000000, double 0x40047AE140000000)
ret i32 0
}