#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 */
scalar_t__ fmod(double, int);
int pairs(double arr[], int size) {
  int i, counter = 0;
  for (i = 0; i < size; ++i)
    if (fmod(arr[i], 2) == 0)
      ++counter;
  return counter;
}


x86 assembly (clang, -O0):
<pairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1176 <pairs+0x66>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <fmod@plt>
cmp    $0x0,%rax
jne    1163 <pairs+0x53>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <pairs+0x58>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <pairs+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pairs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1152 <pairs+0x42>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r14,%rbx,8),%xmm0
mov    $0x2,%edi
call   1030 <fmod@plt>
cmp    $0x1,%rax
adc    $0x0,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <pairs+0x20>
jmp    1154 <pairs+0x44>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @pairs(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %23, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %26
11: ; preds = %7
%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 = call i64 @fmod(double %16, i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %22
22: ; preds = %19, %11
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %7
26: ; preds = %7
%27 = load i32, i32* %6
ret i32 %27
}

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