#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*/ abort();
void check(double *_a, double *_b) {
  int i;
  double suma = 0;
  double sumb = 0;
  for (i = 0; i < 40; i++) {
    suma += _a[i];
    sumb += _b[i];
  }
  if (suma != 508)
    abort();
  if (sumb != 13340.00)
    abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x28,-0x14(%rbp)
jge    117d <check+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <check+0x27>
movsd  -0x20(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    119f <check+0x8f>
jp     119f <check+0x8f>
jmp    11a6 <check+0x96>
mov    $0x0,%al
call   1030 <abort@plt>
movsd  -0x28(%rbp),%xmm0
movsd  0xe55(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c8 <check+0xb8>
jp     11c8 <check+0xb8>
jmp    11cf <check+0xbf>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
xorpd  %xmm0,%xmm0
mov    $0x4,%eax
xorpd  %xmm1,%xmm1
xchg   %ax,%ax
addsd  -0x20(%rdi,%rax,8),%xmm1
addsd  -0x20(%rsi,%rax,8),%xmm0
addsd  -0x18(%rdi,%rax,8),%xmm1
addsd  -0x18(%rsi,%rax,8),%xmm0
addsd  -0x10(%rdi,%rax,8),%xmm1
addsd  -0x10(%rsi,%rax,8),%xmm0
addsd  -0x8(%rdi,%rax,8),%xmm1
addsd  -0x8(%rsi,%rax,8),%xmm0
addsd  (%rdi,%rax,8),%xmm1
addsd  (%rsi,%rax,8),%xmm0
add    $0x5,%rax
cmp    $0x2c,%rax
jne    1120 <check+0x10>
ucomisd 0xe94(%rip),%xmm1
jne    117e <check+0x6e>
jp     117e <check+0x6e>
ucomisd 0xe90(%rip),%xmm0
jne    117e <check+0x6e>
jp     117e <check+0x6e>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store i32 0, i32* %5
br label %8
8: ; preds = %26, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 40
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load double*, double** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double, double* %6
%18 = fadd double %17, %16
store double %18, double* %6
%19 = load double*, double** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load double, double* %7
%25 = fadd double %24, %23
store double %25, double* %7
br label %26
26: ; preds = %11
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %8
29: ; preds = %8
%30 = load double, double* %6
%31 = fcmp une double %30, 5.080000e+02
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %29
%35 = load double, double* %7
%36 = fcmp une double %35, 1.334000e+04
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (...) @abort()
unreachable
39: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @check(double* nocapture %0, double* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %41, %3 ]
%5 = phi double [ 0.000000e+00, %2 ], [ %40, %3 ]
%6 = phi double [ 0.000000e+00, %2 ], [ %37, %3 ]
%7 = getelementptr inbounds double, double* %0, i64 %4
%8 = load double, double* %7
%9 = fadd double %6, %8
%10 = getelementptr inbounds double, double* %1, i64 %4
%11 = load double, double* %10
%12 = fadd double %5, %11
%13 = add nuw nsw i64 %4, 1
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = fadd double %9, %15
%17 = getelementptr inbounds double, double* %1, i64 %13
%18 = load double, double* %17
%19 = fadd double %12, %18
%20 = add nuw nsw i64 %4, 2
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = fadd double %16, %22
%24 = getelementptr inbounds double, double* %1, i64 %20
%25 = load double, double* %24
%26 = fadd double %19, %25
%27 = add nuw nsw i64 %4, 3
%28 = getelementptr inbounds double, double* %0, i64 %27
%29 = load double, double* %28
%30 = fadd double %23, %29
%31 = getelementptr inbounds double, double* %1, i64 %27
%32 = load double, double* %31
%33 = fadd double %26, %32
%34 = add nuw nsw i64 %4, 4
%35 = getelementptr inbounds double, double* %0, i64 %34
%36 = load double, double* %35
%37 = fadd double %30, %36
%38 = getelementptr inbounds double, double* %1, i64 %34
%39 = load double, double* %38
%40 = fadd double %33, %39
%41 = add nuw nsw i64 %4, 5
%42 = icmp eq i64 %41, 40
br i1 %42, label %43, label %3
43: ; preds = %3
%44 = fcmp une double %37, 5.080000e+02
br i1 %44, label %45, label %47
45: ; preds = %43
%46 = tail call i32 (...) @abort()
unreachable
47: ; preds = %43
%48 = fcmp une double %40, 1.334000e+04
br i1 %48, label %49, label %51
49: ; preds = %47
%50 = tail call i32 (...) @abort()
unreachable
51: ; preds = %47
ret void
}