#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 /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ test(double *);
int main(int argc, char **argv) {
  double value;
  test(&value);
  if (argc == 2 && !strcmp(argv[1], "-v"))
    printf("value = %.18e\n", value);
  if (value != 9.007199254740991e+15) {
    printf("t001 fails!\n");
    return -1;
  } else {
    printf("t001 works.\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)
lea    -0x18(%rbp),%rdi
call   1050 <test@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1189 <main+0x59>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1189 <main+0x59>
movsd  -0x18(%rbp),%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11ab <main+0x7b>
jp     11ab <main+0x7b>
jmp    11c5 <main+0x95>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11da <main+0xaa>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%rdi
call   1060 <test@plt>
cmp    $0x2,%ebp
jne    117c <main+0x3c>
mov    0x8(%rbx),%rdi
lea    0xea8(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    117c <main+0x3c>
movsd  (%rsp),%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
movsd  0xe77(%rip),%xmm1
ucomisd %xmm1,%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rbx
lea    0xe88(%rip),%rax
lea    0xe75(%rip),%rdi
cmovne %rax,%rdi
cmovp  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-v\00"
@.str.1 = [15 x i8] c"value = %.18e\0A\00"
@.str.2 = [13 x i8] c"t001 fails!\0A\00"
@.str.3 = [13 x i8] c"t001 works.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @test(double* %6)
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = load double, double* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %19
19: ; preds = %16, %10, %2
%20 = load double, double* %6
%21 = fcmp une double %20, 0x433FFFFFFFFFFFFF
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %26
26: ; preds = %24, %22
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"-v\00"
@.str.1 = [15 x i8] c"value = %.18e\0A\00"
@str = [12 x i8] c"t001 works.\00"
@str.4 = [12 x i8] c"t001 fails!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @test(double* %3)
%6 = icmp eq i32 %0, 2
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load double, double* %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %13)
br label %15
15: ; preds = %12, %7, %2
%16 = load double, double* %3
%17 = fcmp une double %16, 0x433FFFFFFFFFFFFF
%18 = select i1 %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0)
%19 = sext i1 %17 to i32
%20 = call i32 @puts(i8* dereferenceable(1) %18)
ret i32 %19
}