#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 */
double acos(double);
double asin(double);
int /*<<< orphan*/ file_write(double, char *);
int /*<<< orphan*/ report(double);
void test_inverse_trig() {
  double x, step;
  step = 1.0 / 100.0;
  for (x = -1.0; x <= 1.0; x += step) {
    report(x);
    file_write(x, "x_3");
    file_write(asin(x), "asin_x");
    file_write(acos(x), "acos_x");
  }
}


x86 assembly (clang, -O0):
<test_inverse_trig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xea6(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     11d0 <test_inverse_trig+0x90>
movsd  -0x8(%rbp),%xmm0
call   1060 <report@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe8d(%rip),%rdi
call   1050 <file_write@plt>
movsd  -0x8(%rbp),%xmm0
call   1040 <asin@plt>
lea    0xe7b(%rip),%rdi
call   1050 <file_write@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <acos@plt>
lea    0xe6c(%rip),%rdi
call   1050 <file_write@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1162 <test_inverse_trig+0x22>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_inverse_trig>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  0xeaf(%rip),%xmm0
lea    0xec0(%rip),%r14
lea    0xebd(%rip),%r15
lea    0xebd(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <report@plt>
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   1050 <file_write@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <asin@plt>
mov    %r15,%rdi
call   1050 <file_write@plt>
movsd  0x8(%rsp),%xmm0
call   1030 <acos@plt>
mov    %rbx,%rdi
call   1050 <file_write@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe45(%rip),%xmm0
movsd  0xe45(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1170 <test_inverse_trig+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"x_3\00"
@.str.1 = [7 x i8] c"asin_x\00"
@.str.2 = [7 x i8] c"acos_x\00"
define void @test_inverse_trig() {
%1 = alloca double
%2 = alloca double
store double 1.000000e-02, double* %2
store double -1.000000e+00, double* %1
br label %3
3: ; preds = %17, %0
%4 = load double, double* %1
%5 = fcmp ole double %4, 1.000000e+00
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load double, double* %1
%8 = call i32 @report(double %7)
%9 = load double, double* %1
%10 = call i32 @file_write(double %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load double, double* %1
%12 = call double @asin(double %11)
%13 = call i32 @file_write(double %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = load double, double* %1
%15 = call double @acos(double %14)
%16 = call i32 @file_write(double %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %6
%18 = load double, double* %2
%19 = load double, double* %1
%20 = fadd double %19, %18
store double %20, double* %1
br label %3
21: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"x_3\00"
@.str.1 = [7 x i8] c"asin_x\00"
@.str.2 = [7 x i8] c"acos_x\00"
define void @test_inverse_trig() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ -1.000000e+00, %0 ], [ %9, %1 ]
%3 = tail call i32 @report(double %2)
%4 = tail call i32 @file_write(double %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call double @asin(double %2)
%6 = tail call i32 @file_write(double %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call double @acos(double %2)
%8 = tail call i32 @file_write(double %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = fadd double %2, 1.000000e-02
%10 = fcmp ugt double %9, 1.000000e+00
br i1 %10, label %11, label %1
11: ; preds = %1
ret void
}