#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 fabs(float);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int Verify(float *a_host, float *b_host, float *c_host, int num_elem) {
  bool passed = true;
  for (int i = 0; i < num_elem; ++i) {
    if (fabs(a_host[i] + b_host[i] - c_host[i]) > 1e-5) {
      passed = false;
      break;
    }
  }
  if (!passed)
    fprintf(stderr, "Failed!\n");
  return 0;
}


x86 assembly (clang, -O0):
<Verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b2 <Verify+0x92>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe77(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    119f <Verify+0x7f>
movl   $0x0,-0x20(%rbp)
jmp    11b2 <Verify+0x92>
jmp    11a4 <Verify+0x84>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <Verify+0x25>
cmpl   $0x0,-0x20(%rbp)
jne    11d1 <Verify+0xb1>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Verify>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %ecx,%ecx
jle    117b <Verify+0x5b>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movss  (%r12,%rbx,4),%xmm0
addss  (%r15,%rbx,4),%xmm0
subss  (%r14,%rbx,4),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     1166 <Verify+0x46>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <Verify+0x20>
jmp    117b <Verify+0x5b>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"Failed!\0A\00"
define i32 @Verify(float* %0, float* %1, float* %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
store i32 1, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %38, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %41
15: ; preds = %11
%16 = load float*, float** %5
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = load float*, float** %6
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = load float, float* %24
%26 = fadd float %20, %25
%27 = load float*, float** %7
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
%31 = load float, float* %30
%32 = fsub float %26, %31
%33 = call i32 @fabs(float %32)
%34 = sitofp i32 %33 to double
%35 = fcmp ogt double %34, 1.000000e-05
br i1 %35, label %36, label %37
36: ; preds = %15
store i32 0, i32* %9
br label %41
37: ; preds = %15
br label %38
38: ; preds = %37
%39 = load i32, i32* %10
%40 = add nsw i32 %39, 1
store i32 %40, i32* %10
br label %11
41: ; preds = %36, %11
%42 = load i32, i32* %9
%43 = icmp ne i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %44, %41
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"Failed!\0A\00"
define i32 @Verify(float* nocapture %0, float* nocapture %1, float* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %26
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %22, %7
br i1 %9, label %26, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %22, %8 ]
%12 = getelementptr inbounds float, float* %0, i64 %11
%13 = load float, float* %12
%14 = getelementptr inbounds float, float* %1, i64 %11
%15 = load float, float* %14
%16 = fadd float %13, %15
%17 = getelementptr inbounds float, float* %2, i64 %11
%18 = load float, float* %17
%19 = fsub float %16, %18
%20 = tail call i32 @fabs(float %19)
%21 = icmp sgt i32 %20, 0
%22 = add nuw nsw i64 %11, 1
br i1 %21, label %23, label %8
23: ; preds = %10
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %8, %4, %23
ret i32 0
}