#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 fabs(double);
int CheckTol(double *Grad, double *AbsTol, int numSS) {
  int i;
  for (i = 0; i < numSS; i++) {
    if (fabs(Grad[i]) > AbsTol[i]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<CheckTol>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    116c <CheckTol+0x6c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xeca(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1159 <CheckTol+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1173 <CheckTol+0x73>
jmp    115e <CheckTol+0x5e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <CheckTol+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckTol>:
mov    $0x1,%eax
test   %edx,%edx
jle    1139 <CheckTol+0x39>
mov    %edx,%ecx
xor    %edx,%edx
movapd 0xeeb(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rdi,%rdx,8),%xmm1
andpd  %xmm0,%xmm1
ucomisd (%rsi,%rdx,8),%xmm1
ja     113a <CheckTol+0x3a>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1120 <CheckTol+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @CheckTol(double* %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %28, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load double*, double** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = call double @llvm.fabs.f64(double %18)
%20 = load double*, double** %6
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = load double, double* %23
%25 = fcmp ogt double %19, %24
br i1 %25, label %26, label %27
26: ; preds = %13
store i32 0, i32* %4
br label %32
27: ; preds = %13
br label %28
28: ; preds = %27
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %9
31: ; preds = %9
store i32 1, i32* %4
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
define i32 @CheckTol(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %17, %6
br i1 %8, label %18, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %17, %7 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = tail call double @llvm.fabs.f64(double %12)
%14 = getelementptr inbounds double, double* %1, i64 %10
%15 = load double, double* %14
%16 = fcmp ogt double %13, %15
%17 = add nuw nsw i64 %10, 1
br i1 %16, label %18, label %7
18: ; preds = %9, %7, %3
%19 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %19
}