#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 int_max(int, int);
int frequency_of_most_common_value_in_sorted_farr(double *farr, int size) {
  int result = 1;
  int i;
  int count = 1;
  for (i = 1; i < size; i++) {
    if (farr[i] == farr[i - 1]) {
      count += 1;
      result = int_max(result, count);
    } else
      count = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<frequency_of_most_common_value_in_sorted_farr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a1 <frequency_of_most_common_value_in_sorted_farr+0x91>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jne    1187 <frequency_of_most_common_value_in_sorted_farr+0x77>
jp     1187 <frequency_of_most_common_value_in_sorted_farr+0x77>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <int_max@plt>
mov    %eax,-0x10(%rbp)
jmp    118e <frequency_of_most_common_value_in_sorted_farr+0x7e>
movl   $0x1,-0x18(%rbp)
jmp    1193 <frequency_of_most_common_value_in_sorted_farr+0x83>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <frequency_of_most_common_value_in_sorted_farr+0x24>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frequency_of_most_common_value_in_sorted_farr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%eax
cmp    $0x2,%esi
jl     116d <frequency_of_most_common_value_in_sorted_farr+0x5d>
mov    %rdi,%r15
mov    %esi,%r14d
mov    $0x1,%ebp
mov    $0x1,%ebx
mov    $0x1,%eax
jmp    1155 <frequency_of_most_common_value_in_sorted_farr+0x45>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %eax,%edi
mov    %ebp,%esi
call   1030 <int_max@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
je     116d <frequency_of_most_common_value_in_sorted_farr+0x5d>
movsd  (%r15,%rbx,8),%xmm0
ucomisd -0x8(%r15,%rbx,8),%xmm0
jne    1166 <frequency_of_most_common_value_in_sorted_farr+0x56>
jnp    1140 <frequency_of_most_common_value_in_sorted_farr+0x30>
mov    $0x1,%ebp
jmp    114c <frequency_of_most_common_value_in_sorted_farr+0x3c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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