#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, double, double);
int check_results(double *A) {
  for (int i = 0; i < (992); i++) {
    if (A[i] != (1)) {
      printf("Error at %d, h = %lf, d = %lf\n", i, (double)(1), A[i]);
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e0,-0x14(%rbp)
jge    119d <check_results+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xebb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    115a <check_results+0x4a>
jp     115a <check_results+0x4a>
jmp    118a <check_results+0x7a>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe97(%rip),%rdi
movsd  0xe87(%rip),%xmm0
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <check_results+0x94>
jmp    118f <check_results+0x7f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <check_results+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_results>:
push   %rbx
movsd  (%rdi),%xmm1
ucomisd 0xee3(%rip),%xmm1
jne    1121 <check_results+0x11>
jnp    112a <check_results+0x1a>
mov    $0x1,%bl
xor    %esi,%esi
jmp    11a7 <check_results+0x97>
mov    $0xffffffffffffffff,%rsi
movsd  0xec7(%rip),%xmm0
nopl   0x0(%rax)
movsd  0x10(%rdi,%rsi,8),%xmm1
ucomisd %xmm0,%xmm1
jne    1195 <check_results+0x85>
jp     1195 <check_results+0x85>
movsd  0x18(%rdi,%rsi,8),%xmm1
ucomisd %xmm0,%xmm1
jne    119b <check_results+0x8b>
jp     119b <check_results+0x8b>
movsd  0x20(%rdi,%rsi,8),%xmm1
ucomisd %xmm0,%xmm1
jne    11a1 <check_results+0x91>
jp     11a1 <check_results+0x91>
cmp    $0x3db,%rsi
je     11c3 <check_results+0xb3>
movsd  0x28(%rdi,%rsi,8),%xmm1
add    $0x4,%rsi
ucomisd %xmm0,%xmm1
jne    1185 <check_results+0x75>
jnp    1140 <check_results+0x30>
cmp    $0x3df,%rsi
setb   %bl
add    $0x1,%rsi
jmp    11a7 <check_results+0x97>
add    $0x2,%rsi
jmp    11a5 <check_results+0x95>
add    $0x3,%rsi
jmp    11a5 <check_results+0x95>
add    $0x4,%rsi
mov    $0x1,%bl
lea    0xe5a(%rip),%rdi
movsd  0xe4a(%rip),%xmm0
call   1030 <printf@plt>
xor    $0x1,%bl
movzbl %bl,%eax
pop    %rbx
ret
add    $0x4,%rsi
cmp    $0x3df,%rsi
setb   %bl
jmp    11bb <check_results+0xab>

LLVM IR (-O0):
@.str = [31 x i8] c"Error at %d, h = %lf, d = %lf\0A\00"
define i32 @check_results(double* %0) {
%2 = alloca i32
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 0, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 992
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = load double*, double** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = load double, double* %12
%14 = fcmp une double %13, 1.000000e+00
br i1 %14, label %15, label %23
15: ; preds = %8
%16 = load i32, i32* %4
%17 = load double*, double** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %16, double 1.000000e+00, double %21)
store i32 0, i32* %2
br label %28
23: ; preds = %8
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %5
store i32 1, i32* %2
br label %28
28: ; preds = %27, %15
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [31 x i8] c"Error at %d, h = %lf, d = %lf\0A\00"
define i32 @check_results(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp une double %2, 1.000000e+00
br i1 %3, label %28, label %33
4: ; preds = %33
%5 = or i64 %34, 2
%6 = getelementptr inbounds double, double* %0, i64 %5
%7 = load double, double* %6
%8 = fcmp une double %7, 1.000000e+00
br i1 %8, label %23, label %9
9: ; preds = %4
%10 = or i64 %34, 3
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fcmp une double %12, 1.000000e+00
br i1 %13, label %23, label %14
14: ; preds = %9
%15 = add nuw nsw i64 %34, 4
%16 = icmp eq i64 %15, 992
br i1 %16, label %39, label %17
17: ; preds = %14
%18 = getelementptr inbounds double, double* %0, i64 %15
%19 = load double, double* %18
%20 = fcmp une double %19, 1.000000e+00
br i1 %20, label %21, label %33
21: ; preds = %17
%22 = icmp ult i64 %10, 991
br label %23
23: ; preds = %33, %4, %9, %21
%24 = phi double [ %19, %21 ], [ %12, %9 ], [ %7, %4 ], [ %37, %33 ]
%25 = phi i64 [ %15, %21 ], [ %10, %9 ], [ %5, %4 ], [ %35, %33 ]
%26 = phi i1 [ %22, %21 ], [ true, %9 ], [ true, %4 ], [ true, %33 ]
%27 = trunc i64 %25 to i32
br label %28
28: ; preds = %23, %1
%29 = phi i32 [ %27, %23 ], [ 0, %1 ]
%30 = phi i1 [ %26, %23 ], [ true, %1 ]
%31 = phi double [ %24, %23 ], [ %2, %1 ]
%32 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %29, double 1.000000e+00, double %31)
br label %41
33: ; preds = %1, %17
%34 = phi i64 [ %15, %17 ], [ 0, %1 ]
%35 = or i64 %34, 1
%36 = getelementptr inbounds double, double* %0, i64 %35
%37 = load double, double* %36
%38 = fcmp une double %37, 1.000000e+00
br i1 %38, label %23, label %4
39: ; preds = %14
%40 = icmp ult i64 %10, 991
br label %41
41: ; preds = %39, %28
%42 = phi i1 [ %30, %28 ], [ %40, %39 ]
%43 = xor i1 %42, true
%44 = zext i1 %43 to i32
ret i32 %44
}