#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, ...);
void compare_two_vectors_exact_(int *sizef, float *vector1, float *vector2,
                                int *num_errors) {
  int size = *sizef;
  int i;
  int error_count = 0;
  for (i = 0; i < size; ++i) {
    if (vector1[i] != vector2[i]) {
      error_count++;
      if (error_count < 10) {
        printf("err[%d]: %e != %e\n", i, vector1[i], vector2[i]);
      }
    }
  }
  printf("**** Error Count: %d ****\n", error_count);
  *num_errors = error_count;
}


x86 assembly (clang, -O0):
<compare_two_vectors_exact_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11d3 <compare_two_vectors_exact_+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
ucomiss (%rax,%rcx,4),%xmm0
jne    1175 <compare_two_vectors_exact_+0x65>
jp     1175 <compare_two_vectors_exact_+0x65>
jmp    11c0 <compare_two_vectors_exact_+0xb0>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0xa,-0x2c(%rbp)
jge    11bb <compare_two_vectors_exact_+0xab>
mov    -0x28(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11c0 <compare_two_vectors_exact_+0xb0>
jmp    11c5 <compare_two_vectors_exact_+0xb5>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113f <compare_two_vectors_exact_+0x2f>
mov    -0x2c(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_two_vectors_exact_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    (%rdi),%r14d
test   %r14d,%r14d
jle    117e <compare_two_vectors_exact_+0x6e>
mov    %rdx,%r15
mov    %rsi,%r12
xor    %ebx,%ebx
lea    0xeca(%rip),%r13
xor    %eax,%eax
jmp    114d <compare_two_vectors_exact_+0x3d>
nopw   0x0(%rax,%rax,1)
mov    %eax,%ebp
add    $0x1,%rbx
mov    %ebp,%eax
cmp    %rbx,%r14
je     1180 <compare_two_vectors_exact_+0x70>
movss  (%r12,%rbx,4),%xmm0
movss  (%r15,%rbx,4),%xmm1
ucomiss %xmm1,%xmm0
jne    1160 <compare_two_vectors_exact_+0x50>
jnp    1140 <compare_two_vectors_exact_+0x30>
lea    0x1(%rax),%ebp
cmp    $0x8,%eax
jg     1142 <compare_two_vectors_exact_+0x32>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %r13,%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1142 <compare_two_vectors_exact_+0x32>
xor    %ebp,%ebp
lea    0xe8c(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rax
mov    %ebp,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"err[%d]: %e != %e\0A\00"
@.str.1 = [27 x i8] c"**** Error Count: %d ****\0A\00"
define void @compare_two_vectors_exact_(i32* %0, float* %1, float* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store float* %1, float** %6
store float* %2, float** %7
store i32* %3, i32** %8
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
store i32 %13, i32* %9
store i32 0, i32* %11
store i32 0, i32* %10
br label %14
14: ; preds = %52, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %9
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %55
18: ; preds = %14
%19 = load float*, float** %6
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
%23 = load float, float* %22
%24 = load float*, float** %7
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds float, float* %24, i64 %26
%28 = load float, float* %27
%29 = fcmp une float %23, %28
br i1 %29, label %30, label %51
30: ; preds = %18
%31 = load i32, i32* %11
%32 = add nsw i32 %31, 1
store i32 %32, i32* %11
%33 = load i32, i32* %11
%34 = icmp slt i32 %33, 10
br i1 %34, label %35, label %50
35: ; preds = %30
%36 = load i32, i32* %10
%37 = load float*, float** %6
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %37, i64 %39
%41 = load float, float* %40
%42 = fpext float %41 to double
%43 = load float*, float** %7
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = load float, float* %46
%48 = fpext float %47 to double
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %36, double %42, double %48)
br label %50
50: ; preds = %35, %30
br label %51
51: ; preds = %50, %18
br label %52
52: ; preds = %51
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %14
55: ; preds = %14
%56 = load i32, i32* %11
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %11
%59 = load i32*, i32** %8
store i32 %58, i32* %59
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"err[%d]: %e != %e\0A\00"
@.str.1 = [27 x i8] c"**** Error Count: %d ****\0A\00"
define void @compare_two_vectors_exact_(i32* nocapture %0, float* nocapture %1, float* nocapture %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* %0
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %29
7: ; preds = %4
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %25
%10 = phi i64 [ 0, %7 ], [ %27, %25 ]
%11 = phi i32 [ 0, %7 ], [ %26, %25 ]
%12 = getelementptr inbounds float, float* %1, i64 %10
%13 = load float, float* %12
%14 = getelementptr inbounds float, float* %2, i64 %10
%15 = load float, float* %14
%16 = fcmp une float %13, %15
br i1 %16, label %17, label %25
17: ; preds = %9
%18 = add nsw i32 %11, 1
%19 = icmp slt i32 %11, 9
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = fpext float %13 to double
%22 = fpext float %15 to double
%23 = trunc i64 %10 to i32
%24 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %23, double %21, double %22)
br label %25
25: ; preds = %9, %20, %17
%26 = phi i32 [ %18, %20 ], [ %18, %17 ], [ %11, %9 ]
%27 = add nuw nsw i64 %10, 1
%28 = icmp eq i64 %27, %8
br i1 %28, label %29, label %9
29: ; preds = %25, %4
%30 = phi i32 [ 0, %4 ], [ %26, %25 ]
%31 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %30)
store i32 %30, i32* %3
ret void
}